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

ppyoloe导出预训练模型,进行推理时报错 #8964

Closed
2 of 3 tasks
atczyh opened this issue May 9, 2024 · 3 comments
Closed
2 of 3 tasks

ppyoloe导出预训练模型,进行推理时报错 #8964

atczyh opened this issue May 9, 2024 · 3 comments
Assignees

Comments

@atczyh
Copy link

atczyh commented May 9, 2024

问题确认 Search before asking

  • 我已经查询历史issue,没有发现相似的bug。I have searched the issues and found no similar bug report.

Bug组件 Bug Component

Deploy

Bug描述 Describe the Bug

参考官方案例导出预训练模型,python tools/export_model.py -c configs/ppyoloe/ppyoloe_plus_crn_l_80e_coco.yml -o weights=https://bj.bcebos.com/v1/paddledet/models/pretrained/ppyoloe_crn_x_obj365_pretrained.pdparams exclude_nms=True
使用命令进行推理
python deploy/python/infer.py --model_dir=output_inference/ppyoloe_plus_crn_l_80e_coco --image_dir=demo/ --run_mode=paddle --device=cpu
报错
----------- Model Configuration -----------
Model Arch: YOLO
Transform Order:
--transform op: Resize
--transform op: NormalizeImage
--transform op: Permute
Found 13 inference images in total.
detector.predict_image
Traceback (most recent call last):
File "deploy/python/infer.py", line 1229, in
main()
File "deploy/python/infer.py", line 1197, in main
detector.predict_image(
File "deploy/python/infer.py", line 416, in predict_image
visualize(
File "deploy/python/infer.py", line 1112, in visualize
im_results['boxes'] = result['boxes'][start_idx:start_idx +
TypeError: only integer scalar arrays can be converted to a scalar index
image

复现环境 Environment

windows
paddle 2.3.2
paddledetection release 2.7
cpu推理

Bug描述确认 Bug description confirmation

  • 我确认已经提供了Bug复现步骤、代码改动说明、以及环境信息,确认问题是可以复现的。I confirm that the bug replication steps, code change instructions, and environment information have been provided, and the problem can be reproduced.

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

  • 我愿意提交PR!I'd like to help by submitting a PR!
@lyuwenyu
Copy link
Collaborator

你把exclude_nms=True 去掉导出->infer再试一下

@atczyh
Copy link
Author

atczyh commented May 10, 2024

E:\PaddleDetection>python deploy/python/infer.py --model_dir=output_inference/ppyoloe_plus_crn_l_80e_coco --image_dir=demo/ --run_mode=paddle --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: demo/
image_file: None
match_metric: ios
match_threshold: 0.6
model_dir: output_inference/ppyoloe_plus_crn_l_80e_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]
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

FLAGS Namespace(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='demo/', image_file=None, match_metric='ios', match_threshold=0.6, model_dir='output_inference/ppyoloe_plus_crn_l_80e_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], 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

Found 13 inference images in total.
detector.predict_image
save result to: output\orange_71.jpg
Test iter 0
save result to: output\road554.png
Test iter 1
save result to: output\000000014439_640x640.jpg
Test iter 2
save result to: output\P0072__1.0__0___0.png
Test iter 3
save result to: output\000000570688.jpg
Test iter 4
save result to: output\visdrone_0000315_01601_d_0000509.jpg
Test iter 5
save result to: output\000000087038.jpg
Test iter 6
save result to: output\lane00000.jpg
Test iter 7
save result to: output\P0861__1.0__1154___824.png
Test iter 8
save result to: output\39006.jpg
Test iter 9
save result to: output\000000014439.jpg
Test iter 10
save result to: output\car.jpg
Test iter 11
save result to: output\hrnet_demo.jpg
Test iter 12
------------------ Inference Time Info ----------------------
total_time(ms): 1769.9, img_num: 13
average latency time(ms): 136.15, QPS: 7.345048
preprocess_time(ms): 35.40, inference_time(ms): 100.80, postprocess_time(ms): 0.00

去掉之后没报错了,但是没法正常输出推理结果。demo里的图识别之后没有框
image

@lyuwenyu
Copy link
Collaborator

确定参数加载了?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants