junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
23.09k stars 6.32k forks source link

Why no ReflectionPad2d in the two downsampling layers of ResNetGenerator? #1430

Closed j314erre closed 2 years ago

j314erre commented 2 years ago

Why do the 2nd and 3rd Conv2d layers use normal zero padding while all the other Conv2d layers including the ResnetBlocks use ReflectionPad2d?

n_downsampling = 2
        for i in range(n_downsampling):  # add downsampling layers
            mult = 2 ** i
            model += [nn.Conv2d(ngf * mult, ngf * mult * 2, kernel_size=3, stride=2, padding=1, bias=use_bias),
                      norm_layer(ngf * mult * 2),
                      nn.ReLU(True)]
junyanz commented 2 years ago

We adopted the network architectures from the fast neural style transfer paper. They did not use reflection padding for the downsampling layers. See this line.

j314erre commented 2 years ago

Thanks for the info!