biubug6 / Pytorch_Retinaface

Retinaface get 80.99% in widerface hard val using mobilenet0.25.
MIT License
2.62k stars 769 forks source link

关于在线样本挖掘 #87

Open lycwgf opened 4 years ago

lycwgf commented 4 years ago

您好,我想问一下代码中包含在线样本挖掘代码吗?没有找到这部分代码,多谢多谢,还请指导,

PatZhuang commented 4 years ago

multibox_loss.py line 104

# Hard Negative Mining
loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
loss_c = loss_c.view(num, -1)
_, loss_idx = loss_c.sort(1, descending=True)
_, idx_rank = loss_idx.sort(1)
num_pos = pos.long().sum(1, keepdim=True)
num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
neg = idx_rank < num_neg.expand_as(idx_rank)
lycwgf commented 4 years ago

多谢多谢!