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

When running on GPU, I get normalized bboxes, when running on CPU, bbox in the desired format #8258

Open Halacky opened 1 year ago

Halacky commented 1 year ago

问题确认 Search before asking

请提出你的问题 Please ask your question

I run docker image from hub paddlepaddle/paddle:2.5.0rc0-gpu-cuda11.7-cudnn8.4-trt8.4 After i want to run deploy model like this:

detector_func = 'Detector'
detector = eval(detector_func)(
        model_dir = "inference_model/detection", 
        device="GPU",   #device='CPU'
        run_mode="paddle", #run_mode='paddle'
        batch_size=1,  #batch_size=1
        trt_min_shape=1,  #trt_min_shape=1
        trt_max_shape=1280,  #trt_max_shape=1280
        trt_opt_shape=640,  #trt_opt_shape=640
        trt_calib_mode=False,  #trt_calib_mode=False
        cpu_threads=1, #cpu_threads=1
        enable_mkldnn=False,  #enable_mkldnn=False
        enable_mkldnn_bfloat16=False,  #enable_mkldnn_bfloat16=False
        threshold=0.5,  #threshold=0.5
        output_dir='output2') #output_dir='output'

bboxs_dict=detector.predict_image(
                    ['frame001337.jpg'],
                    run_benchmark = False,  #run_benchmark=False
                    repeats=100, #repeats=1
                    visual=True, #visual=True,
                    save_results=False) #save_results=False

On inference_model/detectioni have inference model (pdmodle, pdiparms and so on), also infer_cfg.yml:

mode: paddle
draw_threshold: 0.5
metric: COCO
use_dynamic_shape: false
arch: YOLO
min_subgraph_size: 3
Preprocess:
- interp: 2
  keep_ratio: false
  target_size:
  - 512
  - 512
  type: Resize
- is_scale: true
  mean:
  - 0.485
  - 0.456
  - 0.406
  std:
  - 0.229
  - 0.224
  - 0.225
  type: NormalizeImage
- type: Permute
label_list:
- front_door

and after running i get like this bboxes like this:

class_id:0, confidence:1.4194, left_top:[1.95,2.25],right_bottom:[2.27,2.00]
class_id:0, confidence:1.4157, left_top:[1.27,1.44],right_bottom:[1.32,1.09]

BUT If i change device to CPU i get correct bbox like this: class_id:0, confidence:0.9976, left_top:[839.24,542.89],right_bottom:[1906.61,1511.53]

Halacky commented 1 year ago

UPDATE: In 2.4.2 Version all correctly