train.py 698 B

123456789101112131415161718192021
  1. from ultralytics import YOLO
  2. if __name__ == "__main__":
  3. model = YOLO('yolov12n.yaml')
  4. model.load("yolov12n.pt")
  5. # Train the model
  6. results = model.train(
  7. data='/Users/jsonxu/code/ai/train/6017/data.yaml',
  8. project='/Users/jsonxu/code/ai/train/6017', # 训练结果路径
  9. name='result',# 训练结果名称
  10. exist_ok=True, #如果为 True,则允许覆盖现有的项目/名称目录。这对迭代实验非常有用,无需手动清除之前的输出。
  11. epochs=1,
  12. batch=16,
  13. imgsz=640,
  14. scale=0.5, # S:0.9; M:0.9; L:0.9; X:0.9
  15. mosaic=1.0,
  16. mixup=0.0, # S:0.05; M:0.15; L:0.15; X:0.2
  17. copy_paste=0.1, # S:0.15; M:0.4; L:0.5; X:0.6
  18. )