Git Product home page Git Product logo

Comments (10)

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024 3

@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.

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

Instead of loading the model, build the model (by calling build_model()) and then do model.load_weights() instead.

from ssd_keras.

gloddream avatar gloddream commented on May 24, 2024

is there some way to use load_model('./model/ssd7_0.h5') ?

from ssd_keras.

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

In case it's still relevant for you guys, using load_model() works now.

from ssd_keras.

vinay0410 avatar vinay0410 commented on May 24, 2024

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.

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

@vinay0410 can you point me to that documentation?

from ssd_keras.

vinay0410 avatar vinay0410 commented on May 24, 2024

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.

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

@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.

sachinkmohan avatar sachinkmohan commented on May 24, 2024

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.

sachinkmohan avatar sachinkmohan commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.