BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.11k stars 18.7k forks source link

draw net doesn't understand net phases #4365

Closed cdoersch closed 8 years ago

cdoersch commented 8 years ago

For some networks, especially Variational Autoencoders, there can be significant differences between the training-time network and the testing-time network. Hence, I propose that we add a "phase" flag to caffe.draw.draw_net which, if specified by the user, makes the function ignore any layers that belong to the wrong phase. This would make the drawn network much more understandable. My guess is that this change would only require about a dozen lines of code.

If the Caffe devs agree, I can write a PR. I'd appreciate a quick response since I'd like to include this with my tutorial on variational autoencoders.

lukeyeager commented 8 years ago

While you're at it, why not add support for phase, level and stages? https://github.com/BVLC/caffe/pull/3863 https://github.com/BVLC/caffe/pull/4174

cdoersch commented 8 years ago

Sounds like this would make the PR more complicated, although I don't think I would actually need to rely on #3863 or #4174 to make it work. draw_net worked directly with the protocol buffer that defines the net structure, not with a caffe net. I'm not familiar with levels and stages. Would the interface just take in two extra parameters--stage and level--and if they're defined, do a simple equality test for any layers that have either of those two parameters defined? Or is there more complexity in determining whether a layer is included in the net?

lukeyeager commented 8 years ago

Yeah it's not simple. See the functions I added in #4174 to mirror StateMeetsRule.

Honestly, I wouldn't worry about it for your PR. The @BVLC guys don't seem particularly eager to merge #3863, so I can't imagine they'd care about other netstate options for your "draw net" PR.

shelhamer commented 8 years ago

Fixed in #4408.