Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed #4

Open
qujinjie opened this issue Sep 27, 2019 · 2 comments
Open

embed #4

qujinjie opened this issue Sep 27, 2019 · 2 comments

Comments

@qujinjie
Copy link

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

@bitgs
Copy link

bitgs commented Jun 1, 2020

I think there is a problem too.

@bitgs
Copy link

bitgs commented Jun 1, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants