2D人体姿态估计 - Numerical Coordinate Regression with Convolutional Neural Networks(DSNT)

论文地址:Numerical Coordinate Regression with Convolutional Neural Networks
代码地址:GitHub - anibali/dsntnn: PyTorch implementation of DSNT

一、论文总结

  本文提供了一种从图像中直接学习到坐标的一种思路。现在主流的方法都是基于高斯核处理的heatmap作为监督,但这种方法学习到的heatmap,在后处理得到坐标的过程中,存在量化误差(比如4倍下采样的heatmap,量化误差的期望是2)。

  本文提出一种新的处理方法,称为differentiable spatial to numerical transform(DSTN),通过DSNT处理(没添加额外参数),直接对坐标进行监督。DSNT是对heatmap进行处理的,思路如下图所示。最后的处理过程,就是将heatmap通过softmax,得到一个基于heatmap的概率分布,再通过这个概率分布,与预设好的X,Y(坐标轴)进行点乘,得到坐标的期望值。监督损失也是建立在这个期望值上的

  虽然文中的思想,主要是直接对坐标进行的回归,但实际上应用时,还是对heatmap做了约束的,而且权重还不算小。换个角度想,其实本文的实际操作,也可以认为,是对heatmap做了监督,然后添加了一个坐标的正则化因子。该正则化项的监督,可以有效减少heatmap转化成坐标的量化损失,与一些直接对heatmap做回归造成的损失误差与预期不符的问题。但是,这个heatmap项的损失也是精心挑选的,甚至不添加heatmap损失项,比不少heatmap损失计算方法的结果更好一些。

  但是,对于那些在图像中不存在的关键点(比如半身),以及多人之类的问题,DSNT都不能直接进行解决。对于某些场景的应用,这是不可避免的问题。

二、创新点

目前的数值坐标回归任务存在于大量的实际需求中,例如人体关键点检测、人脸关键点检测、物体关键点检测和3d姿态,这些问题本质任务都可以归纳为数值坐标回归,故本文研究的是该类问题的一个通用解决办法,不针对具体任务,但为了方便对比,本文还是用人体姿态估计任务来说明。

具体来说

目前主流的关键点回归就两种做法:

(1) 采用全连接层直接回归坐标点,例如yolo-v1。该类做法的优点是输出即为坐标点,训练和前向速度可以很快,且是端到端的全微分训练;缺点是缺乏空间泛化能力,也就是说丢失了特征图上面的空间信息。

空间泛化是指模型训练期间在一个位置获得的知识在推理阶段推广到另一个位置的能力 ,举例来说,如果我在训练阶段有一个球一直在图片左上角,但是测试阶段球放在了右下角了,如果网络能够检测或者识别出来,那么就说该模型具备空间泛化能力。可以看出坐标点回归任务是非常需要这种能力的,因为我不可能每一个位置的图片都训练到。全卷积模型具备这种能力的原因是权重共享,然而对于全连接层,在2014年的Network in network论文指出fully connected layers are prone to overfitting, thus hampering the generalization ability of the overall network。也就是说如果采用全连接输出坐标点方式是会极大损害空间泛化能力的,其实从理论上也很容易分析出来:在训练阶段有一个球一直在图片左上角,reshape拉成一维向量后,全连接层的激活权重全部在上半部分,而下半部分的权重是没有得到训练的,当你测试时候输入一张球放在了右下角图片,拉成一维向量后,由于下半部分权重失效,理论上是预测不出来的,即没有空间泛化能力。而卷积操作由于权重共享,是可以有效避免的。总结一下:全连接方式所得权重严重依赖于训练数据的分布,非常容易造成过拟合,这个现象我在做关键点项目预测时候发现确实很严重。
 

全连接网络了(fully connect)即每个元素单元与隐层的神经原进行全连接。参数量变为  W(width)*H(Height)*N(Hidden Nodes)

权值共享是指用相同的filter去扫一遍图像,相当于提一次特征,得到一个feature map。

 不用权值共享

卷积核的参数数量与图像像素矩阵的大小保持一致,即 W(width)*H(Height)*C(Channels) 。

