add resume training possibility

This commit is contained in:
zxsanny
2025-05-19 18:32:41 +03:00
parent 96056f53ad
commit 8fb24384db
2 changed files with 11 additions and 1 deletions
-1
View File
@@ -22,7 +22,6 @@ class Augmentator:
self.correct_min_bbox_size = 0.01
self.transform = A.Compose([
# Flips, rotations and brightness
A.HorizontalFlip(p=0.6),
A.RandomBrightnessContrast(p=0.4, brightness_limit=(-0.3, 0.3), contrast_limit=(-0.05, 0.05)),
A.Affine(p=0.8, scale=(0.8, 1.2), rotate=(-35, 35), shear=(-10, 10)),
+11
View File
@@ -172,6 +172,17 @@ def get_latest_model():
return last_model['date'], last_model['path']
def resume_training(last_pt_path):
model = YOLO(last_pt_path)
results = model.train(data=yaml,
resume=True,
epochs=120,
batch=12,
imgsz=1280,
save_period=1,
workers=24)
def train_dataset(existing_date=None, from_scratch=False):
latest_date, latest_model = get_latest_model() if not from_scratch else None, None