forked from ultralytics/yolov5
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rknn] update rkopt doc and code, now model is same for tk1/2
- Loading branch information
zen
committed
Jul 25, 2023
1 parent
4390b71
commit ff5ef69
Showing
4 changed files
with
38 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
# YOLOv5 - rkopt 仓库 | ||
# YOLOv5 - RKNN optimize | ||
|
||
- 基于 https://github.com/ultralytics/yolov5 代码修改,设配 rknpu 设备的部署优化 | ||
- 切换分支 git checkout {分支名} | ||
- 目前支持分支: | ||
- master | ||
- maxpool/ focus 优化,输出改为个branch分支的输出。以上优化代码使用插入宏实现,不影响原来的训练逻辑,这个优化兼容修改前的权重,故支持官方给的预训练权重。 | ||
## Source | ||
|
||
- 修改激活函数 silu 为 relu | ||
Base on https://github.com/ultralytics/yolov5 with commit id as d3ea0df8b9f923685ce5f2555c303b8eddbf83fd | ||
|
||
- 训练的相关内容请参考 README.md 说明 | ||
|
||
- 导出模型时 python export.py --rknpu {rk_platform} 即可导出优化模型 | ||
|
||
(rk_platform支持 rk1808, rv1109, rv1126, rk3399pro, rk3566, rk3568, rk3588, rv1103, rv1106) | ||
## What different | ||
|
||
Inference result unchanged: | ||
|
||
- Optimize focus/SPPF block, getting better performance with same result | ||
- Change output node, remove post_process from the model. (post process is unfriendly in quantization) | ||
|
||
|
||
|
||
Inference result changed: | ||
|
||
- Using ReLU as activation layer instead of SiLU(Only valid when training new model) | ||
|
||
|
||
|
||
## How to use | ||
|
||
``` | ||
python export.py --rknpu {rk_platform} --weight yolov5s.pt | ||
``` | ||
|
||
- rk_platform support rk1808, rv1109, rv1126, rk3399pro, rk3566, rk3562, rk3568, rk3588, rv1103, rv1106. (Actually the exported models are the same in spite of the exact platform ) | ||
|
||
- the 'yolov5s.pt' could be replace with your model path | ||
- A file name "RK_anchors.txt" would be generated and it could be use during doing post_process in the outside. | ||
- **NOTICE: Please call with --rknpu param, do not changing the default rknpu value in export.py.** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters