-
Notifications
You must be signed in to change notification settings - Fork 18.6k
visualization of the conv layer kernels #158
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
Conversation
Add TanH = hyperbolic tangent activation layer (popular for sparse autoencoders).
up when merging, I think)
Generalize architectures to arbitrary DAGs by split layers
remove test code (no longer needed and won't compile)
im2col and col2im learn to pad and padding layer is obsolete
note that pairs of params with the same layer name are the params & bias
That's great! Until now, we almost have everything that cuda-convnet provided and many more that it did not. Considering the work in #142, this is better placed in tools/extra and renamed to something like visualize_conv_layer.py. |
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.
Please take a look at the note about main function by @Yangqing in #107.
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.
Yes, please use a main function. Thank you.
Pinging @longjon who's been working on related things. |
Please rebase on the latest dev and file this in tools/extras or work it into the imagenet example at examples/imagenet for merge. Thanks! |
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.
We should probably import pyplot
(e.g., import matplotlib.pyplot as plt
) instead of pylab
, as the latter is really meant for interactive work (see http://matplotlib.org/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related).
It would be nice to follow the docstring convention of the existing Python code (i.e., omit the first blank line), and more generally to follow PEP8 / the Google Python style guide (e.g., stick to an 80 character line width). |
I'm also slightly concerned about reading the protobuf file using the Python protobuf wrapper -- even though it ought to be just as good as in C++, in practice it's slower, and can fail for very large files (including Alex-sized nets). So, I'd prefer if this code used pycaffe directly to read the net (i.e., by constructing a |
I second Jon's suggestions. |
I would like to point out my earlier visualization codes at decaf: https://github.com/UCB-ICSI-Vision-Group/decaf-release/blob/master/decaf/util/visualize.py which should have almost everything you need. A visualization in the decaf Yangqing On Wed, Feb 26, 2014 at 2:36 AM, Sergey Karayev [email protected]:
|
Thanks for the input everyone. I'll pep8-ify the code and move it to tools/extra. @Yangqing nice! I hadn't seen the decaf visualizations yet. @longjon have you had bigger problems with the python protobuf. For me everything worked smoothly so far. That is the imagenet model loaded really quickly and I didn't experience any crashes so far. |
Indeed, it's really slow for me. This is using protoc version 2.5.0. Do you see different behavior? In [1]: from caffe.proto import caffe_pb2
In [2]: net = caffe_pb2.NetParameter()
In [3]: with open('/u/vis/jonlong/alexnet_train_iter_470000') as f:
...: data = f.read()
...:
In [4]: %time net.ParseFromString(data)
CPU times: user 2min 55s, sys: 1.12 s, total: 2min 56s
Wall time: 2min 56s
In [5]: from caffe import pycaffe
In [6]: %time pycaffe.CaffeNet('/u/vis/jonlong/caffe/examples/imagenet_deploy.prototxt', '/u/vis/jonlong/alexnet_train_iter_470000')
CPU times: user 1.26 s, sys: 313 ms, total: 1.57 s
Wall time: 1.83 s
Out[6]: <caffe.pycaffe.CaffeNet at 0x63da680> |
I too have had terrible luck with python protobuf support. I recommend reading the params through the python net interface: |
Python protobuf is quite slow indeed, esp with large protobuf values. So There is a fast python protobuf (essentially wrapper around C) but you may Yangqing On Thu, Feb 27, 2014 at 4:09 PM, Evan Shelhamer [email protected]:
|
no worries. I'm looking forward to @longjon 's visualizations then. |
Use cuDNN routine FindEx to find the best algorithm.
This is basically an adopted version of the conv layer kernel visualization from: https://code.google.com/p/cuda-convnet/source/browse/trunk/shownet.py
Here's for example the first layer of the imagenet model, that's available for download:
