Closed GodMmmm closed 4 years ago
模型参数文件是这样的
这是我的paddle版本
这个问题是你使用的模型导致的。你所使用的是通过export_model后得到的inference_model,如果想使用这个模型结构,需要使用cpp_infer.py进行预测,具体使用方式可以参考https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/docs/advanced_tutorials/inference/INFERENCE.md
如果是使用infer.py进行预测的话,需要使用训练保存模型,水果数据集+yolov3_mobilenet_v1的话可以使用https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar 这个模型链接,具体命令可以参考https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/docs/tutorials/QUICK_STARTED_cn.md 这个文档里的说明。
这个问题是你使用的模型导致的。你所使用的是通过export_model后得到的inference_model,如果想使用这个模型结构,需要使用cpp_infer.py进行预测,具体使用方式可以参考https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/docs/advanced_tutorials/inference/INFERENCE.md
如果是使用infer.py进行预测的话,需要使用训练保存模型,水果数据集+yolov3_mobilenet_v1的话可以使用https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1_fruit.tar 这个模型链接,具体命令可以参考https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/docs/tutorials/QUICK_STARTED_cn.md 这个文档里的说明。
感谢回复! 现在可以infer了 但是有一个问题,程序找不到annotation file(如图),是因为没有设置我的label_list吗 ,我尝试在cpp_infer.py和 cpp_demo.yml找到相关代码,但是没有找到。烦请帮忙看看,
请检查infer时的数据路径设置是否按照https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/configs/yolov3_mobilenet_v1_fruit.yml#L128 这里设置的,如果使用cpp_infer的话,看你在export model的时候自动导出里配置文件,可以更新下master分支重新导出下,然后在infer_cfg.yml中看到infer时使用的label_list是不是你期望的label
请检查infer时的数据路径设置是否按照https://github.com/PaddlePaddle/PaddleDetection/blob/release/0.2/configs/yolov3_mobilenet_v1_fruit.yml#L128 这里设置的,如果使用cpp_infer的话,看你在export model的时候自动导出里配置文件,可以更新下master分支重新导出下,然后在infer_cfg.yml中看到infer时使用的label_list是不是你期望的label
感谢您的回复! 我检查了Infer_cfg.yml label_list确实是我训练的label ,在实际预测结果也正常显示label,这个问题对检测结果并不影响,我再看看文档学学,再次感谢您的回复!
cpp_demo.yml和cpp_infer.py两个文件中代码显示只支持coco/voc这两个metric,其它的数据集不支持。所以用fruit和wider_face数据集跑的人都能跑但没有结果,还显示“Not found annotation file None, load coco17 categories.”这样的你看起来奇怪的内容,不能走export_model这条路,只能自己train后再infer。PaddleDetection 0.4版本开始不再支持cpp_xx这种形式的infer了。
(paddle) C:\Users\11480\PYwork\paddlepaddle-PaddleDetection-master\PaddleDetection>python -u tools/infer.py -c configs/yolov3_mobilenet_v1_fruit.yml -o weights=C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/inference_model/yolov3_mobilenet_v1_fruit/ --infer_img=demo/1.jpg --output_dir=C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/infer_output ######################### cmd输出########################### W0421 13:55:01.452873 7348 device_context.cc:237] Please NOTE: device: 0, CUDA Capability: 61, Driver API Version: 9.2, Runtime API Version: 9.0 W0421 13:55:01.458808 7348 device_context.cc:245] device: 0, cuDNN Version: 7.3. 2020-04-21 13:55:02,276-INFO: Loading parameters from C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/inference_model/yolov3_mobilenet_v1_fruit/... 2020-04-21 13:55:02,276-WARNING: C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/inference_model/yolov3_mobilenet_v1_fruit/.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] 2020-04-21 13:55:02,276-WARNING: C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/inference_model/yolov3_mobilenet_v1_fruit/.pdparams not found, try to load model file saved with [ save_params, save_persistables, save_vars ] C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\executor.py:789: UserWarning: The following exception is not an EOF exception. "The following exception is not an EOF exception.") Traceback (most recent call last): File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\io.py", line 1865, in load_program_state filename=file_name) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\io.py", line 793, in load_vars executor.run(load_prog) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\executor.py", line 790, in run six.reraise(*sys.exc_info()) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\six.py", line 703, in reraise raise value File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\executor.py", line 785, in run use_program_cache=use_program_cache) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\executor.py", line 838, in _run_impl use_program_cache=use_program_cache) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\executor.py", line 912, in _run_program fetch_var_name) paddle.fluid.core_avx.EnforceNotMet:
C++ Call Stacks (More useful to developers):
Windows not support stack backtrace yet.
Python Call Stacks (More useful to users):
File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\framework.py", line 2525, in append_op attrs=kwargs.get("attrs", None)) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\io.py", line 773, in load_vars attrs={'file_path': os.path.join(dirname, new_var.name)}) File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\io.py", line 1865, in load_program_state filename=file_name) File "C:\Users\11480\PYwork\paddlepaddle-PaddleDetection-master\PaddleDetection\ppdet\utils\checkpoint.py", line 91, in _load_state state = fluid.io.load_program_state(path) File "C:\Users\11480\PYwork\paddlepaddle-PaddleDetection-master\PaddleDetection\ppdet\utils\checkpoint.py", line 125, in load_params state = _load_state(path) File "tools/infer.py", line 139, in main checkpoint.load_params(exe, infer_prog, cfg.weights) File "tools/infer.py", line 272, in
main()
Error Message Summary:
InvalidArgumentError: tensor version 1600484213 is not supported, Only version 0 is supported [Hint: Expected version == 0U, but received version:1600484213 != 0U:0.] at (D:\1.7.2\paddle\paddle\fluid\framework\lod_tensor.cc:287) [operator < load > error]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "tools/infer.py", line 272, in
main()
File "tools/infer.py", line 139, in main
checkpoint.load_params(exe, infer_prog, cfg.weights)
File "C:\Users\11480\PYwork\paddlepaddle-PaddleDetection-master\PaddleDetection\ppdet\utils\checkpoint.py", line 125, in load_params
state = _load_state(path)
File "C:\Users\11480\PYwork\paddlepaddle-PaddleDetection-master\PaddleDetection\ppdet\utils\checkpoint.py", line 91, in _load_state
state = fluid.io.load_program_state(path)
File "C:\Users\11480\Anaconda3\envs\paddle\lib\site-packages\paddle\fluid\io.py", line 1868, in load_program_state
"Failed to load model file , please make sure model file is saved with the "
RuntimeError: Failed to load model file , please make sure model file is saved with the following APIs: save_params, save_persistables, save_vars
在weights=C:/Users/11480/PYwork/paddlepaddle-PaddleDetection-master/PaddleDetection/inference_model/yolov3_mobilenet_v1_fruit/ 后加不加/都试了