bev-project/EVAL_AND_VISUALIZE.sh

85 lines
2.8 KiB
Bash
Raw Normal View History

2025-11-21 10:50:51 +08:00
#!/bin/bash
# Phase 4B RMT-PPAD 完整评估和可视化脚本
# 运行评估并自动生成可视化结果
set -e
export PATH=/opt/conda/bin:$PATH
export LD_LIBRARY_PATH=/opt/conda/lib/python3.8/site-packages/torch/lib:/opt/conda/lib:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PYTHONPATH=/workspace/bevfusion:$PYTHONPATH
cd /workspace/bevfusion
echo "=================================================================================="
echo "Phase 4B RMT-PPAD 完整评估和可视化流程"
echo "=================================================================================="
echo "1. 运行快速评估 (10x降采样602样本)"
echo "2. 解析评估结果"
echo "3. 生成可视化图表"
echo "4. 输出性能摘要"
echo "=================================================================================="
echo ""
# 创建输出目录
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
OUTPUT_DIR="eval_complete/complete_${TIMESTAMP}"
mkdir -p "$OUTPUT_DIR"
echo "📁 输出目录: $OUTPUT_DIR"
echo ""
# 配置参数
CONFIG="configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask_BEV2X_phase4b_rmtppad_segmentation.yaml"
CHECKPOINT="runs/run-4c8ec7e5-fabdc997/epoch_1.pth"
RESULTS_FILE="$OUTPUT_DIR/fast_results.pkl"
LOG_FILE="$OUTPUT_DIR/eval.log"
# 第一步:运行评估
echo "🔍 第一步:运行快速评估..."
echo " 配置文件: $CONFIG"
echo " Checkpoint: $CHECKPOINT"
echo " 结果文件: $RESULTS_FILE"
echo ""
torchpack dist-run \
-np 1 \
/opt/conda/bin/python tools/test.py \
"$CONFIG" \
"$CHECKPOINT" \
--eval bbox map \
--out "$RESULTS_FILE" \
--cfg-options data.val.samples_per_gpu=1 data.workers_per_gpu=0 data.val.load_interval=10 \
2>&1 | tee "$LOG_FILE"
echo ""
echo "✅ 评估完成!"
echo ""
# 第二步:检查评估结果
if [ ! -f "$RESULTS_FILE" ]; then
echo "❌ 评估失败:结果文件不存在"
exit 1
fi
# 第三步:生成可视化
echo "📊 第二步:生成可视化结果..."
VIS_DIR="$OUTPUT_DIR/visualization"
python VISUALIZE_RESULTS.py "$RESULTS_FILE" --out-dir "$VIS_DIR"
echo ""
echo "=================================================================================="
echo "🎉 评估和可视化流程完成!"
echo "=================================================================================="
echo "📂 完整结果目录: $OUTPUT_DIR"
echo ""
echo "📊 可视化结果:"
echo " 📈 3D检测指标图表: $VIS_DIR/bbox_metrics.png"
echo " 🗺️ BEV分割指标图表: $VIS_DIR/map_metrics.png"
echo " 📝 详细性能摘要: $VIS_DIR/evaluation_summary.txt"
echo ""
echo "🔍 原始评估数据:"
echo " 📄 评估结果文件: $RESULTS_FILE"
echo " 📋 评估日志: $LOG_FILE"
echo ""
echo "=================================================================================="