Closed mazatov closed 5 years ago
Duplicate of #79 pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-applications
As I mentioned in the post, I already did that and got the error after the install. Also, I don't get the error during the import of the resnet. I only get the error when I create the model.
Duplicate of #79
pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-applications
@mazatov, Can you share the error message for from keras_applications import resnet
?
@taehoonlee, that's the weird part. I do NOT get an error for import part. Check the code in my first comment. I only get an error when creating the model.
@mazatov, I need from keras_applications import resnet
NOT from keras.applications import resnet
.
Sorry!
Here's the error:
from keras_applications import resnet
Traceback (most recent call last):
File "<ipython-input-26-4d556de68345>", line 1, in <module>
from keras_applications import resnet
ImportError: cannot import name 'resnet'
Then, maybe your keras-app is not the bleeding edge. Please make sure pip install -U git+https://github.com/keras-team/keras-applications
,
@mazatov The problem is that you did not install the bleeding edge. Maybe you have multiple python versions. pip3
instead of pip
might fix your problem.
Thanks, everybody! After uninstalling and installing everything a few times I got it to work. Not sure what was the issue, but it seems to work now.
Hello ! I use keras 2.2.4. I have the same issue, does anyone have the solution.
Hello ! I use keras 2.2.4. I have the same issue, does anyone have the solution.
I'm having same issue. Tried Google Colab and Kaggle Kernels - same result:
ImportError: cannot import name 'resnet
You should do pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-applications
and then from keras_applications import <what_you_need>
. So i solved this problem like that
I'm having same issue, i've install pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-applications but found error. here is the error
!pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-application
Collecting git+https://github.com/keras-team/keras Cloning https://github.com/keras-team/keras to c:\users\lenovo\appdata\local\temp\pip-req-build-54p30x38
Error [WinError 2] The system cannot find the file specified while executing command git clone -q https://github.com/keras-team/keras C:\Users\LENOVO\AppData\Local\Temp\pip-req-build-54p30x38 Cannot find command 'git' - do you have 'git' installed and in your PATH?
thanks for any helps :D
@DarkDetectiv, It doesn't seem to be a Keras issue. The error message is Cannot find command 'git' - do you have 'git' installed and in your PATH?
. You should install git
first.
For people who come in late, lates keras docs have the folllowing ResNet models:
keras.applications.resnet.ResNet50(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
keras.applications.resnet.ResNet101(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
keras.applications.resnet.ResNet152(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
keras.applications.resnet_v2.ResNet50V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
keras.applications.resnet_v2.ResNet101V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
keras.applications.resnet_v2.ResNet152V2(include_top=True, weights='imagenet', input_tensor=None, input_shape=None, pooling=None, classes=1000)
This means to import the models (lets say ResNet50), one has to do the following:
from keras.applications.resnet50 import ResNet50
model = ResNet50(weights='imagenet') etc
Source:Keras Docs
Use this one
from keras.applications.resnet import ResNet101
or u can import another version of resnet according to your selection
from keras.applications.resnet50 import ResNet50
I updated Keras to the latest version with
pip install -U git+https://github.com/keras-team/keras git+https://github.com/keras-team/keras-applications
I can now load the new ResNet libraries like ResNet101 or ResNet152, but I cannot create a model with them yet. I'm guessing I am forgetting something trivial but I've been cracking my head on this for 2 days and cannot figure it out. Any help would be appreciated!!
Thanks