junyanz / CycleGAN

Software that can generate photos from paintings, turn horses into zebras, perform style transfer, and more.
Other
12.23k stars 1.93k forks source link

Synthetic to Real Image #104

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello. I tried the pytorch Cycle-Consistent GAN code for the task of translating synthetic foot images to real foot images.

I gathered my own training data and performed several experiments. Here are some results, with realA (synthetic) images on the left and fakeB (generated real) images on the right of each pair. geocyclegan_samples

I intend to use the fakeB images to train a neural network for foot pose estimation and the generated data quality does not seem good enough for that goal. Qualitatively, 3/4 of the test fakeB images have issues such as deformity or unrealistic coloring.

Following the methodology in Mueller et al., I added a geometric consistency loss term to ensure that realA and fakeB images produce the same segmentation mask, therefore having the same pose.

In my most recent experiment, I used 10K synthetic images and 10K real images. I used the following flags: python train.py --no_flip --resize_or_crop none --lambda_geometric 0.2 --niter 20 --niter_decay 20 --lr_decay_iters 8 --lambda_identity 0 --batch_size 1 --norm instance --model cycle_gan

All other flags set at default. Training 10K images on 1 GPU with the specified number of iterations took 4 days to train.

I hope you can give me advice on how to achieve better results:

junyanz commented 5 years ago

Cool results. A few comments:

ghost commented 5 years ago

@junyanz I will try data augmentation. I am using one NVIDIA K80 gpu. I increased batch_size to 6. When batch_size = 1, each example in a batch takes ~1.2 to 1.3 seconds. Now, at batch_size = 6, each example in a batch takes ~0.8 to 0.9 seconds.

junyanz commented 5 years ago

Looks good. You might want to use instancenorm.

sudharavali commented 5 years ago

Hi, I am working on a problem very similar to this, generating realistic images from synthetic ones. Can you please let me know if you have obtained better results by following the above tricks ? It would be really helpful.