我的版本是yolov8? 8.11?
这个目录结构很重要
ultralytics-main
|? datasets
|coco
|train
|val
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: "D:\\work\\pycharmworkplace\\ultralytics-main\\datasets\\coco" # dataset root dir
train: "D:\\work\\pycharmworkplace\\ultralytics-main\\datasets\\coco\\train"
val: "D:\\work\\pycharmworkplace\\ultralytics-main\\datasets\\coco\\val"
#test: # test images (optional)
# Classes (80 COCO classes)
names:
0: fire
from ultralytics import YOLO
# Load a model
model = YOLO('.\\ultralytics-main\\yolov8n.pt') # load a pretrained model (recommended for training)
# Train the model
results = model.train(data='.\\ultralytics-main\\datasets\\coco\\coco.yaml', epochs=10, imgsz=640)
# 检测命令
# yolo predict model=best.pt source=ultralytics\assets\1_5.jpg
用python 文件启动
?
?我只总共2600 张图,训练集是1600 张 ,跑10次大概一个多小时跑完
在dataset 的那个文件夹的coco 文件夹下生成了一个runs 的文件夹,里面就有模型和结果
结果看不懂,后面再说,现在找模型
训练的模型在这个目录下
?
yolo predict model=.datasets\\coco\\runs\\detect\\train2\\weights\\best.pt source=ultralytics\assets
\1_54.jpg