in 04_detect_segment/utils_box.py [0:0]
def __iou_gen_rectmap(cls, linmap, rects, tile_size):
"""Draws filled rectangles"""
x1, y1, x2, y2 = tf.unstack(rects, axis=-1) # shapes [batch, n]
x1tile = cls.__iou_tile_coordinate(x1, tile_size)
x2tile = cls.__iou_tile_coordinate(x2, tile_size)
y1tile = cls.__iou_tile_coordinate(y1, tile_size)
y2tile = cls.__iou_tile_coordinate(y2, tile_size)
zeros = tf.zeros_like(linmap, dtype=tf.uint8)
ones = tf.ones_like(linmap, dtype=tf.uint8)
mapx = tf.where(tf.greater_equal(linmap, x1tile), ones, zeros)
mapx = tf.where(tf.less(linmap, x2tile), mapx, zeros)
mapy = tf.where(tf.greater_equal(linmap, y1tile), ones, zeros)
mapy = tf.where(tf.less(linmap, y2tile), mapy, zeros)
mapy = tf.matrix_transpose(mapy)
map = tf.logical_and(tf.cast(mapx, tf.bool), tf.cast(mapy, tf.bool))
return map