facebookresearch / pytorch_GAN_zoo

A mix of GAN implementations including progressive growing
BSD 3-Clause "New" or "Revised" License
1.61k stars 271 forks source link

Should the grayscale transform come last in the list? #128

Open diviramon opened 3 years ago

diviramon commented 3 years ago

https://github.com/facebookresearch/pytorch_GAN_zoo/blob/b75dee40918caabb4fe7ec561522717bf096a8cb/models/trainer/gan_trainer.py#L423

As it is right now, it will through an error when using 1 channel images since they are converted to GrayScale first then a transform on three channels (0.5,0.5,0.5) is applied.

GarySarwin commented 3 years ago

Try this:

transformList = [Transforms.Grayscale(1)] + transformList[:len(transformList)-1] + [Transforms.Normalize((0.5,),(0.5,))]

aaroncoyner commented 3 years ago

This fixed it for me: https://github.com/facebookresearch/pytorch_GAN_zoo/issues/122#issue-729236995