环境
- pycharm 2023.1.2
- wsl + ubuntu20.04
- anaconda3
创建环境
# 创建环境
conda create -n petr python=3.8 -y
conda activate petr
添加依赖
# 添加依赖包
pip install torch==1.10.0+cu113 torchvision==0.11.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html
pip install mmdet==2.14.0
pip install mmsegmentation==0.14.1
pip install ninja
pip install tensorboard==2.13.0
pip install nuscenes-devkit==1.1.10
pip install scikit-image==0.19.0
pip install lyft-dataset-sdk==0.0.8
pip install numpy==1.19.5
pip install pandas==1.4.4
pip install llvmlite==0.31.0
pip install timm
pip install setuptools==59.5.0
pip install einops
# 安装 mmdetection3d
git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
git checkout v0.17.1
python setup.py install
添加数据集
用的 windows 系统,创建链接。数据集中未包含 test
数据集,若需要请自行配置。
单独拷贝文件夹 v1.0-trainval
mklink /j D:\edusoftware\coding\PETR\data\nuscenes\maps E:\datasets\nuscenes\maps
mklink /j D:\edusoftware\coding\PETR\data\nuscenes\samples E:\datasets\nuscenes\samples
mklink /j D:\edusoftware\coding\PETR\data\nuscenes\sweeps E:\datasets\nuscenes\sweeps
目录完整结构如下:
下载预训练模型
github
下载速度慢的话,可从 百度网盘 下载。
cd PETR
mkdir ckpts
cd ckpts & wget https://download.openmmlab.com/pretrain/third_party/resnet50_msra-5891d200.pth
生成数据集信息
生成数据集信息过慢,可从 百度网盘 下载。
# 使用mmdetection3d生成数据集信息
# https://github.com/open-mmlab/mmdetection3d/blob/1.0/docs/en/data_preparation.md
python tools/create_data.py nuscenes --root-path ./data/nuscenes --out-dir ./data/nuscenes --extra-tag nuscenes
ModuleNotFoundError: No module named ‘tools’
export PYTHONPATH=./
ModuleNotFoundError: No module named ‘einops’
pip install einops
FileNotFoundError: [Errno 2] No such file or directory: ‘/data/Dataset/nuScenes/nuscenes_infos_train.pkl’
# petr_r50dcn_gridmask_p4.py 修改地址
data_root = './data/nuScenes/'
断点调试
projects/configs/petr/petr_r50dcn_gridmask_p4.py --work-dir work_dirs/petr_r50dcn_gridmask_p4/