Skip to content

Commit ea0bac4

Browse files
[Benchmark] Add GPU OpenVIVO Option in benchmark (#786)
* add paddle_trt in benchmark * update benchmark in device * update benchmark * update result doc * fixed for CI * update python api_docs * update index.rst * add runtime cpp examples * deal with comments * Update infer_paddle_tensorrt.py * Add runtime quick start * deal with comments * fixed reused_input_tensors&&reused_output_tensors * fixed docs * fixed headpose typo * fixed typo * refactor yolov5 * update model infer * refactor pybind for yolov5 * rm origin yolov5 * fixed bugs * rm cuda preprocess * fixed bugs * fixed bugs * fixed bug * fixed bug * fix pybind * rm useless code * add convert_and_permute * fixed bugs * fixed im_info for bs_predict * fixed bug * add bs_predict for yolov5 * Add runtime test and batch eval * deal with comments * fixed bug * update testcase * fixed batch eval bug * fixed preprocess bug * refactor yolov7 * add yolov7 testcase * rm resize_after_load and add is_scale_up * fixed bug * set multi_label true * optimize rvm preprocess * optimizer rvm postprocess * fixed bug * deal with comments * fixed bugs * add gpu ov for benchmark Co-authored-by: Jason <[email protected]> Co-authored-by: Jason <[email protected]>
1 parent a0caf9f commit ea0bac4

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

benchmark/benchmark_ppcls.py

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def build_option(args):
7575
option.use_ort_backend()
7676
elif backend == "paddle":
7777
option.use_paddle_backend()
78+
elif backend == "ov":
79+
option.use_openvino_backend()
80+
option.set_openvino_device(name="GPU")
81+
# change name and shape for models
82+
option.set_openvino_shape_info({"x": [1, 3, 224, 224]})
7883
elif backend in ["trt", "paddle_trt"]:
7984
option.use_trt_backend()
8085
if backend == "paddle_trt":

benchmark/benchmark_ppdet.py

+11
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ def build_option(args):
7575
option.use_ort_backend()
7676
elif backend == "paddle":
7777
option.use_paddle_backend()
78+
elif backend == "ov":
79+
option.use_openvino_backend()
80+
# Using GPU and CPU heterogeneous execution mode
81+
option.set_openvino_device("HETERO:GPU,CPU")
82+
# change name and shape for models
83+
option.set_openvino_shape_info({
84+
"image": [1, 3, 320, 320],
85+
"scale_factor": [1, 2]
86+
})
87+
# Set CPU up operator
88+
option.set_openvino_cpu_operators(["MulticlassNms"])
7889
elif backend in ["trt", "paddle_trt"]:
7990
option.use_trt_backend()
8091
if backend == "paddle_trt":

benchmark/benchmark_ppseg.py

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def build_option(args):
7575
option.use_ort_backend()
7676
elif backend == "paddle":
7777
option.use_paddle_backend()
78+
elif backend == "ov":
79+
option.use_openvino_backend()
80+
option.set_openvino_device(name="GPU") # use gpu
81+
# change name and shape for models
82+
option.set_openvino_shape_info({"x": [1, 3, 512, 512]})
7883
elif backend in ["trt", "paddle_trt"]:
7984
option.use_trt_backend()
8085
if backend == "paddle_trt":

benchmark/benchmark_yolo.py

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def build_option(args):
7575
option.use_ort_backend()
7676
elif backend == "paddle":
7777
option.use_paddle_backend()
78+
elif backend == "ov":
79+
option.use_openvino_backend()
80+
option.set_openvino_device(name="GPU")
81+
# change name and shape for models
82+
option.set_openvino_shape_info({"images": [1, 3, 640, 640]})
7883
elif backend in ["trt", "paddle_trt"]:
7984
option.use_trt_backend()
8085
if backend == "paddle_trt":

examples/vision/detection/paddledetection/cpp/infer_ppyoloe.cc

100644100755
File mode changed.

fastdeploy/backends/openvino/ov_backend.cc

100644100755
+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ bool OpenVINOBackend::InitFromPaddle(const std::string& model_file,
176176
}
177177

178178
ov::AnyMap properties;
179-
if (option_.cpu_thread_num > 0) {
179+
if (option_.device == "CPU" && option_.cpu_thread_num > 0) {
180180
properties["INFERENCE_NUM_THREADS"] = option_.cpu_thread_num;
181181
}
182182
if (option_.device == "CPU") {
@@ -306,7 +306,7 @@ bool OpenVINOBackend::InitFromOnnx(const std::string& model_file,
306306
}
307307

308308
ov::AnyMap properties;
309-
if (option_.cpu_thread_num > 0) {
309+
if (option_.device == "CPU" && option_.cpu_thread_num > 0) {
310310
properties["INFERENCE_NUM_THREADS"] = option_.cpu_thread_num;
311311
}
312312
if (option_.device == "CPU") {

0 commit comments

Comments
 (0)