Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yolor #16

Merged
merged 15 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fastdeploy/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class FASTDEPLOY_DECL FDLogger {
#define __REL_FILE__ __FILE__
#endif

#define FDERROR \
FDLogger(true, "[ERROR]") \
<< __REL_FILE__ << "(" << __LINE__ << ")::" << __FUNCTION__ << "\t"

#define FDERROR \
FDLogger(true, "[ERROR]") << __REL_FILE__ << "(" << __LINE__ \
<< ")::" << __FUNCTION__ << "\t"
Expand Down
6 changes: 3 additions & 3 deletions fastdeploy/vision/ppcls/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ bool Model::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
return true;
}

} // namespace ppcls
} // namespace vision
} // namespace fastdeploy
} // namespace ppcls
} // namespace vision
} // namespace fastdeploy
4 changes: 2 additions & 2 deletions fastdeploy/vision/ultralytics/yolov5.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ bool YOLOv5::Postprocess(
}

if (result->boxes.size() == 0) {
return true;
return true;
}

utils::NMS(result, nms_iou_threshold);

// scale the boxes to the origin image shape
Expand Down
2 changes: 1 addition & 1 deletion fastdeploy/vision/utils/sort_det_res.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void SortDetectionResult(DetectionResult* result) {
size_t low = 0;
size_t high = result->scores.size();
if (high == 0) {
return;
return;
}
high = high - 1;
MergeSort(result, low, high);
Expand Down
2 changes: 1 addition & 1 deletion fastdeploy/vision/wongkinyiu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def predict(self, input_image, conf_threshold=0.25, nms_iou_threshold=0.5):
return self._model.predict(input_image, conf_threshold,
nms_iou_threshold)

# 一些跟YOLOv7模型有关的属性封装
# 一些跟YOLOR模型有关的属性封装
# 多数是预处理相关,可通过修改如model.size = [1280, 1280]改变预处理时resize的大小(前提是模型支持)
@property
def size(self):
Expand Down
13 changes: 6 additions & 7 deletions model_zoo/vision/yolor/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 编译YOLOR示例

当前支持模型版本为:[YOLOR v0.1](https://github.com/WongKinYiu/yolor/releases/tag/weights)
当前支持模型版本为:[YOLOR weights](https://github.com/WongKinYiu/yolor/releases/tag/weights)
(tips: 如果使用 `git clone` 的方式下载仓库代码,请将分支切换(checkout)到 `paper` 分支).

本文档说明如何进行[YOLOR](https://github.com/WongKinYiu/yolor)的快速部署推理。本目录结构如下

Expand All @@ -18,19 +19,17 @@

- 手动获取

访问[YOLOR](https://github.com/WongKinYiu/yolor)官方github库,按照指引下载安装,下载`yolor.pt` 模型,利用 `models/export.py` 得到`onnx`格式文件。


访问[YOLOR](https://github.com/WongKinYiu/yolor)官方github库,按照指引下载安装,下载`yolor.pt` 模型,利用 `models/export.py` 得到`onnx`格式文件。如果您导出的`onnx`模型出现精度不达标或者是数据维度的问题,可以参考[yolor#32](https://github.com/WongKinYiu/yolor/issues/32)的解决办法

```
#下载yolor模型文件
wget https://github.com/WongKinYiu/yolor/releases/download/v0.1/yolor.pt
wget https://github.com/WongKinYiu/yolor/releases/download/weights/yolor-d6-paper-570.pt

# 导出onnx格式文件
python models/export.py --grid --dynamic --weights PATH/TO/yolo7.pt
python models/export.py --weights PATH/TO/yolor-xx-xx-xx.pt --img-size 640

# 移动onnx文件到demo目录
cp PATH/TO/yolo7.onnx PATH/TO/model_zoo/vision/yolor/
cp PATH/TO/yolor.onnx PATH/TO/model_zoo/vision/yolor/
```

## 安装FastDeploy
Expand Down
14 changes: 8 additions & 6 deletions model_zoo/vision/yolor/cpp/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# 编译YOLOR示例

当前支持模型版本为:[YOLOR v0.1](https://github.com/WongKinYiu/yolor/releases/tag/weights)

当前支持模型版本为:[YOLOR weights](https://github.com/WongKinYiu/yolor/releases/tag/weights)
(tips: 如果使用 `git clone` 的方式下载仓库代码,请将分支切换(checkout)到 `paper` 分支).
## 获取ONNX文件

- 手动获取

访问[YOLOR](https://github.com/WongKinYiu/yolor/releases/tag/weights)官方github库,按照指引下载安装,下载`yolor.pt` 模型,利用 `models/export.py` 得到`onnx`格式文件。
访问[YOLOR](https://github.com/WongKinYiu/yolor)官方github库,按照指引下载安装,下载`yolor.pt` 模型,利用 `models/export.py` 得到`onnx`格式文件。如果您导出的`onnx`模型出现精度不达标或者是数据维度的问题,可以参考[yolor#32](https://github.com/WongKinYiu/yolor/issues/32)的解决办法

```
#下载yolor模型文件
wget https://github.com/WongKinYiu/yolor/releases/download/v0.1/yolor.pt
wget https://github.com/WongKinYiu/yolor/releases/download/weights/yolor-d6-paper-570.pt

# 导出onnx格式文件
python models/export.py --grid --dynamic --weights PATH/TO/yolo7.pt
python models/export.py --weights PATH/TO/yolor-xx-xx-xx.pt --img-size 640

# 移动onnx文件到demo目录
cp PATH/TO/yolor.onnx PATH/TO/model_zoo/vision/yolor/
```


Expand All @@ -31,7 +33,7 @@ cmake ..
make -j

# 移动onnx文件到demo目录
cp PATH/TO/yolo7.onnx PATH/TO/model_zoo/vision/yolor/cpp/build/
cp PATH/TO/yolor.onnx PATH/TO/model_zoo/vision/yolor/cpp/build/

# 下载图片
wget https://raw.githubusercontent.com/WongKinYiu/yolor/paper/inference/images/horses.jpg
Expand Down
4 changes: 2 additions & 2 deletions model_zoo/vision/yolov7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt

# 导出onnx格式文件
python models/export.py --grid --dynamic --weights PATH/TO/yolo7.pt
python models/export.py --grid --dynamic --weights PATH/TO/yolov7.pt

# 移动onnx文件到demo目录
cp PATH/TO/yolo7.onnx PATH/TO/model_zoo/vision/yolov7/
cp PATH/TO/yolov7.onnx PATH/TO/model_zoo/vision/yolov7/
```

## 安装FastDeploy
Expand Down
4 changes: 2 additions & 2 deletions model_zoo/vision/yolov7/cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt

# 导出onnx格式文件
python models/export.py --grid --dynamic --weights PATH/TO/yolo7.pt
python models/export.py --grid --dynamic --weights PATH/TO/yolov7.pt

```

Expand All @@ -31,7 +31,7 @@ cmake ..
make -j

# 移动onnx文件到demo目录
cp PATH/TO/yolo7.onnx PATH/TO/model_zoo/vision/yolov7/cpp/build/
cp PATH/TO/yolov7.onnx PATH/TO/model_zoo/vision/yolov7/cpp/build/

# 下载图片
wget https://raw.githubusercontent.com/WongKinYiu/yolov7/main/inference/images/horses.jpg
Expand Down