Added Net Templates to easy definition of Nets#1518
Conversation
a4aa1f1 to
76072c7
Compare
|
@longjon @shelhamer What do you think? |
|
@shelhamer @jeffdonahue @longjon do you know how to avoid time-out errors in Travis? |
|
Hi @sguada, thanks for your job on template layers. It's so useful for designing large network. But I found it inconvenient to fill all the variables in a template including those variables we want to keep their default values. So I make a python script to add missing variable support in expand_net based on your expand_net.cpp. Those missing variables will be omitted in the template after expanded (so that they keep their default values). See https://github.com/7hil/caffe/blob/py_template_layer/python/expand_net.py for more detail. |
|
@7hil it's nice to have a python version too, but could you maintain the same conventions for replacing variables. It is a good idea to remove missing variables, although it will be better that the template could define its own default values. |
|
@sguada I've removed the $${name} replacement and add basic default value support in template. |
76072c7 to
0036c42
Compare
|
Thanks for your code @7hil I added your |
|
The added Inception, aux_classifier and GoogleNet templates were used to generate the prototxt for GoogleNet in #1598 |
|
Great. |
|
@7hil I haven't added the support for defaults in the .cpp code, but if you want to add it, it will be great. |
|
I think Python net specification #1733 is a more general and concise means to generate networks. I'm not entirely comfortable with building in string processing for network definitions. I worry about the proliferation of templates too when the Python net specification can make use of whatever logic and modularity one might want. This alternative does require Python however. Is it alright to close this in favor of #1733? |
|
Closing since Python net specification was adopted instead. |
This PR is inspired by #1290 and the discussion there. This PR also reuse parts of the code done by @cypof.
Instead of modifying
Net.Init()this PR provides a new tool./build/tools/expand_netthat is able to expand templates and do the need string substitutions.Usage:
For some template examples look at `examples/templates/'