mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 11:26:36 +00:00
add resume training possibility
This commit is contained in:
@@ -22,7 +22,6 @@ class Augmentator:
|
|||||||
self.correct_min_bbox_size = 0.01
|
self.correct_min_bbox_size = 0.01
|
||||||
|
|
||||||
self.transform = A.Compose([
|
self.transform = A.Compose([
|
||||||
# Flips, rotations and brightness
|
|
||||||
A.HorizontalFlip(p=0.6),
|
A.HorizontalFlip(p=0.6),
|
||||||
A.RandomBrightnessContrast(p=0.4, brightness_limit=(-0.3, 0.3), contrast_limit=(-0.05, 0.05)),
|
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)),
|
A.Affine(p=0.8, scale=(0.8, 1.2), rotate=(-35, 35), shear=(-10, 10)),
|
||||||
|
|||||||
@@ -172,6 +172,17 @@ def get_latest_model():
|
|||||||
return last_model['date'], last_model['path']
|
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):
|
def train_dataset(existing_date=None, from_scratch=False):
|
||||||
latest_date, latest_model = get_latest_model() if not from_scratch else None, None
|
latest_date, latest_model = get_latest_model() if not from_scratch else None, None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user