-
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
Update Python interface, using OrderedDict for blobs and layers #199
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit should not break any code which does not refer explicitly to caffe.pycaffe.
This commit restores caffe.pycaffe as Python code that wraps caffe._caffe. It also renames caffe.CaffeNet as the less-redundant caffe.Net.
For now, only layer names and blobs are accessible, but more functionality (layer Forward and Backward) could be added later.
Even though these are redundant, this keeps the meaning of CaffeBlob.name consistent for now, and will allow CaffeBlob construction to be simplified.
This prevents accidental construction of partially-specified blobs, which could break the Python layer.
Per offline discussion with @shelhamer, the naming has been cleaned up (and is ready for review and merge). The interface exposes:
|
shelhamer
added a commit
that referenced
this pull request
Mar 18, 2014
Update Python interface, using OrderedDict for blobs and layers to expose activations, params, and diffs.
Thanks @longjon! This is a marked improvement to the interface. |
Merged
mitmul
pushed a commit
to mitmul/caffe
that referenced
this pull request
Sep 30, 2014
Update Python interface, using OrderedDict for blobs and layers to expose activations, params, and diffs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit modifies the pycaffe interface to use OrderedDict in place of lists for blobs and layers, per the discussion in #112. Some notes:
There are four ways this could have been accomplished:
This PR uses the third method. The first is a headache, and it may be useful to add more pure-Python functionality anyway. The second requires explicit wrappers for every method exposed via boost. The fourth makes the code a little less obvious and more mind-bending.
caffe.CaffeNet
was renamedcaffe.Net
Net.blobs
was made an OrderedDictLayers are now exposed as an OrderedDict (which really just provides groups of parameter blobs). Note that layer parameter blobs don't have names in caffe proper, only layers have names, so
Net.params
was kept as a list, as it is in C++.This code should probably be updated to use Feature extraction, feature binarization and image retrieval examples #161 if/when that is merged.
You'll need to
make clean
before building this.