-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_train.py
46 lines (41 loc) · 1000 Bytes
/
run_train.py
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
39
40
41
42
43
44
45
from ultralytics import YOLO
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
###########################
## MODEL LOAD
##########################
# Load a model
model = YOLO("yolov8l.yaml") # build a new model from scratch
###model = YOLO("runs/detect/train/weights/last.pt") # build a new model from scratch
##########################
## TRAIN MODEL
##########################
# Use the model
dataset= "dataset.yaml"
model.train(
data=dataset,
epochs=300,
##resume=True,
##batch=-1,
batch=16,
imgsz=640,
device=[0,1,2,3],
workers=4,
pretrained=False,
optimizer='auto',
val=True,
plots=True,
## AUGMENTATION OPTIONS
erasing=0,
mosaic=0,
hsv_h=0,
hsv_s=0,
hsv_v=0,
translate=0,
degrees=180, #random rotation-180 180
flipud=0.5, # random lr flipping
fliplr=0.5, # random lr flipping
scale=0.89, #scaling between 400x400, 850*850
crop_fraction=1.0, #random cropping, bounds not specified in paper
) # train the model