I am very new to use github. I have installed github in ubuntu 16.04, I installed python 2.7.12, tensorflow 1.9 and keras. I want to use my own custom activation and optimizer in keras RNN. I searched in web and came to know i need to install keras-contrib package to use advanced activation and custom activation function.
So, I install the keras-contrib from github. But I don't know how to work with it and how to run the program using keras-contrib.
But i tried with following commands
git clone https://www.github.com/keras-team/keras-contrib.git
cd keras-contrib
python setup.py install
then I tried with this following code
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
from keras_contrib.layers.advanced_activations import PELU
it showing the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "keras_contrib/__init__.py", line 4, in <module>
from . import layers
File "keras_contrib/layers/__init__.py", line 3, in <module>
from .convolutional import *
File "keras_contrib/layers/convolutional.py", line 15, in <module>
from keras.utils.conv_utils import normalize_data_format
ImportError: cannot import name normalize_data_format
Anyone please check this error and help me to sort out this error.
I update the keras contribute source code installed in my linux. Follow the changes:
https://github.com/ekholabs/keras-contrib/commit/0dac2da8a19f34946448121c6b9c8535bfb22ce2
Now, it works well.
I had the same problem. I installed keras 2.2.2 version using the following command and problem solved.
pip install -q keras==2.2.2
Refer this PR.
https://github.com/keras-team/keras-contrib/pull/292
Had the same issue. The problem is that normalize_data_format function was moved to keras.backend.common from keras.utils.conv_utils in later versions of keras. You can use
import keras
and then in your code use
keras.utils.conv_utils.normalize_data_format
I found that in keras version 2.6.0 the normalize function is not lost, it is just "stored" in a file "np_utils.py", so what we need to do is just change "
from keras.utils import normalize
from keras.utils.np_utils import normalize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With