71 lines
1.8 KiB
Python
71 lines
1.8 KiB
Python
|
|
#!/usr/bin/env python3
|
|||
|
|
"""
|
|||
|
|
简单测试Phase 4B配置是否能正常构建模型
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
import sys
|
|||
|
|
import os
|
|||
|
|
sys.path.insert(0, '/workspace/bevfusion')
|
|||
|
|
|
|||
|
|
def test_config():
|
|||
|
|
"""测试配置能否正常构建模型"""
|
|||
|
|
try:
|
|||
|
|
# 设置环境
|
|||
|
|
os.environ['PYTHONPATH'] = '/workspace/bevfusion'
|
|||
|
|
|
|||
|
|
# 导入必要的模块
|
|||
|
|
from mmcv import Config
|
|||
|
|
from mmdet3d.models import build_model
|
|||
|
|
|
|||
|
|
print("🔧 加载Phase 4B配置...")
|
|||
|
|
|
|||
|
|
# 加载配置
|
|||
|
|
config_file = 'configs/nuscenes/det/transfusion/secfpn/camera+lidar/swint_v0p075/multitask_BEV2X_phase4b_rmtppad_segmentation.yaml'
|
|||
|
|
cfg = Config.fromfile(config_file)
|
|||
|
|
|
|||
|
|
print("✅ 配置加载成功")
|
|||
|
|
|
|||
|
|
# 简化配置用于测试
|
|||
|
|
cfg.data.samples_per_gpu = 1
|
|||
|
|
cfg.data.workers_per_gpu = 0
|
|||
|
|
|
|||
|
|
# 设置训练模式
|
|||
|
|
cfg.model.train_cfg = {
|
|||
|
|
'object': {
|
|||
|
|
'grid_size': [1440, 1440, 41]
|
|||
|
|
},
|
|||
|
|
'map': {}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
print("🔧 构建模型...")
|
|||
|
|
|
|||
|
|
# 构建模型
|
|||
|
|
model = build_model(cfg.model, train_cfg=cfg.model.train_cfg)
|
|||
|
|
|
|||
|
|
print("✅ 模型构建成功")
|
|||
|
|
print(f" - 模型类型: {type(model).__name__}")
|
|||
|
|
|
|||
|
|
# 检查heads
|
|||
|
|
if hasattr(model, 'heads'):
|
|||
|
|
heads = list(model.heads.keys())
|
|||
|
|
print(f" - 模型heads: {heads}")
|
|||
|
|
|
|||
|
|
if 'map' in model.heads:
|
|||
|
|
map_head = model.heads['map']
|
|||
|
|
print(f" - 分割头类型: {type(map_head).__name__}")
|
|||
|
|
|
|||
|
|
return True
|
|||
|
|
|
|||
|
|
except Exception as e:
|
|||
|
|
print(f"❌ 测试失败: {e}")
|
|||
|
|
import traceback
|
|||
|
|
traceback.print_exc()
|
|||
|
|
return False
|
|||
|
|
|
|||
|
|
if __name__ == "__main__":
|
|||
|
|
success = test_config()
|
|||
|
|
if success:
|
|||
|
|
print("\n🎉 Phase 4B配置测试通过!")
|
|||
|
|
else:
|
|||
|
|
print("\n❌ 配置测试失败")
|