(2) 采用预测高斯热图方式,然后argmax找出峰值对应的索引即为坐标点,例如cornernet、grid-rcnn和cpn等等。以单人姿态估计为例,输出是一张仅仅包含一个人的图片,输入是所有关键点的高斯热图,label是基于每个关键点生成的高斯图。如果每个人要回归17个关键点,那么预测输出特征图是(batch,h_o,w_o,17),即每个通道都是预测一个关节点的热图,然后对每个通道进行argmax即可得到整数型坐标。
基于高斯热图输出的方式会比直接回归坐标点精度更高,原因并不是高斯热图输出方式的表达好,而是由于其输出特征图较大,空间泛化能力较强导致的,那么自然能解释如果我依然采用(1)直接回归坐标的方法预测,但是我不再采用全连接,而是全卷积的方式依然会出现精度低于高斯热图的现象,原因是即使全卷积输出,但是像yolo-v2、ssd等其输出特征图很小,导致空间泛化能力不如方法(2)。 
单从数值上来看,肯定是直接回归坐标点方式好啊,因为直接回归坐标点的话,输出是浮点数,不会丢失精度,而高斯热输出肯定是整数,这就涉及到一个理论误差下界问题了。假设输入图片是512x512,输出是缩小4倍即128x128,那么假设一个关键点位置是507x507,那么缩小4倍后,即使没有任何误差的高斯热图还原,也会存在最大507-126*4=3个像素误差,这个3就是理论误差下界。如果缩小倍数加大,那么理论误差下界还会上升。所以目前大部分做法折中考虑速度和精度,采用缩小4倍的方式。
 

该类做法优点是精度通常高于全连接层直接回归坐标点方法;缺点也很明显,从输入到坐标点输出不是一个全微分的模型,因为从heatmap到坐标点,是通过argmax方式离线得到的(其实既然argmax不可导,那就用soft argmax代替嘛,有论文确实是这么做的)。并且由于其要求的输出特征图很大,训练和前向速度很慢,且内存消耗大。

在heatmap产生坐标的过程中,缺点:(1)使用的argmax之类的处理过程,是不可微分的,不能进行直接学习;(2)heatmap到坐标的过程中,存在着量化误差。heatmap与输入分辨率的下采样倍数越大,量化误差越大。更值得注意的是,监督是建立于heatmap 上的,这将导致损失函数与我们的度量(坐标上)之间相隔开来了。在推理时,我们只使用其中的某个(某几个)像素进行数值坐标计算,但在训练时,对所有像素都会造成损失。

第一幅图是target热图,第二副和第三副图是假设预测出来的两种情况,正常情况下,第二副预测的更准,但是实际上如果采用mse loss,那么第三副图的loss比第二副小,这就出现问题了,会导致预测的关键点是不准确的。 
总结一下,虽然高斯热图预测的精度通常高于回归的方法,但是其存在几个非常麻烦的问题:(1) 输出图很大,导致内存占用多、推理和训练速度慢;(2) 存在理论误差下界;(3) mse loss可能会导致学习出来的结果出现偏移;(4) 不是全微分模型;
 

 下表展示了heatmap,fully connection,DSNT三种得到坐标方法的优劣势。可以从表中看出,heatmap不是全微分,在低分辨率表现不好;fully connection,不具有空间泛化能力,而且容易过拟合;而DSNT具有所有优点。

  个人见解:之所以DSNT能直接得到坐标,又能同时具有空间泛化能力,是在于两点:(1)其对heatmap进行了监督,监督对象为高斯分布,具有对称性;(2)其对坐标轴对象X,Y进行了精心设计,分别是 1* n 和n*1的单方向性,使其在两个坐标轴具有对称性。

针对上面两种主流方法存在的优缺点,我们是否可以设计一个模型,同时具备方法(1)的全微分训练,也具备(2) 的空间泛化能力。故本文设计了一个differentiable spatial to numerical transform(DSTN)模块来弥补两着的gap,并且设计的模块是没有训练参数的,可以在低分辨率高斯图上预测,主要作用就是让梯度流可以从坐标点流到高斯热图上,而不增加额外参数和计算量。

  下图是使用heatmap监督,和使用DSNT对坐标进行监督所学习的heatmap的区别(说是对heatmap没有监督,但实际上不是的,加了正则化项),DSNT的结果更集中一些。

  heatmap在输入到DSNT之前,要经过归一化处理,变成概率分布图。normalized的意思就是非负的,加起来和为1。归一化的尝试有下表中的四种,最后选择softmax作为整流归一化的函数。

