MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / valid

Function valid

datasets/build.py:93–102  ·  view source on GitHub ↗
(anns)

Source from the content-addressed store, hash-verified

91 num_before = len(dataset_dicts)
92
93 def valid(anns):
94 for ann in anns:
95 if isinstance(ann, list):
96 for instance in ann:
97 if instance.get("iscrowd", 0) == 0:
98 return True
99 else:
100 if ann.get("iscrowd", 0) == 0:
101 return True
102 return False
103
104 dataset_dicts = [x for x in dataset_dicts if valid(x["annotations"])]
105 num_after = len(dataset_dicts)

Calls

no outgoing calls

Tested by

no test coverage detected