Skip to content

About sampling #17

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

Closed
gitraffica opened this issue Apr 27, 2021 · 1 comment
Closed

About sampling #17

gitraffica opened this issue Apr 27, 2021 · 1 comment

Comments

@gitraffica
Copy link

gitraffica commented Apr 27, 2021

I also ran into the problem here,
problem
and I used the corresponding code you provided:

cap = captions[0].data.cpu().numpy()
sentence = ""
for j in range(len(cap)):
if cap[j] == 0:
break
word = self.ixtoword[cap[j]].encode('ascii', 'ignore').decode('ascii')
sentence += word + " "

and the altered sampling function:
ubuntu pastebin

I am confused about why this code was generating multiple same images under a same keys[j](referring to the screenshot below, the same generated images were sampled due to a same keys[j]), with different captions:
image

@gitraffica
Copy link
Author

I found out the problem by myself. The var name coincidently conflicts with the parent for loop var(.........)

cap = captions[0].data.cpu().numpy()
sentence = ""
for l in range(len(cap)):
if cap[l] == 0:
break
word = self.ixtoword[cap[l]].encode('ascii', 'ignore').decode('ascii')
sentence += word + " "

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

1 participant