File size: 364 Bytes
aa24fe8
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from ultralytics import YOLO

# Load a model # 三选一
# model = YOLO('yolov8n.yaml')  # build a new model from YAML
# model = YOLO('yolov8n.pt')  # load a pretrained model (recommended for training)
model = YOLO('yolov8n.yaml').load('yolov8n.pt')  # build from YAML and transfer weights

# Train the model
model.train(data='train.yaml', epochs=100, imgsz=640)