Returns: (H, W) array, a mask for all pixels that have a prediction
(self)
| 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: |