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

Method non_empty_mask

utils/visualizer.py:196–210  ·  view source on GitHub ↗

Returns: (H, W) array, a mask for all pixels that have a prediction

(self)

Source from the content-addressed store, hash-verified

194 self._sinfo[sid]["area"] = float(area)
195
196 def non_empty_mask(self):
197 """
198 Returns:
199 (H, W) array, a mask for all pixels that have a prediction
200 """
201 empty_ids = []
202 for id in self._seg_ids:
203 if id not in self._sinfo:
204 empty_ids.append(id)
205 if len(empty_ids) == 0:
206 return np.zeros(self._seg.shape, dtype=np.uint8)
207 assert (
208 len(empty_ids) == 1
209 ), ">1 ids corresponds to no labels. This is currently not supported"
210 return (self._seg != empty_ids[0]).numpy().astype(np.bool)
211
212 def semantic_masks(self):
213 for sid in self._seg_ids:

Callers 1

draw_panoptic_segMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected