Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (3.7%) to scientific vocabulary
Last synced: 6 months ago
·
JSON representation
·
Repository
lizhehan work yolov5
Basic Info
- Host: GitHub
- Owner: lizhehan0905
- License: agpl-3.0
- Language: Python
- Default Branch: main
- Size: 1020 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 2
- Releases: 0
Created almost 2 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Contributing
License
Citation
README.md
训练相关基本操作
环境
- python
- torch
- 其他 ``` pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
```
数据集
- 数据格式 ``` ├── images │ ├── train │ └── val └── labels ├── train └── val
```
命令行执行
训练必用train.py
- --weights 默认yolov5s迁移学习,自动下载,输入false则默认加载--cfg中的配置文件
- --cfg 默认在model文件夹下找yaml文件,修改yaml文件实现多种模型子模块的增删改查
- --data 数据集加载,默认data文件夹下找yaml文件
- --hyp 超参,默认data/hyps超参下找yaml
- --epochs 训练代数
- --batch-size 视显存大小而定
- --img 训练尺度
- --resume 断点重训
- --device gpu数量
- --workers 0肯定可以,其他数值请自行尝试
- --patience epochs设置比较大的时候可以用到early-stop
验证必用val.py
- --data 数据集加载,默认data文件夹下找yaml文件
- --weights 想要验证的权重文件地址,支持pt、torchscript、onnx、openvino、trt、tf、paddle
- --batch-size 视验证目标而定
- --conf-thres 置信度阈值,影响较大
- --iou-thres iou阈值
- --max-det 最大检测数量
- --task 主要用val、test、speed
- --device gpu数量
- --workers 0肯定可以,其他数值请自行尝试
- --half fp16推理
推理必用detect.py
- --weights 想要验证的权重文件地址,支持pt、torchscript、onnx、openvino、trt、tf、paddle
- --source 想要推理的目录,可以是图片、视频、文件夹、屏幕、摄像头
- --img 推理尺度
- --conf-thres 置信度阈值,影响较大
- --iou-thres iou阈值
- --max-det 最大检测数量
- --device gpu数量
- --nosave 不保存
导出必用export.py
- --weights 想要导出的权重地址
- --img 导出尺度
- --batch-size 导出尺度
- --device gpu数量
- --half 半精度导出
- --dynamic 动态导出
- --simplify 调用onnx-simplify进行简化
- --opset onnx版本
- --include 导出格式,主要有onnx,torchscript,engine等等
全面验证benchmarks.py
- torch、torchscript、onnx、openvino、trt、coreml、tf等等全部跑一遍
- --weights 想要导出的权重地址
- --img 导出尺度
- --batch-size 导出尺度
- --device gpu数量
- --half 半精度导出
- --pt-only 仅测试pt
代码基础介绍
data数据代码
hyps超参
- 学习率
- 动量参数
- warmup参数
- 分类损失与回归损失的权重参数
- 数据增强参数 ### 数据集.yaml
- 训练集/验证集/测试集地址
- 名称 ## models模块
- common.py子模块实现代码,例如卷积、池化等等
- yolo.py子类实现代码,例如检测、分割等基础模型
- yaml文件,配置类别(自动检测)、宽度、深度、anchor、子模块调用 ## utils工具
- activation.py自定义的激活函数
- augmentations.py自定义的数据增强
- autoanchor.py自动计算anchor
- autobatch.py自动计算batch
- dataloaders.py数据加载
- downloads.py下载工具
- general.py常规工具
- loss.py损失函数
- metrics.py AP的计算工具
- plot.py绘图工具
- torch_utils.py
- triton.py ## classify分类的调用代码 ## segment分割的调用代码
改进方法
训练方式
- 迁移学习:数据集<10w张,建议从官方权重开始迁移学习
python train.py --weigths yolov5s.pt - 从零训练:数据量大,建议从零训练,epoch可以适当多设置一些
python train.py --weights false --cfg model/yolov5s.yaml## 训练尺度 - 默认640,可以按照实际需求设置,例如512、480、320,也可以按照论文推荐的640-1280-640的方式来训练,提高训练效果
python train.py --img 320## 激活函数的替换 - 在model/common.py中替换掉卷积的激活函数,可以用relu、Lrelu、hardswish等等
- 如果不是torch内置的激活函数,可以将定义添加到common.py中,或者添加到utils/activations.py中调用 ## 宽度高度的调整
- 在models文件夹中添加自己的yaml文件,更改类别数,更改宽度系数和高度系数,可以快速调整整个模型的卷积堆叠个数和filter个数 ## 模型架构调整
- 例如p2模型和p6模型,分别用于小目标检测与超大图检测
- 同时可以在模型中插入、删除、改进部分模块,例如conv替换为dwconv,例如增加注意力机制,例如backbone整个替换 ## 超参调整
- 例如学习率、损失权重、数据增强
Owner
- Login: lizhehan0905
- Kind: user
- Repositories: 1
- Profile: https://github.com/lizhehan0905
Citation (CITATION.cff)
cff-version: 1.2.0
preferred-citation:
type: software
message: If you use YOLOv5, please cite it as below.
authors:
- family-names: Jocher
given-names: Glenn
orcid: "https://orcid.org/0000-0001-5950-6979"
title: "YOLOv5 by Ultralytics"
version: 7.0
doi: 10.5281/zenodo.3908559
date-released: 2020-5-29
license: AGPL-3.0
url: "https://github.com/ultralytics/yolov5"
GitHub Events
Total
Last Year
Dependencies
.github/workflows/ci-testing.yml
actions
- actions/checkout v4 composite
- actions/setup-python v5 composite
- slackapi/slack-github-action v1.25.0 composite
.github/workflows/codeql-analysis.yml
actions
- actions/checkout v4 composite
- github/codeql-action/analyze v3 composite
- github/codeql-action/autobuild v3 composite
- github/codeql-action/init v3 composite
.github/workflows/docker.yml
actions
- actions/checkout v4 composite
- docker/build-push-action v5 composite
- docker/login-action v3 composite
- docker/setup-buildx-action v3 composite
- docker/setup-qemu-action v3 composite
.github/workflows/format.yml
actions
- ultralytics/actions main composite
.github/workflows/greetings.yml
actions
- actions/first-interaction v1 composite
.github/workflows/links.yml
actions
- actions/checkout v4 composite
- nick-invision/retry v3 composite
.github/workflows/stale.yml
actions
- actions/stale v9 composite
utils/docker/Dockerfile
docker
- pytorch/pytorch 2.0.0-cuda11.7-cudnn8-runtime build
utils/google_app_engine/Dockerfile
docker
- gcr.io/google-appengine/python latest build
pyproject.toml
pypi
requirements.txt
pypi
- PyYAML >=5.3.1
- gitpython >=3.1.30
- matplotlib >=3.3
- numpy >=1.23.5
- opencv-python >=4.1.1
- pandas >=1.1.4
- pillow >=10.3.0
- psutil *
- requests >=2.23.0
- scipy >=1.4.1
- seaborn >=0.11.0
- setuptools >=65.5.1
- thop >=0.1.1
- torchvision >=0.9.0
- tqdm >=4.64.0
- ultralytics >=8.0.232
- wheel >=0.38.0
utils/google_app_engine/additional_requirements.txt
pypi
- Flask ==2.3.2
- gunicorn ==19.10.0
- pip ==23.3
- werkzeug >=3.0.1