ACL-GAN icon indicating copy to clipboard operation
ACL-GAN copied to clipboard

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

Open xunings opened this issue 4 years ago • 2 comments

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. https://github.com/hyperplane-lab/ACL-GAN/blob/7166a866e7b2eb011ace06d59ceafab905075108/test_batch.py#L65

xunings avatar Feb 03 '21 09:02 xunings

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?

xunings avatar Feb 05 '21 08:02 xunings

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.

Rivendile avatar Apr 08 '21 03:04 Rivendile