When I used maskrcnn-benchmark to train my own dataset, the training period seemed to be done, but after training, it starting evaluation, the error occurred:
Problem
2020-04-08 17:21:24,019 maskrcnn_benchmark.trainer INFO: eta: 0:00:04 iter: 35980 loss: 0.0325 (0.0976) loss_classifier: 0.0041 (0.0369) loss_box_reg: 0.0021 (0.0098) loss_mask: 0.0255 (0.0486) loss_objectness: 0.0000 (0.0003) loss_rpn_box_reg: 0.0003 (0.0019) time: 0.2570 (0.2457) data: 0.0038 (0.0043) lr: 0.000010 max mem: 1738
2020-04-08 17:21:29,139 maskrcnn_benchmark.trainer INFO: eta: 0:00:00 iter: 36000 loss: 0.0344 (0.0975) loss_classifier: 0.0057 (0.0369) loss_box_reg: 0.0018 (0.0098) loss_mask: 0.0272 (0.0486) loss_objectness: 0.0000 (0.0003) loss_rpn_box_reg: 0.0002 (0.0019) time: 0.2535 (0.2458) data: 0.0039 (0.0043) lr: 0.000010 max mem: 1738
2020-04-08 17:21:29,164 maskrcnn_benchmark.utils.checkpoint INFO: Saving checkpoint to ./weights/model_final.pth
2020-04-08 17:21:29,422 maskrcnn_benchmark.trainer INFO: Total training time: 2:27:27.373877 (0.2458 s / it)
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
2020-04-08 17:21:29,461 maskrcnn_benchmark.inference INFO: Start evaluation on coco_2017_val dataset(11 images).
100%|███████████████████████████████████████████| 11/11 [00:01<00:00, 10.61it/s]
2020-04-08 17:21:30,521 maskrcnn_benchmark.inference INFO: Total run time: 0:00:01.060631 (0.09642098166725853 s / img per device, on 1 devices)
2020-04-08 17:21:30,522 maskrcnn_benchmark.inference INFO: Model inference time: 0:00:00.823244 (0.07484035058455034 s / img per device, on 1 devices)
2020-04-08 17:21:30,523 maskrcnn_benchmark.inference INFO: Preparing results for COCO format
2020-04-08 17:21:30,523 maskrcnn_benchmark.inference INFO: Preparing bbox results
Traceback (most recent call last):
File "tools/train_net.py", line 201, in
main()
File "tools/train_net.py", line 197, in main
run_test(cfg, model, args.distributed)
File "tools/train_net.py", line 128, in run_test
output_folder=output_folder,
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/engine/inference.py", line 120, in inference
extra_args)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/init.py", line 22, in evaluate
return coco_evaluation(args)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/init.py", line 23, in coco_evaluation
expected_results_sigma_tol=expected_results_sigma_tol,
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 44, in do_coco_evaluation
coco_results["bbox"] = prepare_for_coco_detection(predictions, dataset)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 88, in prepare_for_coco_detection
mapped_labels = [dataset.contiguous_category_id_to_json_id[i] for i in labels]
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 88, in
mapped_labels = [dataset.contiguous_category_id_to_json_id[i] for i in labels]
KeyError: 20.0
Environment
PyTorch version: 1.1.0
Is debug build: No
CUDA used to build PyTorch: 9.0.176
When I used maskrcnn-benchmark to train my own dataset, the training period seemed to be done, but after training, it starting evaluation, the error occurred:
Problem
2020-04-08 17:21:24,019 maskrcnn_benchmark.trainer INFO: eta: 0:00:04 iter: 35980 loss: 0.0325 (0.0976) loss_classifier: 0.0041 (0.0369) loss_box_reg: 0.0021 (0.0098) loss_mask: 0.0255 (0.0486) loss_objectness: 0.0000 (0.0003) loss_rpn_box_reg: 0.0003 (0.0019) time: 0.2570 (0.2457) data: 0.0038 (0.0043) lr: 0.000010 max mem: 1738 2020-04-08 17:21:29,139 maskrcnn_benchmark.trainer INFO: eta: 0:00:00 iter: 36000 loss: 0.0344 (0.0975) loss_classifier: 0.0057 (0.0369) loss_box_reg: 0.0018 (0.0098) loss_mask: 0.0272 (0.0486) loss_objectness: 0.0000 (0.0003) loss_rpn_box_reg: 0.0002 (0.0019) time: 0.2535 (0.2458) data: 0.0039 (0.0043) lr: 0.000010 max mem: 1738 2020-04-08 17:21:29,164 maskrcnn_benchmark.utils.checkpoint INFO: Saving checkpoint to ./weights/model_final.pth 2020-04-08 17:21:29,422 maskrcnn_benchmark.trainer INFO: Total training time: 2:27:27.373877 (0.2458 s / it) loading annotations into memory... Done (t=0.00s) creating index... index created! 2020-04-08 17:21:29,461 maskrcnn_benchmark.inference INFO: Start evaluation on coco_2017_val dataset(11 images). 100%|███████████████████████████████████████████| 11/11 [00:01<00:00, 10.61it/s] 2020-04-08 17:21:30,521 maskrcnn_benchmark.inference INFO: Total run time: 0:00:01.060631 (0.09642098166725853 s / img per device, on 1 devices) 2020-04-08 17:21:30,522 maskrcnn_benchmark.inference INFO: Model inference time: 0:00:00.823244 (0.07484035058455034 s / img per device, on 1 devices) 2020-04-08 17:21:30,523 maskrcnn_benchmark.inference INFO: Preparing results for COCO format 2020-04-08 17:21:30,523 maskrcnn_benchmark.inference INFO: Preparing bbox results Traceback (most recent call last): File "tools/train_net.py", line 201, in
main()
File "tools/train_net.py", line 197, in main
run_test(cfg, model, args.distributed)
File "tools/train_net.py", line 128, in run_test
output_folder=output_folder,
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/engine/inference.py", line 120, in inference
extra_args)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/init.py", line 22, in evaluate
return coco_evaluation(args)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/init.py", line 23, in coco_evaluation
expected_results_sigma_tol=expected_results_sigma_tol,
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 44, in do_coco_evaluation
coco_results["bbox"] = prepare_for_coco_detection(predictions, dataset)
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 88, in prepare_for_coco_detection
mapped_labels = [dataset.contiguous_category_id_to_json_id[i] for i in labels]
File "/home/drl/workspace/spikelet/1/maskrcnn-benchmark/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py", line 88, in
mapped_labels = [dataset.contiguous_category_id_to_json_id[i] for i in labels]
KeyError: 20.0
Environment
PyTorch version: 1.1.0 Is debug build: No CUDA used to build PyTorch: 9.0.176
OS: Ubuntu 16.04.6 LTS GCC version: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609 CMake version: version 3.15.5
Python version: 3.6 Is CUDA available: Yes CUDA runtime version: 9.0.176 GPU models and configuration: GPU 0: GeForce GTX 1080 Ti Nvidia driver version: 384.130 cuDNN version: /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7.6.0
Versions of relevant libraries: [pip3] numpy==1.11.1 [conda] _pytorch_select 0.2 gpu_0 http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main [conda] blas 1.0 mkl http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/free [conda] mkl 2020.0 166 http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main [conda] mkl-service 2.3.0 py36he904b0f_0 http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main [conda] mkl_fft 1.0.15 py36ha843d7b_0 http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main [conda] mkl_random 1.0.2 py36hd81dba3_0 http://mirror.tuna.tsinghua.edu.cn/anaconda/pkgs/main [conda] pytorch 1.1.0 py3.6_cuda9.0.176_cudnn7.5.1_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch [conda] torchvision 0.3.0
[conda] torchvision 0.3.0 py36_cu9.0.176_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
Pillow (4.2.1)
My labels are car1, car2, car3,..., car26 + background, total 27 classes.
Can anybody help me, please? Thank you very much.