Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'Layer' from 'keras.layers.core' #24

Open
furkansherwani opened this issue Aug 24, 2020 · 1 comment
Open

Comments

@furkansherwani
Copy link

C:\Users\Furkan\PycharmProjects\mlnet-master\venv\Scripts\python.exe C:/Users/Furkan/PycharmProjects/mlnet-master/main.py
2020-08-24 16:56:02.256203: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-08-24 16:56:02.263070: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "C:/Users/Furkan/PycharmProjects/mlnet-master/main.py", line 8, in
from model import ml_net_model, loss
File "C:\Users\Furkan\PycharmProjects\mlnet-master\model.py", line 9, in
from eltwise_product import EltWiseProduct
File "C:\Users\Furkan\PycharmProjects\mlnet-master\eltwise_product.py", line 1, in
from keras.layers.core import Layer, InputSpec
ImportError: cannot import name 'Layer' from 'keras.layers.core' (C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\layers\core.py)

Process finished with exit code 1

@furkansherwani
Copy link
Author

I fixed this error by installing previous version of Keras and Tensorflow. Then I downloaded new weights file. Edited keras.json. Now I am getting this error:

C:\Users\Furkan\PycharmProjects\mlnet-master\venv\Scripts\python.exe C:/Users/Furkan/PycharmProjects/mlnet-master/main.py
Using Theano backend.
WARNING (theano.configdefaults): g++ not available, if using conda: conda install m2w64-toolchain
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\backend\theano_backend.py:1282: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'.
mode='max')
C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\backend\theano_backend.py:1282: UserWarning: DEPRECATION: the 'st' parameter is not going to exist anymore as it is going to be replaced by the parameter 'stride'.
mode='max')
C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\backend\theano_backend.py:1282: UserWarning: DEPRECATION: the 'padding' parameter is not going to exist anymore as it is going to be replaced by the parameter 'pad'.
mode='max')
(None, 3, 480, 640) (None, 3, 480, 640)
(None, 3, 480, 640) (None, 64, 480, 640)
(None, 64, 480, 640) (None, 64, 480, 640)
(None, 64, 480, 640) (None, 64, 240, 320)
(None, 64, 240, 320) (None, 128, 240, 320)
(None, 128, 240, 320) (None, 128, 240, 320)
(None, 128, 240, 320) (None, 128, 120, 160)
(None, 128, 120, 160) (None, 256, 120, 160)
(None, 256, 120, 160) (None, 256, 120, 160)
(None, 256, 120, 160) (None, 256, 120, 160)
(None, 256, 120, 160) (None, 256, 60, 80)
(None, 256, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
(None, 512, 60, 80) (None, 512, 60, 80)
[(None, 256, 60, 80), (None, 512, 60, 80), (None, 512, 60, 80)] (None, 1280, 60, 80)
(None, 1280, 60, 80) (None, 1280, 60, 80)
(None, 1280, 60, 80) (None, 64, 60, 80)
(None, 64, 60, 80) (None, 1, 60, 80)
(None, 1, 60, 80) (None, 1, 60, 80)
(None, 1, 60, 80) (None, 1, 60, 80)
Compile ML-Net Model
Traceback (most recent call last):
File "C:/Users/Furkan/PycharmProjects/mlnet-master/main.py", line 48, in
model.compile(sgd, loss)
File "C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\engine\training.py", line 683, in compile
self._collected_trainable_weights = collect_trainable_weights(self)
File "C:\Users\Furkan\PycharmProjects\mlnet-master\venv\lib\site-packages\keras\engine\training.py", line 258, in collect_trainable_weights
weights.sort(key=lambda x: x.name)
TypeError: '<' not supported between instances of 'NoneType' and 'str'

Process finished with exit code 1

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

No branches or pull requests

1 participant