Spaces:
Sleeping
Sleeping
File size: 781 Bytes
03efa53 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from ultralytics import YOLO
#base model
model = YOLO("yolov8m.pt") #for better accuracy
model.train(
data="data.yaml",
epochs=45, # increased to allow better convergence
patience=20, # early stopping if no val improvement
imgsz=640, # image size FOR ACCURACY
batch=8,
conf=0.25, # initial THRESHOLD
name="detector",
augment=True, # enables data augmentation
auto_augment='randaugment',# advanced augmentation
lr0=0.001, # initial learning rate
cos_lr=True, # cosine learning rate schedule (smoother training)
save=True,
save_period=10, # save weights every 10 epochs
) |