Revert "[Backend] Add KunlunXin XPU deploy support" (#893)

Revert "[Backend] Add KunlunXin XPU deploy support (#747)"

This reverts commit 5be839b322.
This commit is contained in:
Jason
2022-12-15 21:17:59 +08:00
committed by GitHub
parent 5be839b322
commit 0990ab9b50
39 changed files with 58 additions and 870 deletions

21
examples/vision/detection/yolov5/python/infer.py Executable file → Normal file
View File

@@ -1,20 +1,20 @@
import fastdeploy as fd
import cv2
import os
def parse_arguments():
import argparse
import ast
parser = argparse.ArgumentParser()
parser.add_argument("--model", default=None, help="Path of yolov5 model.")
parser.add_argument(
"--model", default=None, help="Path of yolov5 onnx model.")
parser.add_argument(
"--image", default=None, help="Path of test image file.")
parser.add_argument(
"--device",
type=str,
default='cpu',
help="Type of inference device, support 'cpu' or 'gpu' or 'xpu'.")
help="Type of inference device, support 'cpu' or 'gpu'.")
parser.add_argument(
"--use_trt",
type=ast.literal_eval,
@@ -25,8 +25,6 @@ def parse_arguments():
def build_option(args):
option = fd.RuntimeOption()
if args.device.lower() == "xpu":
option.use_xpu()
if args.device.lower() == "gpu":
option.use_gpu()
@@ -39,15 +37,14 @@ def build_option(args):
args = parse_arguments()
if args.model is None:
model = fd.download_model(name='YOLOv5s')
else:
model = args.model
# 配置runtime加载模型
runtime_option = build_option(args)
model_file = os.path.join(args.model, "model.pdmodel")
params_file = os.path.join(args.model, "model.pdiparams")
model = fd.vision.detection.YOLOv5(
model_file,
params_file,
runtime_option=runtime_option,
model_format=fd.ModelFormat.PADDLE)
model = fd.vision.detection.YOLOv5(model, runtime_option=runtime_option)
# 预测图片检测结果
if args.image is None: