triplet-reid-pytorch
triplet-reid-pytorch copied to clipboard
embed
for it, (img, lb_id) in enumerate(dl):
print('\r=======> processing iter {} / {}'.format(it, all_iter_nums),
end = '', flush = True)
label_ids.append(lb_id)
#label_cams.append(lb_cam)
embds = []
for im in img:
im = im.cuda()
embd = model(im).detach().cpu().numpy() #通过网络生成特征向量
embds.append(embd)
embed = sum(embds) / len(embds)
embeddings.append(embed)
请问代码为什么每次要把一个batch的特征求和除去长度
I think there is a problem too.
I guess the author wanted to sum up the embeddings of ten crops of 1 image rather than a batch of 32 images.