CovertLab/DeepCell

Bug: "from keras import initializations" is outdated

rcasero opened this issue · 2 comments

The line

from keras import initializations as initializations

in keras_version/cnn_functions.py produces the error

ImportError: cannot import name initializations

in recent versions of keras (e.g. 2.0.2), as reported here.

Solution for the import that doesn't interfere with current code proposed here

https://github.com/rcasero/DeepCell/commit/d91d2da0ea4ee40e97c2d09981cef57587842b24

following the idea in https://stackoverflow.com/questions/3496592/conditional-import-of-modules-in-python

(More in the code needs to be modified, wherever initializations is called).

Actually, a better way would be

if (parse_version(keras_version) < parse_version('2.0.0')):
    from keras import initializations as initializations
else:
    from keras import initializers as initializers