focalloss
focalloss copied to clipboard
alpha的处理是不是有问题
看原文应该是,和p_t一样对正负例是不一样的权重
@woofyzhao @zhezh
对这个代码有一丝疑问?
func_fl = focal_loss(labels, model_out, fl_gamma, fl_alpha)
labels
和 model_out
是什么?
看了解释,说model_out也是softmax后的概率。
请问,有没有简单的example,例如在mnist数据集上运行的。
谢谢。
@alyato labels 就是y的ground truth, model_out就是logit,其实就是输出的概率, 这里做了一个加epsilon,避免log(0). 比如三分类, 一张图是第一类,则labels=(0,1,0), 假设模型输出概率为(0.1,0.6,0.3),则model_out约等于 logit=(0.1,0.6,0.3).
@zhezh
谢谢。
这也是我所困惑的地方。
模型的输出概率model_out
需要怎么得到?
labels
可以直接输入。
(我是用keras,backend 是TensorFlow,将focal_loss作为loss function,训练的时候,怎么拿到model_out值,感觉只有做预测的时候,能够得到)
logits shall be input of softmax instead of probability( output of softmax).
是错的