windows yolo11 自定义训练
一、在yolo11源码文件夹创建一个train.py
内容如下:
from ultralytics import YOLO
if __name__ == '__main__':
model = YOLO(r'ultralytics/cfg/models/11/yolo11.yaml')
model.train(data=r'D:/yolo11/WiderPerson_yolo/WiderPerson_yolo/WiderPerson_yolo.yaml',
imgsz=(640,384), # 训练图片大小,默认640
workers=5,
epochs=200, # 训练轮次,默认100
batch=5, # 训练批次,默认16
project='runs', # 项目文件夹的名,默认为runs
name='exp', # 用于保存训练文件夹名,默认exp,依次累加
device='0', # 要运行的设备 device =0 是GPU显卡训练,device = cpu
)
二、指定数据集路径
2.1 WiderPerson_yolo.yaml内容:
# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: images/train #8000张图片
val: images/val #1000张图片
test:
# number of classes
nc: 1
# class names
names: ["person"]
2.2 训练集图像
2.3 训练集标签
2.4 验证集图像
2.5 验证集标签
三、运行pycharm
配置conda环境,然后点击运行
原文地址:https://blog.csdn.net/sz76211822/article/details/143691109
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!