qubvel / classification_models

Classification models trained on ImageNet. Keras.
MIT License
1.22k stars 307 forks source link

Proper way to make it work on Google Colab #69

Open DanielMoreiraPinto opened 3 years ago

DanielMoreiraPinto commented 3 years ago

I'm trying to use ResNet18's weights in Google Colab, but the imports never match, every time it complains about a different module. I've been trying all version combinations of Keras, Tensorflow and related that I can find on the discussions, but none have worked so far. So I'll ask here directly for ways people have made this work on Colab.

ayhmdalila commented 3 years ago

Same here, if someone got it to work let me know

DanielMoreiraPinto commented 3 years ago

Same here, if someone got it to work let me know

Ah I finally got it working by installing by !pip install git+https://github.com/qubvel/classification_models.git

Then importing as from classification_models.tfkeras import Classifiers

And only using Tensorflow's modules, ex: Using from tensorflow.keras.models import Model, load_model, Sequential instead of from keras.models import Model, load_model, Sequential

ayhmdalila commented 3 years ago

Let me add you can try importing models from tfhub instead if it doesn't work for you