https://github.com/Fdevmsy/PyTorch-Soft-Argmax/blob/master/soft-argmax.py
在姿态估计算法中,微软开发的 SimpleBaseline 是精度高而又轻量级的典范,昨天一篇论文Simple and Lightweight Human Pose Estimation,在该架构基础上做了少许改进,取得了更快的速度和更小的模型Size。
论文作者信息:
import torch
import torch.nn as nn
def soft_argmax(voxels):
"""
Arguments: voxel patch in shape (batch_size, channel, H, W, depth)
Return: 3D coordinates in shape (batch_size, channel, 3)
"""
assert voxels.dim()==5
# alpha is here to make the largest element really big, so it
# would become very close to 1 after softmax
alpha = 1000.0
N,C,H,W,D = voxels.shape
soft_max = nn.functional.softmax(voxels.v