增加对训练和推理中图片情况的判断
This commit is contained in:
@ -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,
|
||||
|
@ -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,))
|
||||
|
Reference in New Issue
Block a user