Hi,
Thank you for the great documentation regarding training on custom datasets. I was unable to find the correct format for specifying masks in the annotations. My guess is that for each bounding box there should be a corresponding binary array in annotation['ann']['masks'] with the same dimensions as the image.
For example, a file with 4 bounding boxes on a 1200 x 800 image would have binary mask annotations of size 4 x 1200 x 800, even if they are each of different classes.
Thanks for your help.
For COCO-style datasets, masks are annotated with polygons and stored in the json file after being encoded. In the dataset, these annotations will be decoded to binary masks, and you can refer to _parse_ann_info() for details.
For custom datasets with mask annotations, you can either (1) convert the mask annotation to the format compatible with COCO dataset, or (2) override the get_ann_info method as mentioned in the documentation. I prefer the second choice.
@hellock
Hi,
I have the same question as @i-pan , and I looked up the founction "get_ann_info" in coco.py. However, it said "masks are raw annotations and not decoded into binary masks". I can not find where the polygon annotations has been converted to binary masks, could you tell me about it?
Thanks!
Most helpful comment
For COCO-style datasets, masks are annotated with polygons and stored in the json file after being encoded. In the dataset, these annotations will be decoded to binary masks, and you can refer to _parse_ann_info() for details.
For custom datasets with mask annotations, you can either (1) convert the mask annotation to the format compatible with COCO dataset, or (2) override the
get_ann_infomethod as mentioned in the documentation. I prefer the second choice.