diff --git a/scripts/retrain_from_label_studio.sh b/scripts/retrain_from_label_studio.sh index 6f8eec8..2e3edbb 100755 --- a/scripts/retrain_from_label_studio.sh +++ b/scripts/retrain_from_label_studio.sh @@ -44,7 +44,11 @@ echo "--- 3/4 训练 -> $WORK_DIR" echo "--- 4/4 切换权重并重启 ML backend" # 指向最新权重的稳定软链接:启动脚本读它,于是换模型不用改任何脚本 ln -sfn "$WORK_DIR/weights/best.pt" "$REPO/runs/detect/current.pt" -bash "$REPO/scripts/start_ml_backend.sh" +# 必须显式传 YOLO_WEIGHTS 并清掉继承来的变量:本脚本是旧后端的子进程, +# 它环境里已经 export 了 YOLO_WEIGHTS(旧权重)和可能的 RETRAIN_EXTRA_SET(冒烟参数), +# 不清掉的话新后端会继续用旧模型、下次训练也会沿用冒烟参数 +env -u RETRAIN_EXTRA_SET YOLO_WEIGHTS="$REPO/runs/detect/current.pt" \ + bash "$REPO/scripts/start_ml_backend.sh" echo "===== [$(date '+%F %T')] 重训完成:$WORK_DIR =====" echo "指标见 $WORK_DIR/metrics.json,曲线见 $WORK_DIR/results.png"