bev-project/test_enhanced_config.py

63 lines
2.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""测试Enhanced配置的数据加载"""
import sys
sys.path.insert(0, '/workspace/bevfusion')
from mmdet3d.utils import Config
# 加载两个配置对比
print("=" * 60)
print("对比配置文件")
print("=" * 60)
# 原始配置
cfg_orig = Config.fromfile('configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask.yaml')
print("\n1. 原始multitask.yaml:")
print(f" - 有train_pipeline: {hasattr(cfg_orig, 'train_pipeline')}")
if hasattr(cfg_orig, 'train_pipeline'):
print(f" - Pipeline步骤数: {len(cfg_orig.train_pipeline)}")
has_load_bev = any(step.get('type') == 'LoadBEVSegmentation' for step in cfg_orig.train_pipeline)
print(f" - 包含LoadBEVSegmentation: {has_load_bev}")
collect_step = [step for step in cfg_orig.train_pipeline if step.get('type') == 'Collect3D']
if collect_step:
keys = collect_step[0].get('keys', [])
print(f" - Collect3D keys: {keys}")
print(f" - 包含gt_masks_bev: {'gt_masks_bev' in keys}")
# Enhanced Phase 1配置
print("\n2. Enhanced Phase 1配置:")
try:
cfg_enh = Config.fromfile('configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask_enhanced_phase1.yaml')
print(f" - 有train_pipeline: {hasattr(cfg_enh, 'train_pipeline')}")
if hasattr(cfg_enh, 'train_pipeline'):
print(f" - Pipeline步骤数: {len(cfg_enh.train_pipeline)}")
has_load_bev = any(step.get('type') == 'LoadBEVSegmentation' for step in cfg_enh.train_pipeline)
print(f" - 包含LoadBEVSegmentation: {has_load_bev}")
collect_step = [step for step in cfg_enh.train_pipeline if step.get('type') == 'Collect3D']
if collect_step:
keys = collect_step[0].get('keys', [])
print(f" - Collect3D keys: {keys}")
print(f" - 包含gt_masks_bev: {'gt_masks_bev' in keys}")
# 检查data配置
print(f"\n - 有data配置: {hasattr(cfg_enh, 'data')}")
if hasattr(cfg_enh, 'data'):
print(f" - workers_per_gpu: {cfg_enh.data.get('workers_per_gpu', 'N/A')}")
print(f" - samples_per_gpu: {cfg_enh.data.get('samples_per_gpu', 'N/A')}")
except Exception as e:
print(f" ❌ 加载失败: {e}")
print("\n" + "=" * 60)
print("诊断完成")
print("=" * 60)