Step1:环境搭建
- 1.创建并激活虚拟环境
- 1.1 用官方Pytorch指令安装!
- 1.2 用官方mmcv指令安装!
- 2 安装MMDetection
- 3 克隆编译mmdetection3d
- 4 环境测试
- 5 测试demo
在Conda虚拟环境中搭建MMdetection3d环境
1.创建并激活虚拟环境
conda create -n mm3d python=3.9 -y
conda activate mm3d
1.1 用官方Pytorch指令安装!
Pytorch官网
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
# 或者
conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia
# 查看torch的版本
python -c 'import torch;print(torch.__version__)'
python -c 'import torch;print(torch.cuda.is_available())'
1.2 用官方mmcv指令安装!
mmcv官网
# mim是OpenMMLab项目的包管理工具,它使mmcv的安装变得容易
pip install -U openmim
mim install mmcv
# 测试
python -c 'import mmcv'
2 安装MMDetection
参考官网链接:BUILD MMCV FROM SOURCE
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/optional.txt
nvcc --version
gcc --version
pip install -v -e . # or "python setup.py develop"
# 测试
python -c 'import mmdet'
3 克隆编译mmdetection3d
git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
pip install -r requirements/optional.txt
pip install -v -e . # or "python setup.py develop"
# 测试
python -c 'import mmdet3d'
4 环境测试
(mm3d) ll@ll:/media/ll/L/llr/a2023_my_3d/mmdetection3d$ python
Python 3.9.17 (main, Jul 5 2023, 20:41:20)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
True
>>> import mmcv
>>> import mmdet
>>> import mmdet3d
>>>
5 测试demo
1、下载预训练模型:hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth
2、测试命令:
python demo/pcd_demo.py demo/data/kitti/000008.bin configs/3dssd/3dssd_4xb4_kitti-3d-car.py my_checkpoints/hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth