PaddlePaddle / PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Apache License 2.0
12.79k stars 2.89k forks source link

PD安装文档快速体验报错 KeyError:36 output没有预测图像输出 #7158

Open cunjing56 opened 2 years ago

cunjing56 commented 2 years ago

问题确认 Search before asking

Bug组件 Bug Component

No response

Bug描述 Describe the Bug

python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg W1020 14:29:32.354683 10416 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 10.2 W1020 14:29:32.360683 10416 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6. [10/20 14:29:32] ppdet.utils.download INFO: Downloading ppyolo_r50vd_dcn_1x_coco.pdparams from https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams 100%|███████████████████████████████| 277591/277591 [00:28<00:00, 9576.04KB/s] [10/20 14:30:03] ppdet.utils.checkpoint INFO: Finish loading model weights: C:\Users\NINGMEI/.cache/paddle/weights\ppyolo_r50vd_dcn_1x_coco.pdparams loading annotations into memory... Done (t=0.05s) creating index... index created! 100%|██████████████████████████████████████████| 1/1 [09:11<00:00, 551.03s/it] Traceback (most recent call last): File "tools/infer.py", line 226, in main() File "tools/infer.py", line 222, in main run(FLAGS, cfg) File "tools/infer.py", line 187, in run visualize=FLAGS.visualize) File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 905, in predict batch_res = get_infer_results(outs, clsid2catid) File "D:\pkg\PaddleDetection\ppdet\metrics\coco_utils.py", line 53, in get_infer_results outs['bbox'], outs['bbox_num'], im_id, catid, bias=bias) File "D:\pkg\PaddleDetection\ppdet\metrics\json_results.py", line 30, in get_det_res category_id = label_to_cat_id_map[int(num_id)] KeyError: 36

复现环境 Environment

windows:10 paddlepaddlegpu:2.2.2 paddleDetection: 2.5.0 python: 3.7.13 cuda:10.2 cudnn:7.6.5.32

Bug描述确认 Bug description confirmation

是否愿意提交PR? Are you willing to submit a PR?

lyuwenyu commented 2 years ago

建议试一下paddle2.3.2 这边测试没问题啊

image
cunjing56 commented 2 years ago

更新了,paddlepaddle-gpu 2.3.2
D:\pkg\PaddleDetection>python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg W1021 14:15:58.516777 6188 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 10.2 W1021 14:15:58.530730 6188 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6. [10/21 14:16:00] ppdet.utils.checkpoint INFO: Finish loading model weights: C:\Users\NINGMEI/.cache/paddle/weights\ppyolo_r50vd_dcn_1x_coco.pdparams loading annotations into memory... Done (t=0.05s) creating index... index created! 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [10:02<00:00, 602.08s/it] Traceback (most recent call last): File "tools/infer.py", line 226, in main() File "tools/infer.py", line 222, in main run(FLAGS, cfg) File "tools/infer.py", line 187, in run visualize=FLAGS.visualize) File "D:\pkg\PaddleDetection\ppdet\engine\trainer.py", line 905, in predict batch_res = get_infer_results(outs, clsid2catid) File "D:\pkg\PaddleDetection\ppdet\metrics\coco_utils.py", line 53, in get_infer_results outs['bbox'], outs['bbox_num'], im_id, catid, bias=bias) File "D:\pkg\PaddleDetection\ppdet\metrics\json_results.py", line 30, in get_det_res category_id = label_to_cat_id_map[int(num_id)] KeyError: 36

lyuwenyu commented 2 years ago

paddledetection的版本呢 ?

cunjing56 commented 2 years ago

上面环境写了,是2.5.0

lyuwenyu commented 2 years ago

你代码或者配置文件啥的改过没? coco数据集是80类的 感觉36应该不会出现这个

cunjing56 commented 2 years ago

你代码或者配置文件啥的改过没? coco数据集是80类的 感觉36应该不会出现这个

我刚刚重新按照安装教程走了一遍,现在不报错了。但是output里的图片没有任何标注。 D:\pkg\PaddleDetection>python ppdet/modeling/tests/test_architectures.py INFO 2022-10-21 14:51:14,332 utils.py:148] Note: NumExpr detected 24 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8. W1021 14:51:14.525125 532 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 10.2 W1021 14:51:14.560138 532 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6. .......

Ran 7 tests in 0.910s

OK

(base) D:\pkg\PaddleDetection>python tools/infer.py -c configs/ppyolo/ppyolo_r50vd_dcn_1x_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyolo_r50vd_dcn_1x_coco.pdparams --infer_img=demo/000000014439.jpg INFO 2022-10-21 14:51:29,745 utils.py:148] Note: NumExpr detected 24 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8. W1021 14:51:29.853114 2044 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.6, Runtime API Version: 10.2 W1021 14:51:29.859094 2044 gpu_resources.cc:91] device: 0, cuDNN Version: 7.6. [10/21 14:51:31] ppdet.utils.checkpoint INFO: Finish loading model weights: C:\Users\NINGMEI/.cache/paddle/weights\ppyolo_r50vd_dcn_1x_coco.pdparams [10/21 14:51:31] ppdet.data.source.category WARNING: anno_file 'dataset/coco\annotations/instances_val2017.json' is None or not set or not exist, please recheck TrainDataset/EvalDataset/TestDataset.anno_path, otherwise the default categories will be used by metric_type. [10/21 14:51:31] ppdet.data.source.category WARNING: metric_type: COCO, load default categories of COCO. 100%|███████████████████████████████████████████████████████████████████████████████████| 1/1 [10:33<00:00, 633.96s/it] [10/21 15:02:05] ppdet.engine INFO: Detection bbox results save in output\000000014439.jpg

cunjing56 commented 2 years ago

我的问题是,cuda driver 版本 跟 cuda api版本不同,如果driver是11.6,建议安装cuda 11.6的paddlepaddle-gpu。然后运行就没有问题了。