Comments (2)
@pgenevski, Keras-applications and TF-hub have different usages.
- Keras has its default session, and the keras model is created and initialized on the default session in your codes. Thus, once you create another session and work on the session, you must lose the pretrained weights. The keras's results are from random initialization.
- TF-Hub is not coupled with the default session, and defining
global_variables_initializer
as a loader of pretrained weights. Thus, you can get the same results on every newly created session in your codes, because the results are computed with pretrained weights.
from keras-applications.
Thank you! Indeed it turned out that Keras would load the weights into its own session as soon as the model is instantiated. A possible workaround is to instantiate the tf session first, set it explicitly on the Keras backend and then use the model as a tensor in the tf graph (as specified in the functional Keras API).
I have updated the notebook to reflect this approach.
As a side note, although it works, IMHO it would have been cleaner if Keras used tf variable initializers instead of eagerly materializing the model weights upon creation.
from keras-applications.
Related Issues (20)
- [Requested Queries]: Adding features in keras-application for Object Detection API!
- ValueError: Unable to create group (name already exists)` when saving MobilenetV3 model to .h5 HOT 2
- AttributeError: Can't Import EfficientNet! HOT 1
- Model not accepting same input shape image defined in input layer. HOT 2
- Settings used for ImageNet pre-training
- Imagenet pretrained weights not match the current implementation of ResNext, thanks HOT 2
- InceptionResnetV2 summary() seems to be another network as it does not look like the one in the paper. HOT 1
- [Request] Adding Vision Transformer (ViT) in Keras
- Efficientnet's BASE_WEIGHTS_PATH points to external release
- shufflenet v2
- The drop connect rate (aka survival rate) is incorrect HOT 9
- Missing one conv2d layer in inceptionv3?
- AutoGraph could not transform model.make_predict_function ... and run it as-is.
- problem with loading keras model
- How to create ResNetD?
- Will keras applications keep update?
- Obtained baseline accuracy for ResNet50v2 is different than officially reported HOT 4
- NASNetLarge input shape error
- Keras MobileNetv2 image normalization
- There is a bug using GPU in MobileNetV3Small
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras-applications.