Closed Ilbotre closed 4 years ago
The documentation https://detectron2.readthedocs.io/tutorials/datasets.html says:
category_id (int): an integer in the range [0, num_categories) representing the category label.
If I make in that way I will obtain the error that I was talking about in this issue
category_id
should be 0 according to the above documentation.
Sorry but category_id
should’t be equal to 1 since all my annotations are of people?
Sorry but I have understood what you meant only right now. Thank you
I'm registering a new dataset for people detection purpose following your docs:https://detectron2.readthedocs.io/tutorials/datasets.html. All the annotations in this dataset, not in COCO format, are just of person. So, taking into account the wanted format of a dataset in detectron 2 I place in the "category_id" field present in "annotations"list[dict] the corresponding int value according to COCO annotations, that is 1 since I have only person annotations: obj = { "bbox": [x0, y0, w, h], "bbox_mode": BoxMode.XYWH_ABS, "category_id": 1, # Since I have just person annotations "iscrowd": 0 }
Then, when I want to register dataset metadata as follow: MetadataCatalog.get("my_dataset").thing_classes = ["person"]
I got this error:
File "/home/nicolo/Desktop/deep_learning/deep_vision/deep_vision/dataset/kaist_2015/data_preprocessing.py", line 212, in
dataset_dicts_lwir, dataset_dicts_rgb = main()
File "/home/nicolo/Desktop/deep_learning/deep_vision/deep_vision/dataset/kaist_2015/data_preprocessing.py", line 205, in main check_dataset_is_loaded_correctly(dataset_dicts_lwir, "kaist_lwir_train", n_img_to_visualize=5)
File "/home/nicolo/Desktop/deep_learning/deep_vision/deep_vision/engine/transfer_learning.py", line 150, in check_dataset_is_loaded_correctly vis = visualizer.draw_dataset_dict(d)
File "/home/nicolo/.conda/envs/detectron2/lib/python3.7/site-packages/detectron2/utils/visualizer.py", line 494, in draw_dataset_dict labels = [names[i] for i in labels]
File "/home/nicolo/.conda/envs/detectron2/lib/python3.7/site-packages/detectron2/utils/visualizer.py", line 494, in
labels = [names[i] for i in labels]
IndexError: list index out of range
In order to avoid this issue I HAVE TO put inside the "category_id" field present in "annotations" list[dict] a 0, as following: obj = { "bbox": [x0, y0, w, h], "bbox_mode": BoxMode.XYWH_ABS, "category_id": 0, # With 1 I fetch the above IndexError "iscrowd": 0 }
Why I can't express properly the category_id of my annotations according to COCO stardards?