[Using MMdetection3D framework for monocular 3D target detection (smoke algorithm]

Using MMdetection3D framework for 3D target detection (smoke algorithm)

1.mmdetection3d

mmdetection3d is an open source toolbox for 3D target detection developed by OpenMMLab. It contains many classic 3D target detection algorithms, including single-eye 3D target detection, multi-eye 3D target detection, point cloud 3D target detection, multi-modal 3D target detection, etc. in all directions. We only need to download the corresponding algorithm weights and call the corresponding interface to detect it.

2. mmdetection3d installation

2.1 Dependencies

The installation of mmdetection3d requires the following dependencies:

Python 3.6+
PyTorch 1.3+
CUDA 9.2+ (如果你从源码编译 PyTorch, CUDA 9.0 也是兼容的。)
GCC 5+
MMCV

1. Create a virtual environment and install the required dependencies

conda create -n mm3d python=3.8 -y  
conda install pytorch torchvision(具体的pytorch和torchvision版本可根据自己的CUDA版本来指定安装)

2. Install mmdetection3d.
If cuda11.0 has been installed, you can install it as follows: (If it is not CUDA11.0, refer to the documentation for installation)

pip install openmim 
mim install mmcv-full
mim install mmdet
mim install mmsegmentation
git clone https://github.com/open-mmlab/mmdetection3d.git
cd mmdetection3d
pip install -e .

If the download speed is very slow, you can add -i after the command line https://pypi.tuna.tsinghua.edu.cn/simple
to greatly improve the download speed through Tsinghua source.

3. Perform monocular 3D target detection

The syntax is as follows:

python demo/mono_det_demo.py ${IMAGE_FILE} ${ANNOTATION_FILE} ${CONFIG_FILE} ${CHECKPOINT_FILE} [--device ${GPU_ID}] [--out-dir ${OUT_DIR}] [--show]

in

${IMAGE_FILE} :     图像路径
${ANNOTATION_FILE} :相机内参矩阵的json文件
${CONFIG_FILE}:     配置文件
${CHECKPOINT_FILE} :模型权重文件
${GPU_ID}:          使用哪个GPU
${OUT_DIR}:         结果保存地址
--show:             结果可视化

Examples are as follows:

python demo/mono_det_demo.py   
data/kitti/testing/image_2/000010.png  
data/kitti/testing/calib_json/000010.json   
configs/smoke/smoke_dla34_pytorch_dlaneck_gn-all_8x4_6x_kitti-mono3d.py       
checkpoints/smoke_dla34_pytorch_dlaneck_gn-all_8x4_6x_kitti-mono3d_20210929_015553-d46d9bb0.pth    
 --show

result:
Insert image description here

Guess you like

Origin blog.csdn.net/qq_51182466/article/details/129314358