Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an example to show feature extraction? #12

Closed
willard-yuan opened this issue Mar 30, 2015 · 3 comments
Closed

Is there an example to show feature extraction? #12

willard-yuan opened this issue Mar 30, 2015 · 3 comments

Comments

@willard-yuan
Copy link

Hi, fchollet,

After training the model using CNN, how to extract feature by the pre-trained model?

@fchollet
Copy link
Member

After training a model, you can get the weights for each layer by calling the .get_weights() method. The "weights" are the numerical values of the parameters of the layer, as a list of arrays.

all_weights = []
for layer in model.layers:
   w = layer.get_weights()
   all_weights.append(w)

You can then visualize these weights, or use them to initialize new layers (pass a "weights" argument to each layer). Check out the code itself for more detail, until there is a documentation available.

@willard-yuan
Copy link
Author

Thanks for your help.

@fatemaaa
Copy link

how can I save the features of the last fully connected layer (before the softmak layer) of the trained model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants