Module named "Keras" is not defined
I already installed "keras" and used import function in main.py but when I tried to train SRGAN with MSE this happened.
@nickhdfan, did you managed to solve this? I'm having the same problem. Supposably only tensorflow was needed.
Add the following to ops.py import keras
apparently keras is actually a dependency for vgg54 training. If you are planning on training vgg54, you will also have to make the change to the following lines of model.py starting at around line 335. change them to look like this:
if type == 'VGG54':
target_layer = 'vgg_19/conv5/conv5_4'
elif type == 'VGG22':
target_layer = 'vgg_19/conv2/conv2_2'
Hi, I have the same error, and the proposed solution didn't work for me, instead I get this new error:
InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'dicriminator_train/discriminator/discriminator_unit/dense_layer_2/dense/bias/Adam_1': Operation was explicitly assigned to /device:GPU:0 but available devices are [ /job:localhost/replica:0/task:0/device:CPU:0 ]. Make sure the device specification refers to a valid device.
[[Node: dicriminator_train/discriminator/discriminator_unit/dense_layer_2/dense/bias/Adam_1 = VariableV2[_class=["loc:@discriminator/discriminator_unit/dense_layer_2/dense/bias"], container="", dtype=DT_FLOAT, shape=[1], shared_name="", _device="/device:GPU:0"]()]]
Someone knows why this happens and how to solve it?
i meet the same question, pip install keras, but doesn't work. AttributeError: 'module' object has no attribute 'leaky_relu'
@adeoy I believe that you have either installed regular tensorflow (not tensorflow-gpu) or you set CUDA_VISIBLE_DEVICES incorrectly when running the training script. Note: pip install tensorflow-gpu is a different from pip install tensorflow
@lxk1990727 Sounds like you need to update your tensorflow.
@ryancom16 In fact I installed regular Tensorflow because I dont a GPU on my PC, but my processors are powerful enough to make this tasks. So, I cant do the next training without a GPU? Or how can I solve this problem?
Still have the same issue, anyone found a solution?
You need to add "import keras" in lib/ops.py
I had the same issue during the second step training (SRGAN with MSE loss) and it was solved by adding "import keras" in lib/ops.py
yes👍👍" import keras " best solution!!❤❤