-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Extract the middle features #20
Comments
I know there is a dump_network cpp file, how I can use it in Python, thanks for answering! |
I need a tutorial of how to extract features too. Thanks for answering! |
Extracting the full network through the python wrapper will be added by pull request #11 which we hope to merge soon. |
The network blobs and parameters are now exposed through the python wrapper by the merge of #11 . |
Can anyone provide an example of how to extract the feature of a specific layer in python? In DECAF, for example, if I want to get the feature in layer 6, I use this: |
You can access the features computed in any layer through net.Forward(input_blobs, output_blobs) # do forward pass to compute features
output = net.blobs()[-1].data # = numpy ndarray of the output blob data
midlevel = net.blobs()[10].data # = numpy ndarray of the 11th blob data This will be more polished with #112 to allow indexing by layer name like in DeCAF. Once the wrapper matures a little a demo notebook will be added. |
As of v0.99 the new python wrapper is in master. You can access the features computed in any layer through net.Forward(input_blobs, output_blobs) # do forward pass to compute features
conv2 = net.blobs['conv2'].data # = numpy ndarray of the conv2 layer
fc7 = net.blobs['fc7'].data # = numpy ndarray of the fc7 layer |
Hi, whats the matlab alternative to this? I am trying to get the features on matlab, but get weights seems to be giving the weights alone and a forward pass is giving the final layer predictions. Can I get the intermediate features? |
You can modify the prototxt and remove the top layers to get middle Sergio 2014-04-20 7:41 GMT-07:00 Sharath Chandra Guntuku notifications@github.com
|
Exposing all the blobs in MATLAB as they are in python would make a good pull request! |
Just wanted to confirm, the layer DECAF6 mentioned in experiments of the paper: DeCAF: A Deep Convolutional Activation Feature for Generic Visual Recognition is referring to fc6 after relu and dropout has been applied right? Or it is without the relu/dropout? |
I think layer fc6 should be after layer ReLU and Dropout because there are no negative values. But the log data shows (so somewhat confusing for me too): In addition, I have two related questions: (1) How can we get the features before the application of ReLU. When I use another deep learning package (Overfeat), it seems that I can have much better classification accuracy if I use the layer before ReLU in Overfeat. (2) Should the output from layer Dropout be different every time when I run the feature extraction (or it is different only when running the training function instead of feature extraction)? Is there a way to get different Dropout output if I just run the feature extraction function? |
@junwang4 I think the answers to your questions are as follows:
So DECAF6 is relu activations after fc6 right? It'd be great if @Yangqing or @jeffdonahue (as they're the authors of the paper) could confirm this. Thanks :) |
Thanks, Sharath! I will give it a try regarding your suggestions of removing the layers relu and dropout after fc6. As to Overfeat, I got the idea of using the layer before relu from: http://fastml.com/yesterday-a-kaggler-today-a-kaggle-master-a-wrap-up-of-the-cats-and-dogs-competition/ [ UPDATE ] |
This is now possible. I was searching on how to do this and I managed by executing the following command: |
Hi guys,
Ask a basic question, how I can extract a middle neural network( e.g. the 8th fully connected neural network) as the feature vector (dimension :1000) efficiently.Is there a simple calling function ?
Many thanks.
The text was updated successfully, but these errors were encountered: