File size: 698 Bytes
e742b12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from ultralytics import YOLO

# Train only the `l` or `x` if you can
models = [
    "yolo11l-seg.pt",
    "yolo11m-seg.pt",
    "yolo11n-seg.pt",
    "yolo11s-seg.pt",
    "yolo11x-seg.pt"
    ]

for model_name in models:
    model = YOLO(model_name)  # load a pretrained model

    # Train the model with memory-saving parameters
    results = model.train(
        data="./sam_40_mss_lines/config-Y-T-G.yaml",
        epochs=200,
        imgsz=1024,
        patience=50,
        optimizer='SGD',
        simplify=False,
        retina_masks=True,
        batch=8,
        name=f"sam_{model_name.replace('.pt', '')}_1024",
        #device=[0,1],
        workers=2  # Reduce number of workers
    )