Comments (10)
@gloddream There definitely is, i just haven't figured out how yet. i've recently implemented the get_config()
method in both of the custom layers (L2Normalization and AnchorBoxes), so you should theoretically be able to load the model using
model = load_model('./model/ssd7_0.h5', custom_objects={'AnchorBoxes': AnchorBoxes, 'L2Normalization': L2Normalization, 'SSDLoss': SSDLoss})
but for some reason either model.save
or load_model
isn't able to use the dictionaries that get_config()
provides correctly. Since Keras documentation regarding saving and loading models with custom objects is basically non-existent and as far as I can tell I implemented the relevant methods in my layers exactly like the Keras core layers implement them, I didn't bother trying around any longer since I had other stuff to do. If you figure out how to make it work, let me know 🙂
from ssd_keras.
Instead of loading the model, build the model (by calling build_model()
) and then do model.load_weights()
instead.
from ssd_keras.
is there some way to use load_model('./model/ssd7_0.h5') ?
from ssd_keras.
In case it's still relevant for you guys, using load_model()
works now.
from ssd_keras.
Hi @pierluigiferrari ,
According to Official Keras Documentation here, now there is support for saving model's architecture + weights and optimizer state in a single HDF5 file.
So, is it possible to load full model into keras, without passing the custom_objects parameters
.
This way any custom trained model can be loaded to run predictions, without knowing custom objects to run predictions.
I did try to save one of you models into a single HDF5 file as mentioned in the documentation, but while loading I get an error ValueError: Unknown layer: L2Normalization
.
I understand this can be done by passing custom_objects, but is there way to load a model without doing that.
from ssd_keras.
@vinay0410 can you point me to that documentation?
from ssd_keras.
Hi @pierluigiferrari ,
Sorry I forgot to attach the link, I have updated my comment with the link.
https://keras.io/getting-started/faq/#how-can-i-save-a-keras-model
from ssd_keras.
@vinay0410 I'm afraid you're mixing things up. Saving a model saves its architecture, training configuration, etc., but you still need to provide any custom objects that the model requires when you load it. What you describe above is not possible and neither does the documentation that you link to suggest it is.
from ssd_keras.
Hi @pierluigiferrari ! I am so thankful for finding your repository! Great work!!
I know this issue is resolved. But I was trying to apply quantization(tensorflow model optimisation technique) to your repository and again encountered the AnchorBoxes issue. As an author of this repository, I thought you would be the best person to check the issue with. Any inputs from your end will be of great help.
I have detailed this on tensorflow model optimization issues page. Link here
from ssd_keras.
Hi @pierluigiferrari ! I am so thankful for finding your repository! Great work!!
I know this issue is resolved. But I was trying to apply quantization(tensorflow model optimisation technique) to your repository and again encountered the AnchorBoxes issue. As an author of this repository, I thought you would be the best person to check the issue with. Any inputs from your end will be of great help.
I have detailed this on tensorflow model optimization issues page. Link here
The above mentioned problem is now resolved under tensorflow/model-optimization#620.
All thanks to @Hackerman28 !! 😄
from ssd_keras.
Related Issues (20)
- InvalidArgumentError when compiling model with ssd_loss HOT 1
- WARNING:tensorflow:Gradients do not exist for variables ['conv4_3/bias:0',...] when minimizing the loss. HOT 1
- "Invalid argument: Index out of range using input dim 0; input has only 0 dims" during ssd300 model training
- load weight
- ValueError: Error when checking input: expected input_3 to have 4 dimensions, but got array with shape
- While training I got training terminate error . Epoch 00001: LearningRateScheduler setting learning rate to 0.001. 1/10 [==>...........................] - ETA: 4:08 - loss: nanBatch 0: Invalid loss, terminating training Epoch 00001: saving model to ssd512_URPC2018_epoch-01.h5 Process finished with exit code 0
- ValueError: An operation has `None` for gradient. Please make sure that all of your ops have a gradient defined (i.e. are differentiable). Common ops without gradient: K.argmax, K.round, K.eval.
- ValueError: Layer model expects 1 input(s), but it received 2 input tensors. Inputs received: [<tf.Tensor 'IteratorGetNext:0' shape=(None, None, None, None) dtype=uint8>, <tf.Tensor 'IteratorGetNext:1' shape=(None, None, None) dtype=float32>] HOT 23
- Parameters of the model HOT 1
- Bouding boxes predictions are concentrated in left top corner HOT 1
- Ambiguous dimension while trying to load weights.
- Urgent!! Invalid Loss HOT 4
- What are the requirements to run this code?. HOT 1
- Pascal VOC Training Person Detection
- The device being used is CPU while capturing image from webcam. How do I use my GPU for processing instead?
- Label error during Coco Training HOT 1
- TypeError: Expected any non-tensor type, got a tensor instead.
- Changes make the code work in 2023 HOT 2
- custom SSD300 model
- error while training with custom dataset in COCO format
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 ssd_keras.