shaoanlu / faceswap-GAN

A denoising autoencoder + adversarial losses and attention mechanisms for face swapping.
3.39k stars 841 forks source link

faceswap error regularizers is not defined #153

Open Alkatraz91 opened 4 years ago

Alkatraz91 commented 4 years ago

hello i got this error an not understand what it means

NameError Traceback (most recent call last)

in () ----> 1 model = FaceswapGANModel(**arch_config) 2 frames /content/faceswap-GAN/networks/nn_blocks.py in conv_block(input_tensor, f, use_norm, strides, w_l2, norm) 126 def conv_block(input_tensor, f, use_norm=False, strides=2, w_l2=w_l2, norm='none'): 127 x = input_tensor --> 128 x = Conv2D(f, kernel_size=3, strides=strides, kernel_regularizer=regularizers.l2(w_l2), 129 kernel_initializer=conv_init, use_bias=False, padding="same")(x) 130 x = Activation("relu")(x) NameError: name 'regularizers' is not defined
arslanpi commented 4 years ago

Create a new cell and write the following code from keras import regularizers It will solve issue. If it doesn't then write the same code in /networks/nn_blocks.py file

Alkatraz91 commented 4 years ago

i not know were t oadd that line. today i w trying again but i got a different error: NameError Traceback (most recent call last)

in () ----> 1 model = FaceswapGANModel(**arch_config) 2 frames /content/faceswap-GAN/networks/nn_blocks.py in conv_block(input_tensor, f, use_norm, strides, w_l2, norm) 126 def conv_block(input_tensor, f, use_norm=False, strides=2, w_l2=w_l2, norm='none'): 127 x = input_tensor --> 128 x = Conv2D(f, kernel_size=3, strides=strides, kernel_regularizer=regularizers.l2(w_l2), 129 kernel_initializer=conv_init, use_bias=False, padding="same")(x) 130 x = Activation("relu")(x) NameError: name 'regularizers' is not defined after the code :model = FaceswapGANModel(**arch_config) i hav put the code u gave me right before that code but still nothing.i not know how to do the second method. edit: i think i hve done the second method too but still got the same error not know wht to do
interactivetech commented 4 years ago

I am able to get the colab notebook to see the from keras import regularizers by restarting the runtime. Not the best solution but after restarting, the colab sees the new import

wiki-lai commented 4 years ago

make sure you are using tensorflow1.8.0 and install tensorflow-gpu1.8.0 , and downgrade cuda to 9.0 .

CL791 commented 3 years ago

downgrade keras