Skip to content

Input tensor #7

Open
Open

Description

@somum

#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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions