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

Input tensor #7

Open
somum opened this issue Jan 15, 2021 · 0 comments
Open

Input tensor #7

somum opened this issue Jan 15, 2021 · 0 comments

Comments

@somum
Copy link

somum commented Jan 15, 2021

#image-artistic-style-similarity

After # compute styles when calling "style" facing an issue:

InvalidArgumentError: Must provide as many biases as the last dimension of the input tensor: [3] vs. [1,400,400,4] [Op:BiasAdd] name: style_model_7/BiasAdd/.

I found a reason initially if I run this:

compute styles

image_style_embeddings = {}
for image_path in tqdm(image_paths):
image_tensor = load_image(image_path)
style = style_to_vec(image_to_style(image_tensor))
image_style_embeddings[ntpath.basename(image_path)] = style

Then for some reason, the shape remains [1,400,400,4] when the tensor is empty but after when tensor start to fill the shape changes to [1,400,400,3]

But if I run this:

compute styles

image_style_embeddings = {}
for image_path in tqdm(image_paths):
->image_tensor = load_image(image_path)
->if (image_tensor.shape[3]!= 4):
-> ->style = style_to_vec(image_to_style(image_tensor))
->->image_style_embeddings[ntpath.basename(image_path)] = style

Its working fine is it ok to do?

Thanks in advance!

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