| 123456789101112131415161718 |
- from ultralytics import YOLO
- def main():
- model = YOLO('yolov8n.pt')
- model.train(
- data='datasets/data.yaml',
- epochs=50,
- imgsz=640,
- device='cpu',
- # --- RESOURCE LIMITS ---
- batch=4, # Lower = less RAM used. Start with 4.
- workers=1, # 1 or 2. Prevents the CPU from maxing all cores for data loading.
- cache=False # Don't store the whole dataset in RAM.
- )
- if __name__ == '__main__':
- main()
|