Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

ImportError: cannot import name 'normalize_data_format' #298

Open
yuyijie1995 opened this issue Aug 17, 2018 · 11 comments
Open

ImportError: cannot import name 'normalize_data_format' #298

yuyijie1995 opened this issue Aug 17, 2018 · 11 comments

Comments

@yuyijie1995
Copy link

When I use keras2.2.2 to import the layer instanceNormalization ,the error happened .What should I do?
The full error log like below
File "D:\yuyijie\kerasceshi\keras-yolo3\yolo_IN.py", line 5, in
from keras_contrib.layers.normalization import InstanceNormalization
File "D:\yuyijie\kerasceshi\keras-yolo3\keras_contrib_init_.py", line 4, in
from . import layers
File "D:\yuyijie\kerasceshi\keras-yolo3\keras_contrib\layers_init_.py", line 3, in
from .convolutional import *
File "D:\yuyijie\kerasceshi\keras-yolo3\keras_contrib\layers\convolutional.py", line 15, in
from keras.utils.conv_utils import normalize_data_format
ImportError: cannot import name 'normalize_data_format'

@JohnGiorgi
Copy link

Looks like this was brought up previously (#291) and is part of an open pull request (#292).

@maderafunk
Copy link

Will there be any new release anytime soon to make it compatible with the up-to-date keras version?

@oracle9i88
Copy link

Will there be any new release anytime soon to make it compatible with the up-to-date keras version?

+1

@oracle9i88
Copy link

keras 2.1.6

@apoorvadixit21
Copy link

I am facing the same issue.Though i have keras 2.1.6 installed. Not able to use keras_contrib
image

@apoorvadixit21
Copy link

image
if i import keras_contrib, this error comes in spyder and it tell me to do this "from keras.backend.common import normalize_data_format". But when i actually go for this facing the similar issue again.What to do

@keisen
Copy link
Contributor

keisen commented Sep 14, 2018

The currently keras-contrib has compatibility with keras2.2.1+,
then but incompatibility with before keras2.2.0.
So you have to update keras to 2.2.1+ or to downgrade keras-contrib to older than currently.

@maderafunk
Copy link

maderafunk commented Nov 9, 2018

@keisen Which is the last keras-contrib version that supports keras 2.2.0 and how can I install it? I don't find any relases in this repo. Current master seems to be 2.0.8. Thank you.

@world4jason
Copy link

world4jason commented Nov 14, 2018

same question here, how do i know which version of keras-contrib match keras 2.0.8?

@maderafunk
my keras version is 2.0.8, and here is my temporary solution
because keras.utils.conv_utils#normalize_data_format() already moved into keras.backend.common in new version of keras.
I just simply edited line 15 in the file "convolutional.py"

#from keras.backend.common import normalize_data_format
from keras.utils.conv_utils import normalize_data_format

that file might locate at "/usr/local/lib/python3.5/dist-packages/keras_contrib/layers/convolutional.py"
and this work for me

@keisen
Copy link
Contributor

keisen commented Nov 15, 2018

Hi, @maderafunk .
It might be 4d48c68 .
So please try below:

pip install git+https://github.com/keras-team/keras-contrib.git@4d48c687433c53a3495357e99cb059ede74e7f02 -U

If I made a mistake , sorry.

@maderafunk
Copy link

Thank you, that works @keisen .
Maybe it would make sense to have release tags updated with the keras version, to ensure compatibility?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants