roytseng-tw / Detectron.pytorch

A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.
MIT License
2.82k stars 567 forks source link

Error while loading custom dataset #139

Open stefat77 opened 6 years ago

stefat77 commented 6 years ago

Hello, I would like to run detectron on my own dataset. I just have to detect and segment a single class. In order to do that I converted my dataset to coco format as follows:

I made a folder containing all the train pics in data/coco/images/satellite Every pic has a random string as a name.

I generated the annotations for each instance and I saved the json file in data/coco/annotations Every instance has these information: {'id': 955, 'image_id': 'haF473KL7', 'category_id': 1, 'iscrowd': 0, 'area': 146, 'bbox': [446.0, 721.0, 19.0, 13.0], 'segmentation': [[449.0, 733.5, 446.0, 725.5, 462.5, 721.0, 464.0, 728.5, 449.0, 733.5]], 'width': 512, 'height': 512} id : is just a counter that counts the instances image_id : contains the file name of the image (without format)

I also changed the dataset catalog and the train_net_step.py file accordingly. When I run the training the console returns this error:

INFO roidb.py: 50: Appending horizontally-flipped training examples... INFO roidb.py: 52: Loaded dataset: satellite_train INFO roidb.py: 143: Filtered 208138 roidb entries: 208138 -> 0 INFO roidb.py: 69: Computing image aspect ratios and ordering the ratios... INFO roidb.py: 71: done INFO roidb.py: 75: Computing bounding-box regression targets... INFO roidb.py: 77: done Traceback (most recent call last): File "tools/train_net_step.py", line 457, in main() File "tools/train_net_step.py", line 233, in main cfg.TRAIN.DATASETS, cfg.TRAIN.PROPOSAL_FILES) File "/home/stefan/Satellite/mask-rcnn.pytorch/lib/datasets/roidb.py", line 79, in combined_roidb_for_training _compute_and_log_stats(roidb) File "/home/stefan/Satellite/mask-rcnn.pytorch/lib/datasets/roidb.py", line 230, in _compute_and_log_stats classes = roidb[0]['dataset'].classes IndexError: list index out of range

Any idea how to solve this issue? Thank you

qinhaifangpku commented 5 years ago

I happend to this problem too

qinhaifangpku commented 5 years ago

I have found that error comes from that maybe you did not generate the right format of json file.