jhoffman / cycada_release

Code to accompany ICML 2018 paper
BSD 2-Clause "Simplified" License
561 stars 126 forks source link

Different data preprocessing in cyclegan vs. cycada #9

Closed sangmichaelxie closed 5 years ago

sangmichaelxie commented 6 years ago

https://github.com/jhoffman/cycada_release/blob/0a50507e4cb3e1bd6ad0b29dba5d75065658ff48/cycada/data/data_loader.py#L86

https://github.com/jhoffman/pytorch-CycleGAN-and-pix2pix/blob/e484612d83449d05024a7d5fd2e012be53faad85/data/mnist_svhn_dataset.py#L37

Hi, I was comparing the image preprocessing routines in the cycada code and the cyclegan code in the submodule for the SVHN to MNIST task. It seems that in the cyclegan code, the MNIST image is normalized with transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)). In contrast, in the cycada directory the input image is normalized with transforms.Normalize((0.5,), (0.5,)), which I believe only normalizes the first channel of the image? I understand that they don't have to match since the ADDA part is separate from the cyclegan part, but is this difference intentional?

jhoffman commented 5 years ago

The two are equivalent when the mean/std is the same across all channels. This code also works when we only have a single channel model (ex LeNet for MNIST).