focalloss icon indicating copy to clipboard operation
focalloss copied to clipboard

alpha的处理是不是有问题

Open woofyzhao opened this issue 6 years ago • 5 comments

看原文应该是,和p_t一样对正负例是不一样的权重

woofyzhao avatar Apr 27 '18 02:04 woofyzhao

@woofyzhao @zhezh

对这个代码有一丝疑问?

func_fl = focal_loss(labels, model_out, fl_gamma, fl_alpha)

labelsmodel_out 是什么? 看了解释,说model_out也是softmax后的概率。 请问,有没有简单的example,例如在mnist数据集上运行的。 谢谢。

alyato avatar Jun 06 '18 13:06 alyato

@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 avatar Jun 06 '18 14:06 zhezh

@zhezh 谢谢。 这也是我所困惑的地方。 模型的输出概率model_out需要怎么得到? labels 可以直接输入。 (我是用keras,backend 是TensorFlow,将focal_loss作为loss function,训练的时候,怎么拿到model_out值,感觉只有做预测的时候,能够得到)

alyato avatar Jun 06 '18 15:06 alyato

logits shall be input of softmax instead of probability( output of softmax).

zheLim avatar Nov 09 '19 04:11 zheLim

是错的

yzlnew avatar Oct 11 '21 07:10 yzlnew