‘fixed-yolov7-doc’ (#85)

‘’
This commit is contained in:
leiqing
2022-08-09 20:52:58 +08:00
committed by GitHub
parent 36a54f2955
commit 78b0cc56f2
4 changed files with 41 additions and 31 deletions

View File

@@ -5,7 +5,7 @@
在部署前,需确认以下两个步骤
- 1. 软硬件环境满足要求,参考[FastDeploy环境要求](../../../../../docs/quick_start/requirements.md)
- 2. 根据开发环境,下载预编译部署库,参考[FastDeploy预编译库](../../../../../docs/compile/prebuild_libraries.md)
- 2. 根据开发环境,下载预编译部署库和samples代码,参考[FastDeploy预编译库](../../../../../docs/compile/prebuild_libraries.md)
以Linux上CPU推理为例在本目录执行如下命令即可完成编译测试
@@ -17,17 +17,23 @@ tar xvf fastdeploy-linux-x64-0.2.0.tgz
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-0.2.0
make -j
#下载官方转换好的yolov7模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov7.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000087038.jpg
# CPU推理
./infer_demo yolov7.onnx 000001.jpg 0
./infer_demo yolov7.onnx 000000087038.jpg 0
# GPU推理
./infer_demo yolov7.onnx 000001.jpg 1
./infer_demo yolov7.onnx 000000087038.jpg 1
# GPU上TensorRT推理
./infer_demo yolov7.onnx 000001.jpg 2
./infer_demo yolov7.onnx 000000087038.jpg 2
```
## YOLOv7 C++接口
### YOLOv7类
```
fastdeploy::vision::wongkinyiu::YOLOv7(
const string& model_file,
@@ -35,6 +41,7 @@ fastdeploy::vision::wongkinyiu::YOLOv7(
const RuntimeOption& runtime_option = RuntimeOption(),
const Frontend& model_format = Frontend::ONNX)
```
YOLOv7模型加载和初始化其中model_file为导出的ONNX模型格式。
**参数**
@@ -45,26 +52,26 @@ YOLOv7模型加载和初始化其中model_file为导出的ONNX模型格式。
> * **model_format**(Frontend): 模型格式默认为ONNX格式
#### Predict函数
> ```
> YOLOv7::Predict(cv::Mat* im, DetectionResult* result,
> float conf_threshold = 0.25,
> float nms_iou_threshold = 0.5)
> ```
>
> 模型预测接口,输入图像直接输出检测结果。
>
>
> **参数**
>
>
> > * **im**: 输入图像注意需为HWCBGR格式
> > * **result**: 检测结果,包括检测框,各个框的置信度, DetectionResult说明参考[视觉模型预测结果](../../../../../docs/api/vision_results/)
> > * **conf_threshold**: 检测框置信度过滤阈值
> > * **nms_iou_threshold**: NMS处理过程中iou阈值
### 类成员变量
> > * **size**(vector<int>): 通过此参数修改预处理过程中resize的大小包含两个整型元素表示[width, height], 默认值为[640, 640]
- [模型介绍](../../)
- [Python部署](../python)
- [视觉模型预测结果](../../../../../docs/api/vision_results/)