facebookresearch / facebookresearch/detectron2
Potential bug on drawing segmentation mask with holes
- Dominant language
- Python
- Stars
- 34.7k
- Forks
- 7.9k
- PR merge metrics
- No merged PRs in 30d
Description
## Instructions To Reproduce the 🐛 Bug:
1. model has predicted segmentation masks with holes. (white area are predicted mask)

2. When `Visualizer.draw_instance_predictions()` create `GenericMask` and call `Visualizer.overlay_instances`
3. `Visualizer.overlay_instances` draws mask with "polygon" formate, which considers the holes inside the prediction (which have it own polygon) as part of the prediction.

4. This would induce result like this, where the holes are also considered as predicted area.

5. This is mainly because when the class::GenericMask return the polygon, it does not consider the hole information

and this have to do with `cv2.findContours(mask.astype("uint8"), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)` return holes inside the mask but there's not subsequrnce operation to filter out those polygon

Contributor guide
Assessment
This issue has not been assessed yet.