-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtrain.py
More file actions
38 lines (32 loc) · 851 Bytes
/
train.py
File metadata and controls
38 lines (32 loc) · 851 Bytes
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
30
31
32
33
34
35
36
37
38
import typer
from ultralytics import YOLO
def main(
base_model: str,
datasets: str = "./datasets/data.yaml",
epochs: int = 40,
imgsz: int = 1024,
batch: int = 8,
seed: int = 42,
mosaic: float = 1.0, # https://docs.ultralytics.com/guides/yolo-data-augmentation/#mosaic-mosaic
resume: bool = False,
):
try:
from clearml import Task
Task.init(
project_name="yolo-doclaynet",
task_name=f"{base_model}-epochs-{epochs}-imgsz-{imgsz}-batch-{batch}",
)
except ImportError:
print("clearml not installed")
model = YOLO(base_model)
model.train(
data=datasets,
epochs=epochs,
imgsz=imgsz,
batch=batch,
seed=seed,
mosaic=mosaic,
resume=resume,
)
if __name__ == "__main__":
typer.run(main)