OpenPose MobileNet V1 作为Backbone的模型结构(2)
Initial Stage和Refinement Stage的优化
flyfish
论文地址
论文中提到的源码地址
深度可分离卷积是如何减少计算量的
OpenPose MobileNet V1 作为Backbone的模型结构(1) MobileNet V1 的改造
OpenPose MobileNet V1 作为Backbone的模型结构(2) Initial Stage和Refinement Stage的优化
OpenPose MobileNet V1 作为Backbone的模型结构(3) Branch的合并
Initial Stage部分
keypoint的heatmap和keypoint对应的连接关系(part affinity field, paf)
(heatmaps): Sequential(
(0): Sequential(
(0): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1))
(1): ReLU(inplace=True)
)
(1): Sequential(
(0): Conv2d(512, 19, kernel_size=(1, 1), stride=(1, 1))
)
)
(pafs): Sequential(
(0): Sequential(
(0): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1))
(1): ReLU(inplace=True)
)
(1): Sequential(
(0): Conv2d(512, 38, kernel_size=(1, 1), stride=(1, 1))
)
)
Refinement Stage
根据图中性能在每个阶段的输出。Refinement stage 1后,AP达到43.6,到了后期的Refinement stage AP加的少,GFLOPs加的多,所以Refinement stage2到5 全删除了
变成了
7x7的卷积核的改进
论文原文是
Then each convolution with 7x7 kernel size was replaced by a convolutional block with the same receptive field, to capture long-range spatial dependencies . We conducted series of experiments with this block design and observed that it’s enough to have three consecutive convolutions with 1x1,3x3, and 3x3 kernel size, the latter with dilation parameter equals to 2, to preserve initial receptive field. Because the network became deeper, we added residual connection for each such block.
然后将每个7×7核大小的卷积替换为具有相同感受野(receptive field)的卷积块,以捕获远程空间(long-range)相关性。我们用这种区块设计进行了一系列实验,观察到为了保持初始感受野,连续三次卷积1x1,3x3和3x3核大小,后者的空洞(dilation)参数等于2就足够了。由于网络变得更深,我们为每个这样的块添加了residual连接。
多个blcok组成stage
简化说就是
1、三个连续的1x1, 3x3, 3x3的卷积核来代替7x7
2、 最后的3x3是使用空洞卷积, dilation=2
3、3个卷积代替1个卷积核,网络层数变深了,所以又加上一个residual connection(想想resnet)
替代结果是这样的,可以清楚的看到1x1, 3x3, 3x3
(initial): Sequential(
(0): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1))
(1): ReLU(inplace=True)
)
(trunk): Sequential(
(0): Sequential(
(0): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
)
(1): Sequential(
(0): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2))
(1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(2): ReLU(inplace=True)
)
)
而原来是
Conv2d(128, 128, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3))
改造后用图表示就是这样的
训练与推理经验
加深Refinement stage层训练
取一层refinement stage推理
OpenPose推理流程
1、一张图片 首先经过Backbone提取特征
2、经过Initial stage输出keypoint hetmaps和PAFs
3、经过Refinement stage 将前面的输出更精确些
4、最后keypoints extraction和keypoints grouping