from ultralytics import YOLO # Load a model model = YOLO('yolov8n.pt') # load a pretrained model (recommended for training) # Train the model model.train(data='coco128.yaml', epochs=100, imgsz=640)