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.64k stars 2.87k forks source link

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

Closed atczyh closed 4 months ago

atczyh commented 4 months ago

问题确认 Search before asking

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

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

lyuwenyu commented 4 months ago

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

atczyh commented 4 months ago

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\P00721.00_0.png Test iter 3 save result to: output\000000570688.jpg Test iter 4 save result to: output\visdrone_0000315_01601_d0000509.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\P08611.01154824.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 commented 4 months ago

确定参数加载了?