Coder Social home page Coder Social logo

fly-miao / yolov5_for_rknn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from easy-eai/yolov5

0.0 0.0 0.0 8.36 MB

YOLOv5 in PyTorch > ONNX > CoreML > TFLite

Home Page: https://www.ultralytics.com

License: GNU General Public License v3.0

Shell 1.04% Python 98.19% Dockerfile 0.76%

yolov5_for_rknn's Introduction

作备份用,改网络模型已替换silu为relu,在rk3588上已验证

仓库说明:

本仓库是针对基于EASY-EAI-Nano(RV1126)从PC端模型训练、模型单步测试、pytorch模型转换为onnx模型的流程说明,并以口罩检测为例子说明。而模型如何部署到硬件主板上,完整的在线文档教程可以查看以下在线文档的链接:

环境说明:

python version >= 3.6

pytorch version >= 1.7

onnx verison >= 1.11

准备数据

口罩检测数据百度链接:https://pan.baidu.com/s/1vtxWurn1Mqu-wJ017eaQrw 提取码:6666

数据集解压后(脚本在数据集里面),执行以下脚本生成train.txt和valid.txt:

python list_dataset_file.py

训练模型

训练一个口罩检测模型,需要修改"data/mask.yaml"里面的train.txt和valid.txt的路径。训练脚本如下所示:

python train.py --data mask.yaml --cfg yolov5s.yaml --weights "" --batch-size 64
                                       yolov5m                                40
                                       yolov5l                                24
                                       yolov5x                                16

训练完成后会在

模型预测

测试训练好的模型:

python detect.py --source data/images --weights ./runs/train/exp/weights/best.pt --conf 0.5

测试结果会在"runs/detect"生成:

模型导出

执行以下指令把pt模型转换为onnx模型,同时会生成best.anchors.txt:

python export.py --include onnx --rknpu RV1126 --weights ./runs/train/exp/weights/best.pt

EASY-EAI-Nano基于NPU运行速度测试(单位:ms):

模型(640x640输入)          EASY-EAI-Nano(RV1126)
yolov5s int8量化    52    
yolov5m int8量化    93    

参考库:

https://github.com/ultralytics/yolov5

https://github.com/soloIife/yolov5_for_rknn

技术交流群:

QQ群:810456486

yolov5_for_rknn's People

Contributors

glenn-jocher avatar alexstoken avatar borda avatar nanocode012 avatar zen-xingle avatar taoxiesz avatar lornatang avatar easy-eai avatar anon-artist avatar ayushexel avatar laughing-q avatar tkianai avatar yxnong avatar aehogan avatar lorenzomammana avatar kinoute avatar wanghaoyang0106 avatar olehb avatar developer0hye avatar ownmarc avatar dlawrences avatar toretak avatar alexwang1900 avatar edurenye avatar dependabot-preview[bot] avatar ab-101 avatar yuriribeiro avatar uyzhang avatar williemaddox avatar wang-xinyu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.