Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 12 when training #754

Closed
yao-zheng-yi opened this issue Jun 20, 2020 · 4 comments
Closed

KeyError: 12 when training #754

yao-zheng-yi opened this issue Jun 20, 2020 · 4 comments

Comments

@yao-zheng-yi
Copy link

anyone can help me?

ctdet/yxh |### | train: [1][1152/11176]|Tot: 0:03:32 |ETA: 0:31:52 |loss 7.0469 |hm_loss 5.6721 |wh_loss 11.1695 |off_loss 0.2578 |Dat
ctdet/yxh |### | train: [1][1153/11176]|Tot: 0:03:32 |ETA: 0:31:52 |loss 7.0438 |hm_loss 5.6696 |wh_loss 11.1645 |off_loss 0.2578 |Dat
ctdet/yxh |### | train: [1][1154/11176]|Tot: 0:03:33 |ETA: 0:31:52 |loss 7.0415 |hm_loss 5.6676 |wh_loss 11.1610 |off_loss 0.2578 |Dat
ctdet/yxh |### | train: [1][1155/11176]|Tot: 0:03:33 |ETA: 0:31:52 |loss 7.0397 |hm_loss 5.6666 |wh_loss 11.1537 |off_loss 0.2578 |Dat
ctdet/yxh |### | train: [1][1156/11176]|Tot: 0:03:33 |ETA: 0:28:37 |loss 7.0365 |hm_loss 5.6640 |wh_loss 11.1480 |off_loss 0.2578 |Dat
ctdet/yxh |### | train: [1][1157/11176]|Tot: 0:03:33 |ETA: 0:28:37 |loss 7.0330 |hm_loss 5.6611 |wh_loss 11.1411 |off_loss 0.2578 |Data 0.002s(0.002s) |Net 0.185sTraceback (most recent call last):
File "main.py", line 102, in
main(opt)
File "main.py", line 70, in main
log_dict_train, _ = trainer.train(epoch, train_loader)
File "/home/cwy/CenterNet-master/src/lib/trains/base_trainer.py", line 119, in train
return self.run_epoch('train', epoch, data_loader)
File "/home/cwy/CenterNet-master/src/lib/trains/base_trainer.py", line 61, in run_epoch
for iter_id, batch in enumerate(data_loader):
File "/home/cwy/.conda/envs/yolo/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 568, in next
return self._process_next_batch(batch)
File "/home/cwy/.conda/envs/yolo/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 606, in _process_next_batch
raise Exception("KeyError:" + batch.exc_msg)
Exception: KeyError:Traceback (most recent call last):
File "/home/cwy/.conda/envs/yolo/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/cwy/.conda/envs/yolo/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/cwy/CenterNet-master/src/lib/datasets/sample/ctdet.py", line 102, in getitem
cls_id = int(self.cat_ids[ann['category_id']])
KeyError: 12

@yao-zheng-yi
Copy link
Author

I guess the problem maybe in train.json,but I can‘t find error.
感觉是json文件的问题,但是有时候又可以正常训练,报错信息太少了不知道怎么找原因,到底是哪里出错了呢?

@yao-zheng-yi
Copy link
Author

我知道了,类别ID的列表少了个12,低级错误

@wwq98
Copy link

wwq98 commented Oct 25, 2020

你好 请问怎么解决呢?

@wwq98
Copy link

wwq98 commented Oct 25, 2020

解决了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants