细化部分功能
This commit is contained in:
@ -172,7 +172,8 @@ async def run_commend(weights: str, source: str, project: str, name: str,
|
||||
pdc.add_detect_imgs(detect_log_imgs, session)
|
||||
|
||||
|
||||
|
||||
def run_detect_rtsp():
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
@ -176,10 +176,7 @@ def run_train_yolo(project_info: ProjectInfoOut, train_in: ProjectTrainIn, sessi
|
||||
data = yaml_file
|
||||
project = os.file_path(runs_url, project_info.project_no)
|
||||
name = version_path
|
||||
# thread_train = threading.Thread(target=ps.run_commend, args=(data, project, name, train_in.epochs,
|
||||
# train_in.patience, train_in.weights_id,
|
||||
# train_in.project_id, session,))
|
||||
# thread_train.start();
|
||||
|
||||
return data, project, name
|
||||
|
||||
|
||||
@ -203,9 +200,9 @@ async def run_commend(data: str, project: str,
|
||||
await room_manager.send_to_room(room, f"stdout: 模型训练开始,请稍等。。。\n")
|
||||
commend = ["python", '-u', yolo_path, "--data=" + data, "--project=" + project, "--name=" + name,
|
||||
"--epochs=" + str(epochs), "--batch-size=4", "--exist-ok", "--patience=" + str(patience)]
|
||||
if weights != None and weights != '':
|
||||
train_info = ptc.get_train(weights, session)
|
||||
if train_info != None:
|
||||
if weights != '' and weights is not None:
|
||||
train_info = ptc.get_train(int(weights), session)
|
||||
if train_info is not None:
|
||||
commend.append("--weights=" + train_info.best_pt)
|
||||
# 启动子进程
|
||||
with subprocess.Popen(
|
||||
@ -236,6 +233,7 @@ async def run_commend(data: str, project: str,
|
||||
train.train_version = name
|
||||
train_url = os.file_path(project, name)
|
||||
train.train_url = train_url
|
||||
train.train_data = data
|
||||
bast_pt_path = os.file_path(train_url, 'weights', 'best.pt')
|
||||
last_pt_path = os.file_path(train_url, 'weights', 'last.pt')
|
||||
train.best_pt = bast_pt_path
|
||||
|
Reference in New Issue
Block a user