【FSD】【BEV】BEVFormer 撸一遍,美其名曰复现


说明

论文:
[2203.17270] BEVFormer: Learning Bird’s-Eye-View Representation from Multi-Camera Images via Spatiotemporal Transformers (arxiv.org)

代码:
GitHub - fundamentalvision/BEVFormer: [ECCV 2022] This is the official implementation of BEVFormer, a camera-only framework for autonomous driving perception, e.g., 3D object detection and semantic map segmentation.

git clone https://github.com/fundamentalvision/BEVFormer.git

撸一遍

参考代码中的README,写的已经非常详细了。

避坑

nuScenes数据集下载

# 下载链接的获取方法:点击下载的'Asia',会在默认在浏览器中下载,右键这个下载任务,选择复制下载链接
wget -c -O v1.0-trainval_meta.tgz "下载链接"
wget -c -O v1.0-trainval01_blobs.tar "下载链接"
wget -c -O v1.0-trainval02_blobs.tar "下载链接"
wget -c -O v1.0-trainval03_blobs.tgz "下载链接"
wget -c -O v1.0-trainval04_blobs.tgz "下载链接"
wget -c -O v1.0-trainval05_blobs.tgz "下载链接"
wget -c -O v1.0-trainval06_blobs.tgz "下载链接"
wget -c -O v1.0-trainval07_blobs.tgz "下载链接"
wget -c -O v1.0-trainval08_blobs.tgz "下载链接"
wget -c -O v1.0-trainval09_blobs.tgz "下载链接"
wget -c -O v1.0-trainval10_blobs.tgz "下载链接"

wget -c -O v1.0-test_meta.tar "下载链接"
wget -c -O v1.0-test_blobs.tar "下载链接"
# 复制下载链接时可以看下下载速度,慢的话,刷新页面,重新获取下载链接

安装Nvidia显卡驱动

# 1 查看显卡类型
lspci | grep -i nvidia
# 例如结果如下
01:00.0 VGA compatible controller: NVIDIA Corporation Device 2208 (rev a1)
01:00.1 Audio device: NVIDIA Corporation Device 1aef (rev a1)
# 2208是什么型号?
# 在'PCI Devices (ucw.cz)'网站中查询显卡型号:GA102 [GeForce RTX 3080 Ti]

# 2 安装显卡驱动
# 在官网'Official Advanced Driver Search | NVIDIA'下载对应显卡型号的最新驱动

# 2.1 安装驱动前一定要更新软件列表和安装必要软件、依赖(必须)
sudo apt-get update # 更新软件列表
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install make

# 2.2 禁用nouveau
# 首先查看是否禁用了nouveau,如果没有输出的话说明nouveau已禁用
lsmod | grep nouveau
# 若未禁用nouveau的话,再执行以下操作
# 新建blacklist-nouveau.conf文件
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
# 在最后添加
blacklist nouveau
options nouveau modeset=0
# 更新一下系统的initramfs镜像文件
sudo update-initramfs -u
# 重启电脑后,查看是否禁用了nouveau,如果没有输出的话说明nouveau已禁用
lsmod | grep nouveau

# 2.3 安装
# 进入命令行界面('sudo telinit 5'可重新打开图形界面)
sudo telinit 3
# 关闭显示服务
sudo service gdm3 stop
# 给安装文件赋予权限,然后运行安装
sudo chmod 777 ./NVIDIA-Linux-x86_64-535.154.05.run
sudo ./NVIDIA-Linux-x86_64-535.154.05.run --no-opengl-files --no-x-check
# --no-opengl-files:只安装驱动文件,不安装OpenGL文件
# --no-x-check:安装驱动时关闭X服务,不设置可能导致安装失败
# --no-nouveau-check:安装驱动时禁用nouveau
# Would you like to register the kernel module sources with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later.(这里选 No)
# Install NVIDIA's 32-bit compatibility libraries? (这里选 No)
# Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up.(这里选 Yes)
# 安装完成后重新开启显示服务
sudo service gdm3 start
# 查看显卡驱动是否成功
nvidia-smi

相关网站链接参考:
PCI Devices (ucw.cz)
Official Advanced Driver Search | NVIDIA

判断torch和cuda环境

# 需要先安装好Anaconda
# 只需安装好Nvidia显卡驱动即可,不需要在本机系统中安装cuda,在conda虚拟环境中安装所需cuda版本的PyTorch即可

import torch
# 查看版本
print(torch.__version__)
print(torch.version.cuda)
print(torch.backends.cudnn.version())
# 运算验证
a = torch.ones((3,1)).cuda(0)
b = torch.ones((3,1)).cuda(0)
a + b

执行python setup.py install时,pip安装mmdetection3d==0.17.1依赖,下载超时报错

python setup.py install
# pip安装mmdetection3d==0.17.1依赖,下载超时报错
pip install trimesh==2.35.39 lyft_dataset_sdk numba==0.48.0 nuscenes-devkit plyfile scikit-image tensorboard networkx==2.2 numpy==1.19.5 setuptools==41.0.0
# 再次setup
python setup.py install

mmcv-full安装版本不匹配,导致后续运行,mmcv报错 ModuleNotFoundError: No module named ‘mmcv._ext

# mmcv-full安装改用
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9.0/index.html

Prepare nuScenes data,报错 ModuleNotFoundError: No module named ‘tools.data_converter’

# I solved the problem by adding a '__init__.py' file to BEVFormer/tools/
# it's an empy file which helps the project finding the modules

Train,报错 TypeError: FormatCode() got an unexpected keyword argument ‘verify’

# 原因:yapf版本过高,目前版本为 0.40.2
pip install yapf==0.40.1
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值