CenterNet 3D Object Detection

363 阅读1分钟

Paper and Code

CenterNet原理

参考之前写的一篇文章,zhuanlan.zhihu.com/p/482584449

3D detection

3D检测其实就是来预测每张图三个维度的bounding box。这里每个中心点需要添加三个附加信息分别是depth, 3D dimension, 以及orientation。因为 depth 很难回归,一我们使用这个公式去计算depth,即 d=1/δ(d^)1d=1/\delta{(\hat{d})-1}, 这里 δ\delta 表示的是 sigmoidsigmoid 函数。设置depth 作为关键点评估器的另一中输出通道 D^[0,1]wr×HR\hat{D}\in[0,1]^{\frac{w}{r}\times\frac{H}{R}} 这里分别两个卷积层,并且卷积层之间使用 ReLUReLU 函数一次。我们直接使用一个独立的head.Γ[0,1]WR×HR×3\Gamma\in[0,1]^{\frac{W}{R}\times\frac{H}{R}\times3} 方向默认是单标量的值。然而,它可能很难回归到。通过将方向表示为两个binsbins,采用 inbinin-bin 回归。具体来说,方向使用8个标量编码,每个 binbin 有4个标量。对于一个 bin bin,,两个标量用于 softmaxsoftmax,其余两个标量回归到每个bin内的一个角度。

Demo test

4.1 Clone this repo
git clone https://github.com/xingyizhou/CenterNet.git
cd CenterNet
4.2 Install COCOAPI
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
make
python setup.py install --user
4.3 Install the requirements
pip install -r requirements.txt
4.4 Compile deformable convolutional (from DCNv2)
cd CenterNet/src/lib/models/networks/
git clone https://github.com/CharlesShang/DCNv2
cd DCNv2
./make.sh         # build
python testcpu.py    # run examples and gradient check on cpu
python testcuda.py   # run examples and gradient check on gpu 
4.5 Compile NMS if your want to use multi-scale testing or test ExtremeNet
cd CenterNet/src/lib/external
make
4.6 Download Model ZOO

github.com/xingyizhou/…

4.7 test

ddd表示3D检测,ctdet表示2D目标检测,再配置网络结构:dla_34,测试数据路径(可以是一个视频文件或一个图片文件夹),预训练模型路径:ddd_3dop.pth

4.8 demo

最终得到3D检测结果,分别为鸟瞰图和3D检测得到的图

4.9 train

python main.py ddd --exp_id 3dop --dataset kitti --kitti_split 3dop --batch_size 16 --master_batch 7 --num_epochs 70 --lr_step 45,60 --gpus 0,1