Files
FastDeploy/model_zoo/vision/yolov6/yolov6.py
DefTruth de7c06a309 add yolov6 c++ and yolov6 pybind (#16)
* update .gitignore

* Added checking for cmake include dir

* fixed missing trt_backend option bug when init from trt

* remove un-need data layout and add pre-check for dtype

* changed RGB2BRG to BGR2RGB in ppcls model

* add model_zoo yolov6 c++/python demo

* fixed CMakeLists.txt typos

* update yolov6 cpp/README.md
2022-07-14 16:12:28 +08:00

25 lines
722 B
Python

import fastdeploy as fd
import cv2
# 下载模型和测试图片
model_url = "https://github.com/meituan/YOLOv6/releases/download/0.1.0/yolov6s.onnx"
test_jpg_url = "https://raw.githubusercontent.com/ultralytics/yolov5/master/data/images/bus.jpg"
fd.download(model_url, ".", show_progress=True)
fd.download(test_jpg_url, ".", show_progress=True)
# 加载模型
model = fd.vision.meituan.YOLOv6("yolov6s.onnx")
print(model.is_dynamic_shape())
# 预测图片
im = cv2.imread("bus.jpg")
result = model.predict(im, conf_threshold=0.25, nms_iou_threshold=0.5)
# 可视化结果
fd.vision.visualize.vis_detection(im, result)
cv2.imwrite("vis_result.jpg", im)
# 输出预测结果
print(result)
print(model.runtime_option)