leeyegy / SimCC

[ECCV'2022 Oral] PyTorch implementation for: SimCC: a Simple Coordinate Classification Perspective for Human Pose Estimation (http://arxiv.org/abs/2107.03332). Old name: SimDR
326 stars 31 forks source link

Sa_simdr在计算损失时使用的是LogSoftmax #31

Closed PengEC17 closed 4 months ago

PengEC17 commented 4 months ago

我发现真值使用的是高斯分布,但是在损失函数中计算KL散度的时候预测值使用的是LogSoftmax。为什么不用和真值一样的分布?

PengEC17 commented 4 months ago

pytorch官方KLDivLoss损失函数的描述文档中有提到,To avoid underflow issues when computing this quantity, this loss expects the argument input in the log-space. The argument target may also be provided in the log-space if log_target= True.

所以代码中可以对网络输出使用LogSoftMax()作为KLDivLoss的input。并且,由于 log_target默认为False,所以真值用SoftMax()表示也没有问题。