pytorch-CycleGAN-and-pix2pix icon indicating copy to clipboard operation
pytorch-CycleGAN-and-pix2pix copied to clipboard

Modify the code to enable the high-resolution training

Open KevinChen880723 opened this issue 2 years ago • 2 comments

Hello @junyanz, thanks for providing such a fantastic method! I studied your code and tried to write it from scratch. I found that the function "backward_G" can be modified to reduce RAM usage. link is my modification; due to PyTorch accumulating the gradients by default, I calculate the loss for the two different generators separately. The Autograd package will release the computational graph for each loss when we execute backward() function. This way, we will not simultaneously store all of the computational graphs in the RAM. After the modification, I can train the model with the full resolution Cityscapes and IDD dataset!

KevinChen880723 avatar Apr 18 '22 11:04 KevinChen880723

@KevinChen880723 how about the results after training? Did you get good results in testing?

ankur-chr avatar Jul 21 '22 16:07 ankur-chr

Hello @cankur007, sorry for the late reply.

By my experiments, the testing results of zebra2horse are similar to the official repo. You can check the visualizations in the following table.

Description Input image Result
Horse to zebra
Zebra to horse

Besides, I tried using CycleGAN to do the visual translation between the Cityscapes and the IDD dataset. You can also check the visualizations in the following table.

Domain Input image Output image
Cityscapes to IDD
IDD to Cityscapes

KevinChen880723 avatar Sep 01 '22 07:09 KevinChen880723