#!/usr/bin/env bash

set -euo pipefail

EVALUATION_REPORT=${EVALUATION_REPORT:-evaluation_results/eval_results_yolo26s_768_20260407_DL_KPI_SCENE/yolo26s-20260407-conf0.27/20260412_155342_roi0/evaluation_report.json}
DETAILED_MATCHES=${DETAILED_MATCHES:-$(dirname "${EVALUATION_REPORT}")/detailed_3d_matches.json}
CONFIG_PATH=${CONFIG_PATH:-eval_tools/configs/eval_config_yolov26s-roi0.yaml}
OUTPUT_DIR=${OUTPUT_DIR:-/data1/dongying/Mono3d/G1Q3/model_inference/KPI/DL_KPI_SCENE/model_20260403_analysis/analysis_3d}
TOP_K=${TOP_K:-200}
TOP_K_PER_CLASS=${TOP_K_PER_CLASS:-100}
TOP_K_FRAMES=${TOP_K_FRAMES:-50}
CLASSES=${CLASSES:-car suv van bus truck pedestrian bicycle}

PYTHON_BIN=${PYTHON_BIN:-/deeplearning_team/ydong/dongying/miniconda/envs/dev/bin/python}

"${PYTHON_BIN}" eval_tools/analysis/analyze_3d_badcases.py \
  --evaluation-report "${EVALUATION_REPORT}" \
  --detailed-matches "${DETAILED_MATCHES}" \
  --config "${CONFIG_PATH}" \
  --classes ${CLASSES} \
  --top-k "${TOP_K}" \
  --top-k-per-class "${TOP_K_PER_CLASS}" \
  --top-k-frames "${TOP_K_FRAMES}" \
  --output-dir "${OUTPUT_DIR}"
