-
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
Feature extraction, feature binarization and image retrieval examples #161
Conversation
Why |
There is a GetLayer in src/caffe/layer_factory.cpp which I do not want the users to be confused with the added one. We are following the Google C++ style guide in particular the consistency and uniformity requirements excerpted from the background section of it. "One way in which we keep the code base manageable is by enforcing consistency. It is very important that any programmer be able to look at another's code and quickly understand it. Maintaining a uniform style and following conventions means that we can more easily use "pattern-matching" to infer what various symbols are and what invariants are true about them. Creating common, required idioms and patterns makes code much easier to understand. In some cases there might be good arguments for changing certain style rules, but we nonetheless keep things as they are in order to preserve consistency." |
Please rebase to fit the new dir arrangement so we can move this along. This'll be a nice example to include. |
Indeed, consistency comes first. My suggestion is to use lowercase names for the getter-like methods, as this is already done for existing getters, like |
@longjon, your suggestion on neat and consistent naming is adopted in dd97ce0. Thanks! |
Rebased for code review. |
In demo_extract-features.cpp, every time I run the code, the process stopped at line 123 "data_layer.Forward(bottom_vec_that_data_layer_does_not_need_, &top_vec);" Could you give a example command to run this demo? Still in demo_extract_features.cpp, line 103 "if (num_layer = data_net_param.layers_size()) ", should it be "if (num_layer == data_net_param.layers_size()) " ? Thanks |
@palmforest, thanks for testing the code! You must be using an older version of the PR. Please pull again to update. demo_extract_features.cpp is now renamed to be extract_features.cpp and moved to the tools directory. I gave up using an independent data layer to pass data into the network extracting features and there is no longer data_net_param. The most recent version expects that the network contains a data layer. I opened a new PR #196 to pass data into the network from memory. |
Hi @kloudkl, I downloaded the simple-feature-extraction version to try with Could you help to see what's the problem is? [palm@GPU01]$ LOG_logtostderr=1 build/tools/extract_features.bin On Tue, Mar 11, 2014 at 11:30 PM, kloudkl [email protected] wrote:
|
This happens after #128. The problem should be fixed by #170. Before that, please train new models by yourself. |
@palmforest you don't need to train new models yourself (as @kloudkl) suggested, you can just edit the prototxt files and remove the padding layers, and add the corresponding pad to the convolutional layer. At some point we will have an automatic fixer #170 For example
Becames
|
I followed sguada's instruction to modify the prototxt. The model can be Do you know how to fix this? I0313 17:55:09.560662 20043 net.cpp:120] Top shape: 1000 1 1 On Wed, Mar 12, 2014 at 11:47 PM, Sergio Guadarrama <
|
@kloudkl, could you additionally provide a documented example of using this (something in the examples/ folder, such as an iPython notebook) |
(To be clear, I don't suggest using the Python interface. A simple text/markdown file demonstrating running your tool will suffice -- this can go into docs/). |
Ok, I will add a doc to show how to run the code with the pre-trained reference model. |
@palmforest, the problem that you described was not met with when extracting features with the caffe_reference_imagenet_model using the steps documented in docs/feature_extraction.md. Would you like to try again to see if the doc helps? @sergeyk, do you think the documentation appropriate? |
echo "Downloading..." | ||
|
||
wget -q https://www.dropbox.com/s/n3jups0gr7uj0dv/caffe_reference_imagenet_model | ||
wget -q https://www.dropbox.com/s/n3jups0gr7uj0dv/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.dropbox.com/s/n3jups0gr7uj0dv/$MODEL
rather than zero in the feature binarization example
I will review now. |
Looks good enough for me. Upon merge (forthcoming, blocked by Evan's request to wait until some fix he is pushing), I will immediately push a commit to
@kloudkl, it would be good if you contributed, in a separate PR, a section of the doc that shows how the stored feature is accessed from some other script or directly in leveldb. |
Feature extraction, feature binarization and image retrieval examples
A workflow suggestion: instead of hitting the merge button then trying to commit and push before anyone else, you could check out this PR's branch and merge locally, then commit on top of it and push it all at once to Do whatever works for you though! |
When I follow the steps and tried to run the feature extraction, I got an error saying: build/tools/extract_features.bin models/caffe_reference_imagenet_model examples/images/imagenet_val.prototxt fc7 examples/feature_extraction/features 10 Would anyone have any idea what is causing this? Many thanks! |
The error message suggests that the leveldb exists and you can delete it with
|
Hi, sorry I am pretty confused....I am saving the leveldb file created to a different file now, but still getting the same error... build/tools/extract_features.bin models/caffe_reference_imagenet_model examples/images/imagenet_val.prototxt fc7 ./save 10 Segmentation fault (core dumped) Thanks! Hmmm ok I think there's something wrong with the data format I feed into the network..I've got an error message like this Check failed: target_blobs[j]->width() == source_layer.blobs(j).width() (576 vs. 1024) |
You need to create the leveldb before calling this function. Sergio 2014-04-07 7:09 GMT-07:00 ttt_x [email protected]:
|
Feature extraction, feature binarization and image retrieval examples
Explicit class mapping in DetectNet
This pull request is reopened(#141) to target the dev branch. It serves for two purposes.
First, Extracting data from a specific blob or layer by number index is very inconvenient. To satisfy the strong requirements of easy feature extraction, Has/Get Blob/Layer methods are added to simplify feature extraction. CAFFE represents Convolution Architecture For Feature Extraction. So let's have a feature extraction example.
Second, the very natural next step is to apply the extracted features in practical applications, e.g. image retrieval. Image retrieval is fastest when using binary features. But putting all the steps of a complete pipeline in an example is too complex. Thus a feature separate feature binarization example is split out.
The pipeline consisting of feature extraction, binarization and similarity searching has been tested to work well on the mnist prototxt and leveldb.
Related issues:
#20: Extract the middle features
#112: pythonic export of features and params for wrapper
#139: About dump_network.cpp