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

导出模型后的推理失败 #9291

Open
1 task done
edenatoniuma opened this issue Jan 27, 2025 · 4 comments
Open
1 task done

导出模型后的推理失败 #9291

edenatoniuma opened this issue Jan 27, 2025 · 4 comments
Assignees

Comments

@edenatoniuma
Copy link

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

训练完的模型用来推理是没有问题的,具体命令如下:

python .\infer.py -c 
..\configs\ppyolo\ppyolo_r50vd_dcn_1x_coco.yml

-o weights=G:\projects\GraduationProject\PaddleDetection-release-2.8\batch_size_1_model\model.pdparams 

--infer_img=G:\projects\GraduationProject\PaddleDetection-release-2.8\dataset\area_coco\images\Video1_0005.jpeg

使用tools/export.py导出模型后,也成功生成了对应的文件,然后用命令推理:

文件:
目录: G:\projects\GraduationProject\PaddleDetection-release-2.8\inference_model\ppyolo_r50vd_dcn_1x_coco


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         2025/1/27     16:49            371 infer_cfg.yml
-a----         2025/1/27     16:49      186775554 model.pdiparams
-a----         2025/1/27     16:49          42202 model.pdiparams.info
-a----         2025/1/27     16:49         530112 model.pdmodel


推理:
python .\deploy\python\infer.py 

--model_dir=G:/projects/GraduationProject/PaddleDetection-release-2.8/inference_model/ppyolo_r50vd_dcn_1x_coco 

--image_file=G:/projects/GraduationProject/PaddleDetection-release-2.8/dataset/area_coco/images/Video1_0005.jpeg 

--device GPU

出现报错原因如下:

-----------  Running Arguments -----------
action_file: None
batch_size: 1
camera_id: -1
collect_trt_shape_info: False
combine_method: nms
cpu_threads: 1
device: GPU
enable_mkldnn: False
enable_mkldnn_bfloat16: False
image_dir: None
image_file: G:/projects/GraduationProject/PaddleDetection-release-2.8/dataset/area_coco/images/Video1_0005.jpeg
match_metric: ios
match_threshold: 0.6
model_dir: G:/projects/GraduationProject/PaddleDetection-release-2.8/inference_model/ppyolo_r50vd_dcn_1x_coco
output_dir: output
overlap_ratio: [0.25, 0.25]
random_pad: False
reid_batch_size: 50
reid_model_dir: None
run_benchmark: False
run_mode: paddle
save_images: True
save_mot_txt_per_img: False
save_mot_txts: False
save_results: False
scaled: False
slice_infer: False
slice_size: [640, 640]
task_type: Detection
threshold: 0.5
tracker_config: None
trt_calib_mode: False
trt_max_shape: 1280
trt_min_shape: 1
trt_opt_shape: 640
tuned_trt_shape_file: shape_range_info.pbtxt
use_coco_category: False
use_dark: True
use_fd_format: False
use_gpu: False
video_file: None
window_size: 50
------------------------------------------
-----------  Model Configuration -----------
Model Arch: YOLO
Transform Order:
--transform op: Resize
--transform op: NormalizeImage
--transform op: Permute
--------------------------------------------
Traceback (most recent call last):
  File ".\deploy\python\infer.py", line 1266, in <module>
    main()
  File ".\deploy\python\infer.py", line 1199, in main
    detector = eval(detector_func)(
  File ".\deploy\python\infer.py", line 108, in __init__
    self.predictor, self.config = load_predictor(
  File ".\deploy\python\infer.py", line 1098, in load_predictor
    predictor = create_predictor(config)
RuntimeError: (NotFound) Cannot open file G:/projects/GraduationProject/PaddleDetection-release-2.8/inference_model/ppyolo_r50vd_dcn_1x_coco, please confirm whether the file is normal.
  [Hint: Expected static_cast<bool>(fin.is_open()) == true, but received static_cast<bool>(fin.is_open()):0 != true:1.] (at C:\home\workspace\Paddle\paddle\fluid\inference\api\analysis_predictor.cc:2808)

我调试了很久也没有找到原因,不知道为什么报错消息是打开一个文件夹报错。

环境信息(python3.8)

(paddle) PS G:\projects\GraduationProject\PaddleDetection-release-2.8> pip list | findstr /b /i "paddle"
paddle2onnx              1.3.0
paddledet                0.0.0
paddlefsl                1.1.0
paddlenlp                2.6.1
paddleocr                2.9.1
paddlepaddle-gpu         3.0.0b1
@cuicheng01
Copy link
Collaborator

请问,导出的模型的扩展名是啥样子的呢?

@edenatoniuma
Copy link
Author

请问,导出的模型的扩展名是啥样子的呢?

Image

Image
这样子的

@edenatoniuma
Copy link
Author

infer脚本是可以运行的。

Image

Image

@HHHLLL1
Copy link

HHHLLL1 commented Feb 7, 2025

同样的问题,用的ppyoloe模型,导出的模型,paddleDection和paddle inference api都用不了

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

4 participants