Unverified Commit b14f82a3 authored by srihari-humbarwadi's avatar srihari-humbarwadi
Browse files

skip boxes with zero area while pasting masks

parent 2e908198
...@@ -79,13 +79,14 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer): ...@@ -79,13 +79,14 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer):
pasted_mask = tf.ones( pasted_mask = tf.ones(
self._output_size + [1], dtype=mask.dtype) * self._void_class_label self._output_size + [1], dtype=mask.dtype) * self._void_class_label
ymin = box[0] ymin = tf.clip_by_value(box[0], 0, self._output_size[0])
xmin = box[1] xmin = tf.clip_by_value(box[1], 0, self._output_size[1])
ymax = tf.clip_by_value(box[2] + 1, 0, self._output_size[0]) ymax = tf.clip_by_value(box[2] + 1, 0, self._output_size[0])
xmax = tf.clip_by_value(box[3] + 1, 0, self._output_size[1]) xmax = tf.clip_by_value(box[3] + 1, 0, self._output_size[1])
box_height = ymax - ymin box_height = ymax - ymin
box_width = xmax - xmin box_width = xmax - xmin
if not (box_height == 0 or box_width == 0):
# resize mask to match the shape of the instance bounding box # resize mask to match the shape of the instance bounding box
resized_mask = tf.image.resize( resized_mask = tf.image.resize(
mask, mask,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment