pytorch-CycleGAN-and-pix2pix
pytorch-CycleGAN-and-pix2pix copied to clipboard
Modify the code to enable the high-resolution training
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 how about the results after training? Did you get good results in testing?
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 | ![]() |
![]() |