Closed SkeletonOne closed 4 years ago
Please include full logs as the issue template requested.
@ppwwyyxx Thanks for your reply, but I am not sure what does 'full logs' means. The block I ran in google colab is ''' from detectron2.data import DatasetCatalog, MetadataCatalog dataset_dicts = DatasetCatalog.get("voc2007train") my_metadata = MetadataCatalog.get("voc2007train") for d in random.sample(dataset_dicts, 3): img = cv2.imread(d["file_name"]) visualizer = Visualizer(img[:, :, ::-1], metadata=my_metadata, scale=0.5) vis = visualizer.draw_dataset_dict(d) cv2_imshow(vis.get_image()[:, :, ::-1]) '''
AssertionError Traceback (most recent call last)
Environment:
sys.platform linux
Python 3.6.9 (default, Nov 7 2019, 10:44:02) [GCC 8.3.0]
numpy 1.18.2
detectron2 0.1.1 @/content/detectron2/detectron2
detectron2 compiler GCC 7.5
detectron2 CUDA compiler 10.0
detectron2 arch flags sm_61
DETECTRON2_ENV_MODULE
PyTorch built with:
OK.. I'm not familiar with Colab but from what you described it sounds like the assertion happens at line 153, although the logs say 154.
In that case, your json file has annotations that are "ignored" which we do not support.
@ppwwyyxx So it means the official .json file of PASCAL VOC provided by COCO website does not meet the requirements of registering a custom dataset in coco format.... am I right?
That's right. In fact I'm not even sure those json are converted correctly from the original dataset. There is no code that shows how they are generated.
@ppwwyyxx I just checked the json file and obviously pascal voc has a "ignore" annotation. One instance in pascal voc 2007 json file: {"segmentation":[[0,247,0,307,42,307,42,247]],"area":2520,"iscrowd":0,"image_id":1548,"bbox":[0,247,42,60],"category_id":9,"id":1159,"ignore":1} One instance in coco 2017 val file: {"segmentation": [[315.45,158.61,301.63,159.87,296.61,145.21,297.45,133.49,293.68,132.65,294.1,118.0,304.98,103.35,310.01,100.0,338.89,101.67,339.73,119.68,341.82,139.35,327.59,141.03,319.22,143.96]],"area": 2065.0249,"iscrowd": 0,"image_id": 210273,"bbox": [293.68,100.0,48.14,59.87],"category_id": 6,"id": 169222}
So I suppose by letting the code ignore the "ignore" annotation may helps.....
solved by adding anno.pop("ignore")
in coco.py
As far as I know, the original official VOC dataset does not have "ignore" annotation. I guess they may correspond to the "difficult" annotations in VOC.
So I would not recommend using these json files for serious purposes.
@ppwwyyxx Yeah thanks for your reply. You know, I searched for some other scripts of making a COCO format json file for Pascal VOC dataset, and they all just added 'ignore' for it. So since I am just trying to figure out the detection results on Pascal VOC, I will just simply remove the 'ignore' label. Anyway, the visualization of the ground truth seems good. Thanks for your excellent work of Detectron2 again!
If you do not know the root cause of the problem / bug, and wish someone to help you, please post according to this template:
Instructions To Reproduce the Issue:
git diff
) or what code you wrotefrom detectron2.data import DatasetCatalog, MetadataCatalog dataset_dicts = DatasetCatalog.get("voc2012val")
[03/23 01:51:26 d2.data.datasets.coco]: Loaded 5823 images in COCO format from ./pascal_val2012.json
AssertionError Traceback (most recent call last)