triplet-reid-pytorch icon indicating copy to clipboard operation
triplet-reid-pytorch copied to clipboard

embed

Open qujinjie opened this issue 5 years ago • 2 comments

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的特征求和除去长度

qujinjie avatar Sep 27 '19 08:09 qujinjie

I think there is a problem too.

bitgs avatar Jun 01 '20 23:06 bitgs

I guess the author wanted to sum up the embeddings of ten crops of 1 image rather than a batch of 32 images.

bitgs avatar Jun 01 '20 23:06 bitgs