改进项目结构

This commit is contained in:
2025-03-14 15:44:41 +08:00
parent 8478b4a102
commit 9e79fb6a6d
95 changed files with 13745 additions and 64 deletions

View File

@ -118,7 +118,7 @@ def run_detect_yolo(detect_log_in: ProjectDetectLogIn, session: Session = Depend
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:
if detect_img_count == 0 and detect.rtsp_url is None:
return rc.response_error("推理集合中没有内容,请先到推理集合中上传图片")
if detect.file_type == 'img' or detect.file_type == 'video':
detect_log = pds.run_detect_yolo(detect_log_in, detect, train, session)
@ -131,8 +131,8 @@ def run_detect_yolo(detect_log_in: ProjectDetectLogIn, session: Session = Depend
weights_pt = train.best_pt
else:
weights_pt = train.last_pt
thread_train = threading.Thread(target=pds.run_detect_rtsp,
args=(weights_pt, detect.rtsp_url, train.train_data,))
thread_train = threading.Thread(target=run_rtsp_loop,
args=(weights_pt, detect.rtsp_url, train.train_data, detect.id))
thread_train.start()
return rc.response_success(msg="执行成功")