Zhaoyi-Yan / Shift-Net_pytorch

Pytorch implementation of Shift-Net: Image Inpainting via Deep Feature Rearrangement (ECCV, 2018)
http://openaccess.thecvf.com/content_ECCV_2018/papers/Zhaoyi_Yan_Shift-Net_Image_Inpainting_ECCV_2018_paper.pdf
MIT License
363 stars 83 forks source link

NotImplementedError: Generator model name [face_unet_shift_triple] is not recognized #112

Closed ph-got closed 4 years ago

ph-got commented 4 years ago

Hello, it seems while using test.py and random face model (v2 I guess) that the generator for face_unet_shift_triple is not implemented. Also should 'face_shiftnet' or 'shifnet' be used ? Many thanks.

Traceback (most recent call last): File "test.py", line 20, in <module> model = create_model(opt) File "/home/user/Shift-Net_pytorch/models/__init__.py", line 30, in create_model model.initialize(opt) File "/home/user/Shift-Net_pytorch/models/shift_net/shiftnet_model.py", line 72, in initialize opt.which_model_netG, opt, self.mask_global, opt.norm, opt.use_spectral_norm_G, opt.init_type, self.gpu_ids, opt.init_gain) File "/home/user/Shift-Net_pytorch/models/networks.py", line 111, in define_G raise NotImplementedError('Generator model name [%s] is not recognized' % which_model_netG) NotImplementedError: Generator model name [face_unet_shift_triple] is not recognized

Zhaoyi-Yan commented 4 years ago

Please try the latest master branch again.

ph-got commented 4 years ago

Still got the error that I solved by adding : elif which_model_netG == 'face_unet_shift_triple': netG = FaceUnetGenerator(input_nc, output_nc, 8, opt, innerCos_list, shift_list, mask_global, \ ngf, use_spectral_norm=use_spectral_norm) in networks.py

However then got another error:

Traceback (most recent call last): File "/home/user/Shift-Net_pytorch/test.py", line 20, in model = create_model(opt) File "/home/user/Shift-Net_pytorch/models/init.py", line 30, in create_model model.initialize(opt) File "/home/user/Shift-Net_pytorch/models/face_shift_net/face_shiftnet_model.py", line 73, in initialize opt.which_model_netG, opt, self.mask_global, opt.norm, opt.use_spectral_norm_G, opt.init_type, self.gpu_ids, opt.init_gain) File "/home/user/Shift-Net_pytorch/models/networks.py", line 112, in define_G ngf, use_spectral_norm=use_spectral_norm) File "/home/user/Shift-Net_pytorch/models/modules/shift_unet.py", line 147, in init self.e1_c = spectral_norm(nn.Conv2d(input_nc, ngf, kernel_size=4, stride=2, padding=1), use_spectral_norm) File "/home/user/miniconda3/envs/shiftnet/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 332, in init False, _pair(0), groups, bias, padding_mode) File "/home/user/miniconda3/envs/shiftnet/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 24, in init if out_channels % groups != 0: RuntimeError: bool value of Tensor with more than one value is ambiguous

Process finished with exit code 1

Zhaoyi-Yan commented 4 years ago

Not netG = FaceUnetGenerator(input_nc, output_nc, 8, opt, innerCos_list, shift_list, mask_global, \ ngf, use_spectral_norm=use_spectral_norm)

It is netG = FaceUnetGenerator(input_nc, output_nc, 8, innerCos_list, shift_list, mask_global, opt, \ ngf, use_spectral_norm=use_spectral_norm) instead.

It is not consistent with other shiftnet function declaration...

Zhaoyi-Yan commented 4 years ago

I believe it is solved, feel free to reopen it if you have any questions.