tamarott / SinGAN

Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
https://tamarott.github.io/SinGAN.htm
Other
3.3k stars 612 forks source link

padd_size parameter causes dimension errors #104

Open noamgat opened 4 years ago

noamgat commented 4 years ago

Hi, Trying to use the padd_size parameter, does not seem to work. Example: python main_train.py --input_name=birds.png --padd_size=1

Gets the following error:

`Traceback (most recent call last): File "main_train.py", line 29, in train(opt, Gs, Zs, reals, NoiseAmp)

File "SinGAN/SinGAN/training.py", line 39, in train z_curr,in_s,G_curr = train_single_scale(D_curr,G_curr,reals,Gs,Zs,in_s,Noise Amp,opt)

File "SinGAN/SinGAN/training.py", line 161, in train_single_scale gradient_penalty = functions.calc_gradient_penalty(netD, real, fake, opt.lam bda_grad, opt.device)

File "SinGAN/SinGAN/functions.py", line 133 , in calc_gradient_penalty interpolates = alpha real_data + ((1 - alpha) fake_data) RuntimeError: The size of tensor a (38) must match the size of tensor b (48) at non-singleton dimension 3 `

Is there a quick solution for this?

tamarott commented 4 years ago

--padd_size control the padding of each conv-layer. because we ended up using an initial padding and not layer padding (see fig. 1 in the SM), with the current model --padd_size should be kept 0.