bev-project/QUICK_EVAL.py

69 lines
2.1 KiB
Python
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 python3
"""
快速评估Phase 4B RMT-PPAD模型并显示指标
"""
import os
import sys
import subprocess
def run_evaluation():
"""运行快速评估并显示结果"""
os.chdir('/workspace/bevfusion')
# 评估命令
cmd = [
'/opt/conda/bin/python', 'tools/test.py',
'configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask_BEV2X_phase4b_rmtppad_segmentation.yaml',
'runs/run-4c8ec7e5-fabdc997/epoch_1.pth',
'--eval', 'bbox', 'map',
'--cfg-options', 'data.val.samples_per_gpu=1', 'data.workers_per_gpu=0', 'data.val.load_interval=10'
]
print("🚀 开始Phase 4B RMT-PPAD快速评估...")
print("📊 评估配置:")
print(" - 数据集: NuScenes Val (10x降采样)")
print(" - 样本数: 602个")
print(" - 指标: 3D检测 + BEV分割")
print()
try:
# 运行评估
result = subprocess.run(cmd, capture_output=True, text=True, timeout=1800) # 30分钟超时
print("📋 评估输出:")
print("="*80)
# 解析输出,查找评估结果
lines = result.stdout.split('\n')
metrics_found = False
for line in lines:
# 查找评估结果行
if any(keyword in line.lower() for keyword in ['ap', 'iou', 'nds', 'map', 'evaluation results']):
print(line)
metrics_found = True
if not metrics_found:
print("⚠️ 未找到评估指标显示最后50行输出:")
print("\n".join(lines[-50:]))
if result.stderr:
print("\n❌ 错误信息:")
print(result.stderr[-1000:]) # 只显示最后1000字符
print("="*80)
if result.returncode == 0:
print("✅ 评估完成!")
else:
print(f"❌ 评估失败 (返回码: {result.returncode})")
except subprocess.TimeoutExpired:
print("⏰ 评估超时 (30分钟)")
except Exception as e:
print(f"❌ 评估执行失败: {e}")
if __name__ == "__main__":
run_evaluation()