Skip to content

Commit 9b3810e

Browse files
arashwantensorflower-gardener
authored andcommitted
Internal change
PiperOrigin-RevId: 486497693
1 parent 153591c commit 9b3810e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

official/vision/data/create_coco_tf_record.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
'include_panoptic_masks', False, 'Whether to include category and '
6767
'instance masks in the result. These are required to run the PQ evaluator '
6868
'default: False.')
69+
flags.DEFINE_boolean(
70+
'panoptic_skip_crowd', False, 'Whether to skip crowd or not for panoptic '
71+
'annotations. default: False.')
6972
flags.DEFINE_string('output_file_prefix', '/tmp/train', 'Path to output file')
7073
flags.DEFINE_integer('num_shards', 32, 'Number of shards for output file.')
7174
_NUM_PROCESSES = flags.DEFINE_integer(
@@ -134,7 +137,9 @@ def generate_coco_panoptics_masks(segments_info, mask_path,
134137
for idx, segment in enumerate(segments_info):
135138
segment_id = segment['id']
136139
category_id = segment['category_id']
137-
140+
is_crowd = segment['iscrowd']
141+
if FLAGS.panoptic_skip_crowd and is_crowd:
142+
continue
138143
if is_category_thing[category_id]:
139144
encoded_category_id = _THING_CLASS_ID
140145
instance_id = idx + 1

0 commit comments

Comments
 (0)