四、网络结构

下面开始讨论具体实现。首先明确DSNT模块的输入和输出,假设CNN原图输入是(batch,h,w,3),输出是(batch,h//4,w//4,17)表示17个关键点回归,用表示,DSNT作用在每一个通道上,输出是(batch,17,2)表示17个关键点的x,y坐标。

​ (1) 对每一个通道输出的高斯热图进行normalized,定义为 \hat Z 。

​ 忽略归一化分母,可以表示为 \hat Z=\phi(Z) ,作者设计了4种normalized手段,具体为:

在这里插入图片描述
以看出,选择不同的归一化手段,最终结果差距不大,但是由于表中softmax手段优异一些,故作者选择了softmax作为normalized函数。

为啥要归一化到0~1呢?是因为作者希望DSNT输入是一个离散概率分布,后面有用。
  
 (2) 转换为坐标点

先定义两个矩阵X和Y,其宽高和输入DSNT的宽高一致,其具体数值计算为:
  在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

五、Loss

loss设计就比较简单了,由于是坐标点回归,那么一个非常自然的loss肯定是误差平方和,即:

在这里插入图片描述
p是label,是DSNT模块输出值。
  我希望大家能知道为何这里的Loss只是两个点之间的二范数而已,但是梯度却是作用在了整个热图上面,原因是这个输出的预测值其实是均值,而对均值有贡献的位置是整个图,故梯度反向时候会作用在整个热图上。

如果仅仅上面这个Loss肯定是可以work的,但是如果没有加入任何约束,那么会出现同一个关键点会产生各种形状的热图,虽然对我们的最终结果没有影响,但是总感觉过于自由了。例如网络可能会学出一种非常大方差和非常小方差的高斯热图,从稳定性方面考虑,那么在实际情况下,我们肯定是需要小方差的高斯热图,而且在实验中发现认为引入一些先验是有助于网络训练的。故我们还要探讨如何加入先验。

加入先验的一种最简单最直接做法就是正则Loss,故我们可以对正则项引入高斯热图先验。总体loss为:
  在这里插入图片描述
(1) 方差正则
  第一种可以想到的正则是控制方差,前面说过我们希望学出高斯热图,且方差要小,那么很自然我们可以写成:
  在这里插入图片描述
第一个式子是计算方差,只和预测出来的坐标有关,第二个是最终的方差正则项,通过给予x和y方向同样大小的方差约束,就有助于学习出高斯热图。

(2) 分布正则

其实容易想到另一种更好的正则。你希望的不就是要得到高斯热图吗?那么由于你已经变换到了概率分布中,那么我希望他的输出分布是二元高斯,那么肯定用KL散度啊,KL散度大量用于衡量两个分布相似性上,在GAN中应用超级广泛。那么我们有:
  在这里插入图片描述
是二元高斯分布,这样的设计就可以强制网络学到高斯热图。由于KL散度有:1.永远大于等于0,但是不一定小于1; 2.非对称性,故作者引入了更好的KL散度变种:Jensen-Shannon,其是KL散度的变体,值域范围是0~1,且是对称的。
  其实我们可以换一个角度考虑,例如SVM Loss一样,我们可以认为坐标预测的loss是正则Loss,而分布正则的loss是主Loss,从这个角度来看,那么本论文所提方法其实和原始的直接高斯热图回归做法并无不同,还是直接回归高斯热图,不过额外增加了一个坐标回归正则项,为了能得到坐标点,引入了DSNT模块而已。

作者通过实验对比,结果如下:
  在这里插入图片描述
可以看出JS更好一些,故最终最终选择的正则是JS分布正则。

在这里插入图片描述
上图是在不同的方差大小情况下学习出的热图形状,可以看出JS正则的效果不错,但是可以看出方差影响很大,这个在具体项目中非常关键,需要小心设计。还可以看出在方差正则中,由于只是限制了方差相等,均值为0,故他无法直接学习出高斯热图,而是将热图分成关节周围的四个斑点。
在这里插入图片描述

4 实验

参见:

Numerical Coordinate Regression=高斯热图 VS 坐标回归_祝小梦的博客-CSDN博客_高斯热图提取坐标

【论文阅读笔记】Numerical Coordinate Regression with Convolutional Neural Networks_时光机゚的博客-CSDN博客

Numerical Coordinate Regression=高斯热图 VS 坐标回归_祝小梦的博客-CSDN博客

 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Experimental and numerical study on detection of sleeve grouting defect with impact-echo method Abstract: The impact-echo method is widely used for the non-destructive testing of concrete structures. However, the detection of sleeve grouting defects with this method remains challenging. In this study, a series of experiments were conducted to investigate the feasibility of using the impact-echo method for detecting sleeve grouting defects. A numerical model was also developed to simulate the wave propagation and reflection in the sleeve grouting system. Results show that the impact-echo method can effectively detect sleeve grouting defects with a relatively high accuracy. The numerical simulation results were consistent with the experimental results. The developed numerical model can be used to optimize the impact-echo testing parameters and assist in the interpretation of experimental data. Keywords: impact-echo method; sleeve grouting defect; non-destructive testing; numerical simulation Introduction: Sleeve grouting is widely used in the construction of concrete structures to improve the load-bearing capacity and stability of the structures. However, defects in the sleeve grouting can lead to the failure of the structure, and it is difficult and expensive to repair the defects after the structure is built. Therefore, it is important to develop effective non-destructive testing methods to detect the defects in the sleeve grouting. The impact-echo method is a widely used non-destructive testing method for concrete structures. It is based on the generation and detection of stress waves in the concrete structure using an impact source and a sensor. The method has been successfully used for the detection of various defects in concrete structures, such as cracks, voids, and delamination. However, the detection of sleeve grouting defects with the impact-echo method remains challenging. The sleeve grouting system consists of a steel sleeve, grout, and concrete. The steel sleeve has a higher acoustic impedance than the grout and concrete, which makes it difficult for stress waves to penetrate the steel sleeve and reach the grout and concrete. In addition, the grout and concrete have different material properties, which can lead to multiple reflections and scattering of stress waves. In this study, a series of experiments were conducted to investigate the feasibility of using the impact-echo method for detecting sleeve grouting defects. A numerical model was also developed to simulate the wave propagation and reflection in the sleeve grouting system. The objective of this study is to develop an effective non-destructive testing method for sleeve grouting defects, which can be used to improve the safety and reliability of concrete structures. Experimental setup: The experimental setup is shown in Figure 1. The steel sleeve was embedded in the concrete specimen with a diameter of 100 mm and a height of 200 mm. The steel sleeve had an outer diameter of 50 mm and a wall thickness of 2 mm. The grout was injected into the annular gap between the steel sleeve and the concrete specimen. The grout had a compressive strength of 50 MPa and a density of 2,300 kg/m3. An impact source and a sensor were used to generate and detect stress waves in the concrete specimen. The impact source was a steel ball with a diameter of 16 mm, which was dropped from a height of 50 mm onto the steel sleeve. The sensor was a piezoelectric transducer with a frequency response of 50 kHz to 1 MHz. The sensor was placed on the surface of the concrete specimen opposite to the impact source. Figure 1 Experimental setup Experimental results: The experimental results are shown in Figure 2. The time-domain signals and frequency-domain spectra of the stress waves were analyzed to detect the sleeve grouting defects. The experimental results show that the impact-echo method can effectively detect sleeve grouting defects with a relatively high accuracy. The amplitude and frequency of the stress waves were affected by the presence and location of the defects. Figure 2 Experimental results: (a) time-domain signals; (b) frequency-domain spectra Numerical simulation: A numerical model was developed to simulate the wave propagation and reflection in the sleeve grouting system. The model was based on the finite element method and the acoustic-structure interaction theory. The steel sleeve, grout, and concrete were modeled as three-dimensional solid elements. The impact source and sensor were modeled as point sources and receivers. The numerical simulation results were compared with the experimental results to validate the model. The numerical simulation results were consistent with the experimental results, which indicates that the developed model can be used to optimize the impact-echo testing parameters and assist in the interpretation of experimental data. Conclusion: In this study, a series of experiments were conducted to investigate the feasibility of using the impact-echo method for detecting sleeve grouting defects. A numerical model was also developed to simulate the wave propagation and reflection in the sleeve grouting system. Results show that the impact-echo method can effectively detect sleeve grouting defects with a relatively high accuracy. The numerical simulation results were consistent with the experimental results. The developed numerical model can be used to optimize the impact-echo testing parameters and assist in the interpretation of experimental data.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值