mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:06:35 +00:00
refactoring, fixes
This commit is contained in:
@@ -19,7 +19,7 @@ valid_set = 20
|
|||||||
test_set = 10
|
test_set = 10
|
||||||
|
|
||||||
|
|
||||||
def form_dataset(set_date: datetime):
|
def form_dataset(from_date: datetime):
|
||||||
makedirs(today_dataset, exist_ok=True)
|
makedirs(today_dataset, exist_ok=True)
|
||||||
images = []
|
images = []
|
||||||
with scandir(processed_images_dir) as imd:
|
with scandir(processed_images_dir) as imd:
|
||||||
@@ -27,9 +27,9 @@ def form_dataset(set_date: datetime):
|
|||||||
if not image_file.is_file():
|
if not image_file.is_file():
|
||||||
continue
|
continue
|
||||||
mod_time = datetime.fromtimestamp(image_file.stat().st_mtime)
|
mod_time = datetime.fromtimestamp(image_file.stat().st_mtime)
|
||||||
if set_date is None:
|
if from_date is None:
|
||||||
images.append(image_file)
|
images.append(image_file)
|
||||||
elif mod_time > set_date:
|
elif mod_time > from_date:
|
||||||
images.append(image_file)
|
images.append(image_file)
|
||||||
|
|
||||||
print('shuffling images')
|
print('shuffling images')
|
||||||
@@ -142,9 +142,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
cur_folder = today_dataset
|
cur_folder = today_dataset
|
||||||
yaml = abspath(path.join(cur_folder, 'data.yaml'))
|
yaml = abspath(path.join(cur_folder, 'data.yaml'))
|
||||||
results = model.train(data=yaml, epochs=100, batch=60, imgsz=640, save_period=1)
|
results = model.train(data=yaml, epochs=100, batch=60, imgsz=640)
|
||||||
|
|
||||||
shutil.copy(f'{results.save_dir}/weights/best.pt', latest_model)
|
shutil.copytree(results.save_dir, path.join(models_dir, today_folder))
|
||||||
shutil.copytree(results.save_dir, path.join(models_dir, cur_folder))
|
|
||||||
shutil.rmtree('runs')
|
shutil.rmtree('runs')
|
||||||
shutil.rmtree(path.join(models_dir, f'{prefix}latest'))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user