增加对训练和推理中图片情况的判断

This commit is contained in:
2025-03-12 09:39:50 +08:00
parent f49a6caf10
commit 76f4a5ecd9
5 changed files with 51 additions and 1 deletions

View File

@ -117,6 +117,9 @@ def run_detect_yolo(detect_log_in: ProjectDetectLogIn, session: Session = Depend
train = get_train(detect_log_in.train_id, session)
if train is None:
return rc.response_error("训练权重不存在")
detect_img_count = pdc.check_detect_img(detect_log_in.detect_id, session)
if detect_img_count == 0:
return rc.response_error("推理集合中没有图片,请先到推理集合中上传图片")
detect_log = pds.run_detect_yolo(detect_log_in, detect, train, session)
thread_train = threading.Thread(target=run_event_loop, args=(detect_log.pt_url,
detect_log.folder_url,

View File

@ -243,6 +243,12 @@ async def run_train(train_in: ProjectTrainIn, session: Session = Depends(get_db)
return rc.response_error("请先上传验证图片")
if val_img_count < 5:
return rc.response_error("验证图片少于5张请继续上传验证图片")
train_label_count = pimc.check_image_label(project_id, 'train', session)
if train_label_count > 0:
return rc.response_error("训练图片中存在未标注的图片")
val_label_count = pimc.check_image_label(project_id, 'val', session)
if val_label_count > 0:
return rc.response_error("验证图片中存在未标注的图片")
data, project, name = ps.run_train_yolo(project_info, train_in, session)
thread_train = threading.Thread(target=run_event_loop, args=(data, project, name, train_in,
project_id, session,))