Giter Club home page Giter Club logo

Comments (5)

titu1994 avatar titu1994 commented on August 19, 2024 1

Turns out I made an error when saving the weights for the "No Top" models. I have updated new weights, which should work. However, you will need to delete the local copy stored at ~/.keras/models/NASNet***.h5

from keras-nasnet.

ivo-leonov avatar ivo-leonov commented on August 19, 2024

Hey, thanks a lot!
I was having the same issue and was trying to remove the top myself, but it didn't work. For the sake of curiosity, could you please explain how you removed the top?
I tried the following:

  • load weights with top
  • remove the last three layers on top using pop():
for i in range(0, 3):
    base_model.layers.pop()
    base_model.outputs = [base_model.layers[-1].output]
    base_model.layers[-1].outbound_nodes = []

But it didn't work when I attached a new avg-pool and a softmax.

from keras-nasnet.

titu1994 avatar titu1994 commented on August 19, 2024

It wasn't actually an error with the model itself, but the weight file. When I was creating the no top models, I deleted the extra layers manually, but forgot to update the layer_names property in the weight file.

So even though the weight files didnt contain those weights anymore, it attempted to load them causing the error.

I fixed them by saving the weights properly this time.

from keras-nasnet.

titu1994 avatar titu1994 commented on August 19, 2024

To remove the top, I simply don't add the extra classification layers when building the model. For Models in Keras, you can't apply pop operations.

from keras-nasnet.

ivo-leonov avatar ivo-leonov commented on August 19, 2024

Okay, so how do I edit a weight file to remove the top from the weights? It would be awesome if you could explain that. Thanks!

from keras-nasnet.

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.