yolo中断训练功能添加

This commit is contained in:
2022-11-15 17:59:06 +08:00
parent b70ba8a431
commit cdb081654a
4 changed files with 46 additions and 8 deletions

View File

@ -287,11 +287,11 @@ from app.schemas.TrainResult import DetectProcessValueDice, DetectReport
from app import file_tool
def error_return(id: str):
def error_return(id: str, data):
"""
算法出错,返回
"""
data_res = {'code': 2, "type": 'error', 'msg': 'fail', 'data': None}
data_res = {'code': 2, "type": 'error', 'msg': 'fail', 'data': data}
manager.send_message_proj_json(message=data_res, id=id)
# 启动训练
@ -310,8 +310,10 @@ def train_R0DY(params_str, id):
device = params.get('device').value
try:
train_start(weights, savemodel, epoches, img_size, batch_size, device, data_list, id)
except:
error_return(id=id)
print("train down!")
except Exception as e:
print(repr(e))
error_return(id=id,data=repr(e))
# 启动验证程序