使用Python API进行预测,cpp_infer.py报错
Created by: yinggo
在训练的过程中没有将back_ground 归为一类:
INFO: The 'num_classes'(number of classes) you set is 20, and 'with_background' in 'dataset' sets False. So please note the actual number of categories is 20.
模型训练好后可以导出,但用cpp_infer时报错:
2020-05-17 15:36:47,008-INFO: The architecture is YOLO 2020-05-17 15:36:47,008-INFO: Extra info: im_size W0517 15:36:48.005503 10533 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 61, Driver API Version: 10.0, Runtime API Version: 10.0 W0517 15:36:48.011119 10533 device_context.cc:245] device: 0, cuDNN Version: 7.6. 2020-05-17 15:36:49,286-INFO: warmup... 2020-05-17 15:36:50,368-INFO: run benchmark... Inference: 101.74540996551514 ms per batch image Traceback (most recent call last): File "tools/cpp_infer.py", line 628, in infer() File "tools/cpp_infer.py", line 579, in infer clsid2catid, catid2name = get_category_info(conf['with_background'], KeyError: 'with_background'
我尝试直接将 conf['with_background']去掉,更改为 clsid2catid, catid2name = get_category_info(conf['label_list']),报错:
Traceback (most recent call last): File "tools/cpp_infer.py", line 629, in infer() File "tools/cpp_infer.py", line 581, in infer clsid2catid, catid2name = get_category_info(conf['label_list']) KeyError: 'label_list'
请问怎么解决?