赞
踩
YOLO v8的代码地址为:https://github.com/ultralytics/ultralytics
YOLO v8的配置(训练,验证,测试)文件放在:ultralytics/cfg/default.yaml中
一般有两种训练数据集的方式:
第一种:在终端输入训练命令:
训练
yolo task=detect mode=train model=yolov8n.pt data=datasets/cooc128.yaml batch=16 epochs=100 imgsz=640 workers=8
验证
yolo task=detect mode=val model=runs/detect/train/weights/best.pt data=datasets/coco128.yaml
导出
yolo task=detect mode=export model=runs/detect/train/weights/best.pt
第二种:创建train.py文件,添加以下代码,运行train.py
- from ultralytics import YOLO
-
- # Load a model
- model = YOLO('yolov8.yaml') # build a new model from YAML
- model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training)
- model = YOLO('yolov8.yaml').load('yolov8n.pt') # build from YAML and transfer weights
-
- # Train the model
- model.train(data='coco128.yaml', epochs=100, imgsz=640,workers=8 )
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。