CynicalHeart

Results 6 comments of CynicalHeart

Of course it will be this result. In ‘val’ set, only one snapshot per identity. `ZeroDivisionError` cause by ` t = i % len(rand) `, len(rand) is zero !

我记得当初也被`pos_labels`名称迷惑到了,因为它的定义在上面: ```python inputs, labels, pos, pos_labels = data # anchor、batch中类别索引列表、正例、正例类别索引列表 ... pos = pos.view(4 * opt.batchsize, c, h, w) # 正例样本[5维->4维] # copy pos 4times 复制四次,并使四个索引连续排布.eg:[213,213,213,213,132,132,132,132...] pos_labels = pos_labels.repeat(4).reshape(4, opt.batchsize)...

我记得没有任何位置用上`neg_sample`,正负例都是用的第一个函数。

**纠正理解:** ```python # 计算anchor与困难正、负例余弦相似度得分:代表距离。shape=(batch,) pscore = torch.sum(f * pf_hard, dim=1) # anchor与困难正例对应位相乘并按行求和(×乘) nscore = torch.sum(f * nf_hard, dim=1) # anchor与困难负例对应位相乘并按行求和 # not opt.PCB # 正则式 reg = torch.sum((1 + nscore)...

> 对不起,,,现在才看到。那时候在准备回国。。。。@CynicalHeart > > * 因为希望 nscore趋近于 -1, pscore趋近于1. 相似度越大越好。 > * 是的。更准确地说是 余弦相似度 越大越像。 > * 是的。验证理论上可以写。。。我就是懒。。。就没写。。。 感谢回复~,代码还是很好理解的。度量学习验证问题一直是个头疼的问题,后面用了`circle loss`,验证时还是离不开交叉熵,难顶。