Open tatigabru opened 5 years ago
It would be really nice to have this feature for instance segmentation. I had to set min_area and min_visibility as a negative value to keep all the boxes, since I have no way to figure out which boxes get removed.
@tatigabru I managed to get the filtered indexes using label_fields:
params = A.BboxParams(format="coco", label_fields=["bbox_ids"])
augumentor = A.Compose(transforms, **params)
auged = augumentor(image=image, bboxes=bboxes, bbox_ids=np.arange(len(bboxes)), masks=...)
Then you could use auged["bbox_ids"]
to filter masks and keypoints.
📚 Documentation
'A.BboxParams(min_area=min_area...)' removes small boxes. For instance segmentation, it would be handy to remove masks and key points for the same instance as well. In here one may add a list of removed instances: https://github.com/albu/albumentations/blob/master/albumentations/augmentations/bbox_utils.py
And then use it to remove corresponding masks and keypoints. To do it better, it would be nice to have masks also as a set for instance segmentation, to avoid glueing them together on one mask or using additional_targets. Masks, boxes and keypoints are related to the same instances in coco, etc., it would be handy for instance segmentation.