Files
yolov26_3d/tools/scripts_for_gt/visualization/visualize_batch.sh
2026-06-24 09:35:46 +08:00

55 lines
1.7 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# 对 DL_KPI_SCENE 下的所有 case 批量进行 GT 可视化
# 用法:
# bash tools/scripts_for_gt/visualization/visualize_batch.sh [SAMPLE_INTERVAL]
# 例:
# bash tools/scripts_for_gt/visualization/visualize_batch.sh 5 # 每隔5帧处理一帧
set -euo pipefail
SCENE_ROOT="/data1/dongying/Mono3d/G1Q3/dataset_for_evaluation/DL_KPI_SCENE"
SAMPLE_INTERVAL="${1:-20}" # 第一个位置参数为采样间隔默认为20
FILE_EXTENSION=".png"
# 收集所有 case 目录(含 images/ 子目录的)
mapfile -t CASE_DIRS < <(find "$SCENE_ROOT" -mindepth 1 -maxdepth 1 -type d | sort)
echo "共找到 ${#CASE_DIRS[@]} 个 case采样间隔=${SAMPLE_INTERVAL}"
echo "======================================================"
SUCCESS=0
SKIP=0
FAIL=0
for CASE_DIR in "${CASE_DIRS[@]}"; do
IMAGE_DIR="${CASE_DIR}/images"
LABEL_DIR="${CASE_DIR}/labels_json"
OUTPUT_DIR="${CASE_DIR}/vis_json"
if [[ ! -d "$IMAGE_DIR" ]]; then
echo "[SKIP] ${CASE_DIR##*/} — 无 images/ 目录"
(( SKIP++ )) || true
continue
fi
if [[ ! -d "$LABEL_DIR" ]]; then
echo "[SKIP] ${CASE_DIR##*/} — 无 labels_json/ 目录"
(( SKIP++ )) || true
continue
fi
echo ""
echo ">>> 处理 case: ${CASE_DIR##*/}"
python tools/scripts_for_gt/visualization/visualize_batch.py \
--image-dir "$IMAGE_DIR" \
--label-dir "$LABEL_DIR" \
--output "$OUTPUT_DIR" \
--file-extension "$FILE_EXTENSION" \
--sample-interval "$SAMPLE_INTERVAL" \
&& (( SUCCESS++ )) || (( FAIL++ )) || true
done
echo ""
echo "======================================================"
echo "全部完成:成功=${SUCCESS} 跳过=${SKIP} 失败=${FAIL}"