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

paste masks only for valid instances

parent 39678c06
...@@ -116,7 +116,6 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer): ...@@ -116,7 +116,6 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer):
- instance_mask: A `tf.Tensor for instance masks. - instance_mask: A `tf.Tensor for instance masks.
""" """
# Paste instance masks # Paste instance masks
pasted_masks = self._paste_masks_fn((detections_masks, boxes))
# Offset stuff class predictions # Offset stuff class predictions
segmentation_mask = tf.where( segmentation_mask = tf.where(
...@@ -135,7 +134,6 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer): ...@@ -135,7 +134,6 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer):
instance_mask = tf.ones( instance_mask = tf.ones(
mask_shape, dtype=tf.float32) * self._void_instance_id mask_shape, dtype=tf.float32) * self._void_instance_id
# filter instances with low confidence # filter instances with low confidence
sorted_scores = tf.sort(scores, direction='DESCENDING') sorted_scores = tf.sort(scores, direction='DESCENDING')
...@@ -149,6 +147,10 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer): ...@@ -149,6 +147,10 @@ class PanopticSegmentationGenerator(tf.keras.layers.Layer):
tf.cast(loop_end_idx, dtype=tf.int32), tf.cast(loop_end_idx, dtype=tf.int32),
self._max_num_detections) self._max_num_detections)
pasted_masks = self._paste_masks_fn((
detections_masks[:loop_end_idx],
boxes[:loop_end_idx]))
# add things segmentation to panoptic masks # add things segmentation to panoptic masks
for i in range(loop_end_idx): for i in range(loop_end_idx):
# we process instances in decending order, which will make sure # we process instances in decending order, which will make sure
......
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