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

what is the pupose of these two lines in create_input_files function in "master/utils.py"? #179

Open
naveen-marthala opened this issue Jul 10, 2022 · 1 comment

Comments

@naveen-marthala
Copy link

naveen-marthala commented Jul 10, 2022

I was going through the code and couldn't comprehend what was going on in these two lines of code:

what does the if check and what does the lines inside if do?

if len(img.shape) == 2:
img = img[:, :, np.newaxis]
img = np.concatenate([img, img, img], axis=2)

and what is being "assert"ed in this line?

assert images.shape[0] * captions_per_image == len(enc_captions) == len(caplens)

Any help is appreciated. Thanks.

@naveen-marthala naveen-marthala changed the title what are the pupose two lines in create_input_files function in "master/utils.py"? what are the pupose of these two lines in create_input_files function in "master/utils.py"? Jul 10, 2022
@naveen-marthala naveen-marthala changed the title what are the pupose of these two lines in create_input_files function in "master/utils.py"? what is the pupose of these two lines in create_input_files function in "master/utils.py"? Jul 10, 2022
@secretsather
Copy link

It's checking to make sure the images are not single channel (i.e. grayscale) and if so, creates an RGB images using the gray channel repeated (3) times.

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