facebookresearch / Detectron

FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.
Apache License 2.0
26.22k stars 5.45k forks source link

Configuring COCO 2017 Data #913

Open BisratM opened 5 years ago

BisratM commented 5 years ago

Hello. I've reread the installation instructions multiple times but it is still unclear to me how to set up the COCO 2017 data set and I was hoping someone could elaborate. Other people have faced this issue at least several times such as #59 and it is still unclear how to do it so any help would be appreciated. Currently the issue is that it is very unclear what we're supposed to do with the customized instances_minival2014..json and instances_valminusminival2014.json files. The instructions vaguely state that

minival is exactly equivalent to the recently defined 2017 val set. Similarly, the union of valminusminival and the 2014 train is exactly equivalent to the 2017 train set.

It is not clear what this means in terms of changes that we're supposed to make to the directory(it certainly won't work if one follows the instructions and places the two aforementioned files in the annotation folder) . It is also worth noting that the 2017 data set doesn't follow the same naming convention with its images as the 2014 data set. Again, any clarifications would be very helpful.

JLIEW008 commented 5 years ago

I am not sure if I understand your question fully, but you can add new datasets using the following method:

$detectron/detectron/datasets/dataset_catalog.pycontains a list of 'available' datasets. If you want to add coco 2017 into the set of available datasets, you could add the following into the dataset_catalog.py:

'coco_2017_train': {
  _IM_DIR:
    _DATA_DIR + 'coco/coco_train2017', 
  _ANNS_FN:
    _DATA_DIR + coco/annotations/instances_train2017.json
}

Ensure that _IM_DIR points to the folder with your images, and _ANNS_FN points to the json file with annotations of all your images. You can add more of these for your val, test datasets. With regards to the problem regarding coco 2017 having a different naming convention as compared to coco 2014, it does not matter as long as your json file contains the actual image names in your image folder.

Now, you need to change your config files to tell train_net.py to use these datasets. You can change them under TRAIN and TEST - DATASETS respectively. E.g. DATASETS: ('coco_2017_train',)

Hope this helps :)