一、准备条件
1.下载yolov8
https://github.com/ultralytics/ultralytics
2.安装python
https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe
3.安装依赖
进入ultralytics-main,执行:
pip install -r requirements.txt
pip install -U ultralytics
二、标注
1.安装pyqt5
pip install pyqt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
2.安装labelme
pip install labelme -i https://pypi.tuna.tsinghua.edu.cn/simple
3.启动
labelimg 图片文件路径 标注的类别txt文件路径 标注结果txt文件路径
labelimg D:/Desktop/BicycleImgs/JPEGImages D:/Desktop/BicycleImgs/predefined_classes.txt D:/Desktop/BicycleImgs/Annotations
predefined_classes.txt内容:
E-bike
三、训练
1.到ultralytics所在的目录:
D:\workspace_all\pyCharm\ultralytics-main\ultralytics
2.放置位置如下:
3.ebike.yaml内容如下:
# Helmet
train: datasets/ebike/train
val: datasets/ebike/valid
test: datasets/ebike/test
# Classes
names:
0: E-bike
4.在命令行,执行如下命令,进行训练:
yolo task=detect mode=train model=./models/yolov8s.pt data=./ebike.yaml epochs=300 batch=16
5.训练结果