I'm trying to train OneFormer for instance segmentation on a COCO dataset but the results were not really good so I decided to try training ADE20k first to try and detect errors in my code.
Training with ade20k for instance only, I get the following error:
File "/OneFormer-main/datasets/custom_datasets/instance_coco_custom_dataset_mapper.py", line 209, in call
instances = utils.annotations_to_instances(annos, image_shape)
File "/lib/python3.10/site-packages/detectron2/data/detection_utils.py", line 418, in annotations_to_instances
raise ValueError(
ValueError: Failed to use mask_format=='polygon' from the given annotations!
Here are the steps I followed:
I created a folder named "ADEChallengeData2016" under the datasets directory. I downloaded the annotations_instance/ and images/ in there. As I will only train for instance, I didn't download other files.
After this, I ran the prepare_ade20k_ins_seg.py file which created the json files. However, when I inspect the json files, I noticed "counts" key under the "segmentation" key for annotations have confusing values which may be the cause of the problem. Here is an example:
I use ade20k/oneformer_R50_bs16_160k.yaml config file and I changed TEST.SEMANTIC_ON and PANOPTIC_ON to False and TASK to "instance". I also changed dataset mapper to instance_coco_custom_dataset_mapper.
I'm trying to train OneFormer for instance segmentation on a COCO dataset but the results were not really good so I decided to try training ADE20k first to try and detect errors in my code.
Training with ade20k for instance only, I get the following error:
File "/OneFormer-main/datasets/custom_datasets/instance_coco_custom_dataset_mapper.py", line 209, in call instances = utils.annotations_to_instances(annos, image_shape) File "/lib/python3.10/site-packages/detectron2/data/detection_utils.py", line 418, in annotations_to_instances raise ValueError( ValueError: Failed to use mask_format=='polygon' from the given annotations!
Here are the steps I followed: I created a folder named "ADEChallengeData2016" under the datasets directory. I downloaded the annotations_instance/ and images/ in there. As I will only train for instance, I didn't download other files. After this, I ran the prepare_ade20k_ins_seg.py file which created the json files. However, when I inspect the json files, I noticed "counts" key under the "segmentation" key for annotations have confusing values which may be the cause of the problem. Here is an example:
{'id': 191613, 'image_id': 'ADE_train_00019634', 'iscrowd': 0, 'categoryid': 19, 'bbox': [668, 313, 94, 192], 'segmentation': {'size': [512, 763], 'counts': 'a^:8_?9_Oa0G9H8G9H8G9H8OM4L3L>C4K5L001N2O1N5M2L4100O1O2O0O100O2O0O1O100O2O0O100O101N10000O2O000O101O0O1000001O00000O2PBkNS=Q200O1000000F:FOF73;F;D;F:O2O001O01O01O00001O010O00001O01O01O1O01O01O001OhMX2bMa8'}, 'area': 8073}
I use ade20k/oneformer_R50_bs16_160k.yaml config file and I changed TEST.SEMANTIC_ON and PANOPTIC_ON to False and TASK to "instance". I also changed dataset mapper to instance_coco_custom_dataset_mapper.
How can I fix this?