Update train.py

This commit is contained in:
nguentrungthat 2025-03-14 16:58:46 +07:00
parent 6ef757e8a2
commit fef22a3cf6
1 changed files with 2 additions and 2 deletions

View File

@ -104,7 +104,7 @@ def get_latest_model(trained_model_folder: str, default_model: str = "train5/wei
# Lấy danh sách các thư mục theo ngày, loại bỏ thư mục của ngày hôm nay
subfolders = [
f for f in os.listdir(trained_model_folder)
if os.path.isdir(os.path.join(trained_model_folder, f)) and f < today_str
if os.path.isdir(os.path.join(trained_model_folder, f)) and (f == today_str or f.startswith(today_str))
]
subfolders = sorted(subfolders, reverse=True) # Sắp xếp giảm dần (mới nhất trước)
@ -248,6 +248,6 @@ else:
train_yolo_model(pretrained_model = get_latest_model(
trained_model_folder=TRAINED_MODEL_FOLDER,
default_model=PRETRAINED_MODEL),
dataset_folder = dataset_folder, epochs = 2, name=today_str, project_name=model_folder_name
dataset_folder = dataset_folder, epochs = 50, name=today_str, project_name=model_folder_name
)