Training Mask R-CNN using RLE bitmasks error
See original GitHub issueI am following the Mask R-CNN tutorial and changed the dataset_dict to support segmentation maps in bitmap format using RLE instead of polygons. I confirmed the data is processed properly using detectron2 visualization tool. When trying to train the network, I’m getting an error regarding polygons.
File "/home/ubuntu/detectron2/detectron2/data/detection_utils.py", line 149, in transform_instance_annotations polygons = [np.asarray(p).reshape(-1, 2) for p in annotation["segmentation"]] File "/home/ubuntu/detectron2/detectron2/data/detection_utils.py", line 149, in <listcomp> polygons = [np.asarray(p).reshape(-1, 2) for p in annotation["segmentation"]] ValueError: cannot reshape array of size 1 into shape (2)
It seems there is no support for RLE format during training although the visualization works. Is there any way to train using bitmasks?
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (2 by maintainers)
Top GitHub Comments
I think I need to do a bit more to get this actually working.
int
explicitly, otherwise json dump complains aboutTypeError: Object of type 'uint32' is not JSON serializable
https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/datasets/coco.py#L339segmentation["counts"]
into an ascii string otherwise json dump complains about not being able to serialize bytes.TypeError: Object of type 'bytes' is not JSON serializable
Now the default dataloader can work with RLE formats inside your dataset. All you need is:
INPUT.MASK_FORMAT='bitmask'
.