To addressthe issues of limited scale diversity and neglect of close-range information in visual Transformer models for human pose estimation tasks, this sutdy proposes a multiscale and multi‑level semantic fusion transformer (MMSF) model. This model realizes the mutual learning of visual information at different resolutions through the introduction of keypoint tokens as proxy cross-Transformer operations, thereby improving the estimation accuracy. Meanwhile, by utilizing deep convolution and DenseNet’s token reuse technique, it effectively extracts cross tokens containing multi‑level semantic information, reducing the stacking of encoder layers and model complexity. The integration of multi‑level semantic information is achevied through the cross-fusion attention operation involing cross tokens and standard tokens, thereby further enhancing the performance of pose estimation. The experimental results show that, under the same conditions, the MMSF model achieves an average precision of 78.1% on the COCO dataset, which is 2.3% higher than the TokenPose baseline model, and has also demonstrated its effectiveness on the MPII dataset, outperforming classical Transformer-based human pose estimation methods in recent years.
视觉Transformer的产生与发展建立在Transformer在自然语言处理(Natural Language Processing, NLP)领域取得巨大成功的基础上[19]。受Transformer在NLP领域成功的启发[20-22],研究者们开始将其引入计算机视觉领域。传统的CNN受限于卷积核大小,捕获图像中的长距离信息的能力有限。因此,引入基于自注意力机制的Transformer架构为处理图像的相关任务提供了新的范式。通过自注意力机制与位置编码,模型能够捕获图像中长距离的依赖关系,从而更好地理解图像内容。
其中,缩放因子是为了增大得分差异,从而利于学习特征;使用softmax进行激活然后与 V 相乘得到输出矩阵利用了加权平均的思想。而多头注意力操作(Multi-Head Attention,MHA)通过并行地运行多个自注意力机制(即“头”),并将它们的输出拼接起来,以增强模型捕获不同位置间信息交互的能力。如图2所示按维度D在Linear层之后将输入分成H个头部,而且每个头部单独计算注意力,公式如下:
CCA更精准的解释是基于关键点标记交换的交叉注意力机制,具体实现如图3(b)所示,这里以较小尺度的关键点标记与较大尺度的视觉标记进行交叉注意力计算为例。较大尺度的标记序列记为,较小尺度的标记序列记为,上标l,s分别表示较大尺度和较小尺度,下标v,k分别表示视觉标记和关键点标记。具体的实现过程为:将的关键点标记以较大尺度为目标进行维度对齐之后得到向量,向量直接作为查询向量 Q,生成查询矩阵;同时与的视觉标记进行组合得到组合向量,将作为键向量 K 和值向量 V,生成键矩阵和值矩阵,之后进行常规的多头注意力操作。具体的注意力操作计算如下所示:
,,
其中,,,表示可学习的参数矩阵,尺寸为,D表示标记的维度,H表示多头注意力的头的数量。
可以看到CCA与MHSA原理相似,CCA只将输入标记序列中的关键点标记作为 Q,其时间复杂度为,其中,N表示一组标记序列的数量;而MHSA的 Q, K, V 是直接使用全部的输入标记序列,其时间复杂度为。所以实际上此处CCA操作对计算资源的消耗并不大。从整体上看,CCA本质上是以较小的资源消耗使关键点标记学习组合后的标记序列中的视觉标记的信息,从而达到多尺度信息交互的效果。
如图6所示,MHCA接收尺度相同的标准标记 x 和交叉标记 s 作为输入,在进行注意力操作前,标准标记通过线性变换产生,,三种输入矩阵,交叉标记通过线性变换产生,两种输入矩阵。与相乘得到中间矩阵,与相乘得到中间矩阵,将矩阵与相加即可得到融合的交叉注意力中间矩阵 y,再对 y 进行相应的缩放和softmax操作,就能得到交叉注意力得分矩阵attn,与之对应的将与相加得到融合的值矩阵 v,再将矩阵attn与 v 相乘进行注意力值的加权计算,得到最终的融合标记,这些融合标记将作为后续模型操作的标准标记。具体的操作过程用公式表示如下:
MAOG J, WANGY J. Human skeleton action recognition model integrated internal and external dependences[J]. Computer Engineering and Applications, 2023, 59(21): 132-140. DOI: 10.3778/j.issn.1002-8331.2207-0198(Ch ).
[3]
BOUALIAS N, ESSOUKRI BEN AMARAN. Pose-based human activity recognition: A review[C]//2019 15th International Wireless Communications & Mobile Computing Conference (IWCMC). New York: IEEE Press, 2019: 1468-1475. DOI: 10.1109/IWCMC.2019.8766694 .
LIUB L, ZHOUS, DONGJ F, et al. Research progress in skeleton-based human action recognition[J]. Journal of Computer-Aided Design & Computer Graphics, 2023, 35(9): 1299-1322. DOI: 10.3724/SP.J.1089.2023.19640(Ch ).
[6]
LIUH, LIUT T, ZHANGZ L, et al. ARHPE: Asymmetric relation-aware representation learning for head pose estimation in industrial human–computer interaction[J]. IEEE Transactions on Industrial Informatics, 2022, 18(10): 7107-7117. DOI: 10.1109/TII.2022.3143605 .
[7]
ZHUX J, LIQ, CHENG H. APT: Accurate outdoor pedestrian tracking with smartphones[C]//2013 Proceedings IEEE INFOCOM. New York: IEEE Press, 2013: 2508-2516. DOI: 10.1109/INFCOM.2013.6567057 .
[8]
HERNHOLMM. A virtual reality pose estimation exercise game for post-stroke upper-limb motor function rehabilitation[D].Trondheim: Norwegian University of Science and Technology, 2023.
[9]
LINZ, DAVISL S. Shape-based human detection and segmentation via hierarchical part-template matching[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2010, 32(4): 604-618. DOI: 10.1109/TPAMI.2009.204 .
[10]
WUQ Q, XUG H, LIM, et al. Human pose estimation method based on single depth image[J]. IET Computer Vision, 2018, 12(6): 919-924. DOI: 10.1049/iet-cvi.2017.0536 .
[11]
CHOK, VAN MERRIENBOERB, GULCEHREC, et al. Learning phrase representations using RNN encoder-decoder for statistical machine translation[EB/OL]. 2014: arXiv: 1406.1078. DOI: 10.3115/v1/d14-1179 .
[12]
GERSF A, SCHMIDHUBERJ, CUMMINSF. Learning to forget: Continual prediction with LSTM[J]. Neural Computation, 2000, 12(10): 2451-2471. DOI: 10.1162/089976600300015015 .
[13]
WUJ H, ZHENGH, ZHAOB, et al. AI challenger: A large-scale dataset for going deeper in image understanding[EB/OL]. 2017: arXiv: 1711.06475.
[14]
MNIHV, HEESSN, GRAVESA, et al. Recurrent models of visual attention[EB/OL]. 2014: arXiv: 1406.6247.
[15]
TOSHEVA, SZEGEDYC. DeepPose: Human pose estimation via deep neural networks[C]//2014 IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2014: 1653-1660. DOI: 10.1109/CVPR.2014.214 .
[16]
NEWELLA, YANGK Y, DENGJ. Stacked hourglass networks for human pose estimation[M]//Computer Vision–ECCV 2016. Cham: Springer International Publishing, 2016: 483-499. DOI: 10.1007/978-3-319-46484-8_29 .
[17]
PFISTERT, CHARLESJ, ZISSERMANA. Flowing ConvNets for human pose estimation in videos[C]//Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV). New York: IEEE Press, 2015: 1913-1921. DOI: 10.1109/ICCV.2015.222 .
[18]
SUNK, XIAOB, LIUD, et al. Deep high-resolution representation learning for human pose estimation[C]//2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE Press, 2019: 5686-5696. DOI: 10.1109/CVPR.2019.00584 .
[19]
XIAOB, WUH P, WEIY C. Simple baselines for human pose estimation and tracking[C]//European Conference on Computer Vision. Cham: Springer, 2018: 472-487. DOI: 10.1007/978-3-030-01231-1_29 .
[20]
CHENY L, WANGZ C, PENGY X, et al. Cascaded pyramid network for multi-person pose estimation[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2018: 7103-7112. DOI: 10.1109/CVPR.2018.00742 .
[21]
VASWANIA, SHAZEERN, PARMARN, et al. Attention is all you need[EB/OL]. 2017: arXiv: 1706.03762.
[22]
DEVLINJ, CHANGM W, LEEK, et al. BERT: Pre-training of deep bidirectional transformers for language understanding[EB/OL]. 2018: arXiv: 1810.04805. DOI: 10.48550/arXiv.1810.04805 .
[23]
RADFORDA, NARASIMHANK, SALIMANST, et al. Improving language understanding by generative pre-training[EB/OL]. [2023-10-26]. DOI: 10.4324/9781003267836-1 .
[24]
BROWNT B, MANNB, RYDERN, et al. Language models are few-shot learners[EB/OL]. 2020: arXiv: 2005.14165.
[25]
DOSOVITSKIYA, BEYERL, KOLESNIKOVA, et al. An image is worth 16×16 words: Transformers for image recognition at scale[EB/OL]. 2020: arXiv: 2010.11929.
[26]
LIUZ, LINY T, CAOY, et al. Swin Transformer: Hierarchical vision transformer using Shifted windows[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE Press, 2021: 9992-10002. DOI: 10.1109/ICCV48922.2021.00986 .
[27]
CHENC F R, FANQ F, PANDAR. CrossViT: Cross-attention multi‑scale vision transformer for image classification[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE Press, 2021: 347-356. DOI: 10.1109/ICCV48922.2021.00041 .
[28]
ZHANGH K, HUW Z, WANGX Y. Fcaformer: Forward cross attention in hybrid vision transformer[C]//2023 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE Press, 2023: 6037-6046. DOI: 10.1109/ICCV51070.2023.00557 .
[29]
XUY F, ZHANGJ, ZHANGQ M, et al. ViTPose: Simple vision transformer baselines for human pose estimation[EB/OL]. 2022: arXiv: 2204.12484.
[30]
LIY J, ZHANGS K, WANGZ C, et al. TokenPose: Learning keypoint tokens for human pose estimation[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE Press, 2021: 11293-11302. DOI: 10.1109/ICCV48922.2021.01112 .
[31]
MAOW A, GEY T, SHENC H, et al. TFPose: Direct human pose estimation with transformers[EB/OL]. 2021: arXiv: 2103.15320. DOI: 10.1007/978-3-031-20068-7_5 .
[32]
YANGS, QUANZ B, NIEM, et al. TransPose: Keypoint localization via transformer[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). New York: IEEE Press, 2021: 11782-11792. DOI: 10.1109/ICCV48922.2021.01159 .
[33]
YUANY H, FUR, HUANGL, et al. HRFormer: High-resolution vision transformer for dense predict[J]. Advances in Neural Information Processing Systems, 2021, 34: 7281-7293. DOI: 10.48550/arXiv.2110.09408 .
WANGK, XUANS B, HEX D, et al. Human pose estimation method based on cross attention transformer[J]. Computer Engineering, 2023, 49(7): 223-231. DOI: 10.19678/j.issn.1000-3428.0065330(Ch ).
[36]
VOITAE, TALBOTD, MOISEEVF, et al. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned[EB/OL]. 2019: arXiv: 1905.09418. DOI: 10.18653/v1/p19-1580 .
[37]
DONGY H, CORDONNIERJ B, LOUKASA. Attention is not all you need: Pure attention loses rank doubly exponentially with depth[EB/OL]. 2021: arXiv: 2103.03404.
[38]
GENGZ G, WANGC Y, WEIY X, et al. Human pose as compositional tokens[C]//2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE Press, 2023: 660-671. DOI: 10.1109/CVPR52729.2023.00071 .
[39]
LINT Y, MAIREM, BELONGIES, et al. Microsoft COCO: Common Objects in Context[M]//Computer Vision—ECCV 2014. Cham: Springer International Publishing, 2014: 740-755. DOI: 10.1007/978-3-319-10602-1_48 .
[40]
GENGZ G, SUNK, XIAOB, et al. Bottom-up human pose estimation via disentangled keypoint regression[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE Press, 2021: 14671-14681. DOI: 10.1109/CVPR46437.2021.01444 .
[41]
LIK, WANGS J, ZHANGX, et al. Pose recognition with cascade transformers[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR). New York: IEEE Press, 2021: 1944-1953. DOI: 10.1109/CVPR46437.2021.00198 .