nn.Cross entropy loss
交叉熵损失函数
其中y为标签,p为预测值。
=softmax + log + NLL Loss
NLL Loss = 取target相应位置,取反,求平均
* 直接输入output和target,网络中不用加softmax或者对target做one hot编码。
nn.BCELoss
binary cross entropy loss
输入应为概率,范围在[0,1]
output-->sigmoid/softmax-->BCELOSS
target直接输入
nn.BCEWithLogitsLoss
=sigmoid + BCELoss
相当于直接输入output和target
BCELoss_class_weighted
Focal Loss
根据样本不平衡&识别难度来算loss