Files
ieemoo-ai-gift/train.py
2025-06-21 13:41:13 +08:00

21 lines
1.1 KiB
Python

from ultralytics import YOLOv10
# model = YOLOv10()
#model = YOLOv10('ultralytics/cfg/models/v10/yolov10s.yaml')
#model = YOLOv10('runs/detect/runs_1010_1205_width0.375/weights/last.pt')
#model = YOLOv10('runs/detect/train4/weights/last.pt')
model = YOLOv10('ckpts/weights/yolov10n.pt')
# If you want to finetune the model with pretrained weights, you could load the
# pretrained weights like below
# model = YOLOv10.from_pretrained('jameslahm/yolov10{n/s/m/b/l/x}')
# or
# wget https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10{n/s/m/b/l/x}.pt
# model = YOLOv10('yolov10{n/s/m/b/l/x}.pt')
# model = YOLOv10('yolov10s.pt')
#model.train(data='coco.yaml', epochs=1, batch=64, imgsz=640)
#model.train(data='coco128_cls10_0924.yaml', epochs=300, batch=64, imgsz=640, resume=False)
#model.train(data='coco128_cls10_1010.yaml', epochs=300, batch=128, imgsz=640, resume=False)
model.train(data='gift.yaml', epochs=400, batch=32, imgsz=224, resume=False, save_dir='/ckpts')
#model.train(data='coco128_cls10_1010_1205.yaml', epochs=300, batch=32, imgsz=640, resume=True)