Focal-Loss-implement-on-Tensorflow icon indicating copy to clipboard operation
Focal-Loss-implement-on-Tensorflow copied to clipboard

The implementation of focal loss proposed on "Focal Loss for Dense Object Detection" by KM He and support for multi-label dataset.

Results 12 Focal-Loss-implement-on-Tensorflow issues
Sort by recently updated
recently updated
newest added

# 增加 gamma = 0 的情况的讨论 ``` def focal_loss_sigmoid(prediction_tensor, target_tensor, weights=None, alpha=0.5, gamma=0): target_tensor = tf.cast(target_tensor, tf.float32) sigmoid_p = tf.nn.sigmoid(prediction_tensor) zeros = array_ops.zeros_like(sigmoid_p, dtype=sigmoid_p.dtype) pos_p_sub = array_ops.where(target_tensor > zeros, target_tensor...

原论文中,α的作用是增大数量少的类别的权重,即对正样本权重为α=0.25,对负样本权重为1-α=0.75,这样增大对正样本的学习能力。 在这里,模型输出经过sigmoid,然后沿用论文中focal_loss的计算方式,使我不太清楚这里α的意义。 因为,这里的α对于多个类别,是一致无差的,也就不能起到区别对待各个类别的作用。

Hi, I have implemented your code in Pytorch and it worked properly but have the following concerns My sudo code works like this cls_targets = [batch_size, anchor_boxes, classes] # classes...

Hello! First of all thanks for your implementation. You're really awesome. My question is how to merger the focal loss with SSD architecture as I'm know working on SSD for...

For multi-label cases, I think there is no need to consider `neg_p_sub` while computing `per_entry_cross_ent`. I think we shouldn't take every class as a binary classification and sum up their...

@ailias Hi,thanks for your cool code. but I have little confused about how to use it. I want implemented it in faster rcnn,should I just change the softmax into focal...

Thanks for your sharing. I want to know what array_ops.where means. Is it similar to tf.where? Besides, I use it for SSD-Tensorflow, and loss is very high. I make some...