bev-project/archive_scripts/run_inference.sh

58 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# BEVFusion推理脚本
# 基于epoch_19.pth在nuScenes验证集上运行推理并生成可视化
set -e
export PATH=/opt/conda/bin:$PATH
echo "=================================================="
echo "BEVFusion推理和可视化"
echo "=================================================="
echo "Checkpoint: epoch_19.pth"
echo "数据集: nuScenes Validation Set"
echo "推理样本数: 10 (可修改)"
echo "=================================================="
echo ""
# 配置参数
CONFIG="configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask.yaml"
CHECKPOINT="runs/run-326653dc-74184412/epoch_19.pth"
OUTPUT_DIR="inference_results_epoch19"
SAMPLES=10
SCORE_THR=0.3
# 检查文件是否存在
if [ ! -f "$CHECKPOINT" ]; then
echo "❌ Error: Checkpoint文件不存在: $CHECKPOINT"
exit 1
fi
if [ ! -f "$CONFIG" ]; then
echo "❌ Error: 配置文件不存在: $CONFIG"
exit 1
fi
echo "✅ 文件检查通过"
echo ""
# 运行推理
/opt/conda/bin/python inference_and_visualize.py \
--config "$CONFIG" \
--checkpoint "$CHECKPOINT" \
--samples $SAMPLES \
--output-dir "$OUTPUT_DIR" \
--show-score-thr $SCORE_THR \
--device cuda:0
echo ""
echo "=================================================="
echo "✅ 推理完成!"
echo "结果保存在: $OUTPUT_DIR"
echo "=================================================="
echo ""
echo "查看结果:"
echo " ls -lh $OUTPUT_DIR"
echo ""