I met the problem when I train myself VOCData, my data have 3 classes ('0B', '1B', '2B'),
the problem is:
2019-05-09 22:47:35,589 - INFO - Start running, host: dong@bigdong, work_dir: /home/dong/python-project/underwater/mmdetection/work_dirs/faster_rcnn_r50_fpn_1x_voc0712
2019-05-09 22:47:35,589 - INFO - workflow: [('train', 1)], max: 4 epochs
Traceback (most recent call last):
File "/home/dong/python-project/underwater/mmdetection/tools/train.py", line 92, in
main()
File "/home/dong/python-project/underwater/mmdetection/tools/train.py", line 88, in main
logger=logger)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/apis/train.py", line 59, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/apis/train.py", line 121, in _non_dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmcv/runner/runner.py", line 356, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmcv/runner/runner.py", line 258, in train
for i, data_batch in enumerate(data_loader):
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
KeyError: 'Traceback (most recent call last):\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in \n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/repeat_dataset.py", line 16, in getitem\n return self.dataset[idx % self._ori_len]\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/custom.py", line 169, in getitem\n data = self.prepare_train_img(idx)\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/custom.py", line 197, in prepare_train_img\n ann = self.get_ann_info(idx)\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/xml_style.py", line 44, in get_ann_info\n label = self.cat2label[name]\nKeyError: \'2B\'\n'
then I use "try, except" try to find the reason at:
"label = self.cat2label[name]"
It can run a whole epoch
I met the problem when I train myself VOCData, my data have 3 classes ('0B', '1B', '2B'), the problem is:
2019-05-09 22:47:35,589 - INFO - Start running, host: dong@bigdong, work_dir: /home/dong/python-project/underwater/mmdetection/work_dirs/faster_rcnn_r50_fpn_1x_voc0712 2019-05-09 22:47:35,589 - INFO - workflow: [('train', 1)], max: 4 epochs Traceback (most recent call last): File "/home/dong/python-project/underwater/mmdetection/tools/train.py", line 92, in
main()
File "/home/dong/python-project/underwater/mmdetection/tools/train.py", line 88, in main
logger=logger)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/apis/train.py", line 59, in train_detector
_non_dist_train(model, dataset, cfg, validate=validate)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/apis/train.py", line 121, in _non_dist_train
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmcv/runner/runner.py", line 356, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmcv/runner/runner.py", line 258, in train
for i, data_batch in enumerate(data_loader):
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
KeyError: 'Traceback (most recent call last):\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop\n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in \n samples = collate_fn([dataset[i] for i in batch_indices])\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/repeat_dataset.py", line 16, in getitem\n return self.dataset[idx % self._ori_len]\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/custom.py", line 169, in getitem\n data = self.prepare_train_img(idx)\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/custom.py", line 197, in prepare_train_img\n ann = self.get_ann_info(idx)\n File "/home/dong/anaconda3/envs/mmdet/lib/python3.6/site-packages/mmdet-0.6.0+1cbc88e-py3.6.egg/mmdet/datasets/xml_style.py", line 44, in get_ann_info\n label = self.cat2label[name]\nKeyError: \'2B\'\n'
then I use "try, except" try to find the reason at: "label = self.cat2label[name]" It can run a whole epoch