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

The aspect ratio is unintentionally kept in test.py and test_batch.py #11

Open
xunings opened this issue Feb 3, 2021 · 2 comments
Open

Comments

@xunings
Copy link

xunings commented Feb 3, 2021

Hi,
I had an error while feeding male2female test images (178x218) into test.py or test_batch.py.

RuntimeError: The size of tensor a (313) must match the size of tensor b (312) at non-singleton dimension 2

It seems that the aspect ratio is unintentionally kept during resizing, leading to (256, 313) output instead of (256, 256).

One way to fix this is changing new_size=config['new_size'] to new_size=(config['new_size'], config['new_size']) in the below line.

data_loader = get_data_loader_folder(opts.input_folder, 1, False, new_size=config['new_size'], crop=False)

@xunings
Copy link
Author

xunings commented Feb 5, 2021

In CouncilGAN, a center crop is applied for those images with h!=w, See

https://github.com/Onr/Council-GAN/blob/7fe8f8a72ab1b00d4024dd09f414f53781f27eaa/utils.py#L127

Guess this is also what we need?

@Rivendile
Copy link
Collaborator

Thanks for your suggestions! We did not test for images with h!=w, and thus there may be some errors. I think center crop should work.

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