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

python scripts/translate_images.py PATH_TO_TRAINED_MODEL -n 100 raise RuntimeError #25

Open
sonwe1e opened this issue Jan 8, 2024 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@sonwe1e
Copy link

sonwe1e commented Jan 8, 2024

It raise RuntimeError when I run python ./uvcgan-main/scripts/translate_images.py ./uvcgan-main/outdir/selfie2anime/model_d\(cyclegan\)_m\(cyclegan\)_d\(basic\)_g\(vit-unet\)_cyclegan_vit-unet-12-self-lsgan-paper-cycle_high-256/ -n 100
image
And I found the shape of X and shape of embed is not the same
image
The position of error is

    def forward(self, x):
        # x     : (N, L, input_features)
        # embed : (1, height * width, embed_features)
        #       = (1, L, embed_features)
        embed = self.embed(self.y_const, self.x_const)
        print(x.shape)
        print(embed.shape)

        # embed : (1, L, embed_features)
        #      -> (N, L, embed_features)
        embed = embed.expand((x.shape[0], *embed.shape[1:]))
        print(x.shape)
        print(embed.shape)

        # result : (N, L, embed_features + input_features)
        result = torch.cat([embed, x], dim=2)

        # (N, L, features)
        return self.output(result)

Looking forward to your reply.

@usert5432
Copy link
Collaborator

Hi @sonwe1e, I think this error is caused by working on images of larger size. From the error message, it looks like the model was trained on images of size (256, 256) pixels, but it is evaluated on images of size (512, 512) pixels.

Would my assumption on images sizes be correct?

@usert5432 usert5432 self-assigned this Jan 8, 2024
@usert5432 usert5432 added the question Further information is requested label Jan 8, 2024
@sonwe1e
Copy link
Author

sonwe1e commented Jan 9, 2024

Hi! Thanks for your reply. I found there is no resize in valid dataset, so I add resize augment to valid config to match the image size.

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

No branches or pull requests

2 participants