from ultralytics import YOLO # Load an official or custom model model = YOLO('yolov8s-seg.pt') # Load an official Detect model results = model.train(data='data.yaml', epochs=100, imgsz=640, batch=16)