#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LAUNCHER="${SCRIPT_DIR}/run_two_roi_exported_onnx_infer_case.sh"

# 用途：在重跑 worker 全部完成后，统一执行 tracking 和 convert。

OUTPUT_DIR="${OUTPUT_DIR:-/data1/dongying/Mono3d/G1Q3/model_inference/KPI/OP_KPI_SCENE/model_20260427-raw_no_edge}"
ENABLE_TRACKING="${ENABLE_TRACKING:-1}"
ENABLE_CONVERT="${ENABLE_CONVERT:-1}"

echo "Running postprocess only"
echo "Launcher       : ${LAUNCHER}"
echo "Postprocess dir: ${OUTPUT_DIR}"
echo "Tracking       : ${ENABLE_TRACKING}"
echo "Convert        : ${ENABLE_CONVERT}"

env \
  POSTPROCESS_ONLY=1 \
  ENABLE_TRACKING="${ENABLE_TRACKING}" \
  ENABLE_CONVERT="${ENABLE_CONVERT}" \
  OUTPUT_DIR="${OUTPUT_DIR}" \
  bash "${LAUNCHER}"