-
Notifications
You must be signed in to change notification settings - Fork 235
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
Added support for import/export of Python layer #78
Conversation
Conflicts: ide/static/bundle/bundle.js
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.
Also add test cases for this layer (and all new layers that we add hereon)
caffe_app/views/import_prototxt.py
Outdated
if (layer.loss_weight): | ||
params['loss_weight'] = layer.loss_weight[0] | ||
if (not layer.bottom): | ||
params['endPoint'] = '1, 0' |
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.
This is not very clear. Please add a comment explaining this convention.
if (layer.python_param.layer): | ||
params['layer'] = layer.python_param.layer | ||
if (layer.python_param.param_str): | ||
params.update(eval(layer.python_param.param_str)) |
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.
Why the update
? (just curious)
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.
update
adds all keys from that dictionary as keys to the params
dictionary.
ide/static/css/style.css
Outdated
@@ -274,6 +274,11 @@ button.close { | |||
margin-right:-10px; | |||
} | |||
|
|||
#Python { |
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.
Try to name this something more meaningful?
ide/static/js/netLayout_vertical.js
Outdated
@@ -69,6 +69,12 @@ let i = null, layerId = null, parentId = null, inputLength = null, outputLength | |||
const dataLayers = ['ImageData', 'Data', 'HDF5Data', 'Input', 'WindowData', 'MemoryData', 'DummyData']; | |||
// finding the input layers to start DFS | |||
Object.keys(net).forEach(layerId => { | |||
if (net[layerId].info.type == 'Python'){ | |||
if (net[layerId].params.endPoint == "1, 0"){ |
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.
Comment what "1, 0" is? In general please explain such hardcoded conventions whenever used && not obvious.
ide/utils/jsonToPrototxt.py
Outdated
hasParamStr = True | ||
if 'param_str' not in python_param.keys(): | ||
python_param['param_str'] = {} | ||
if isinstance(layerParams[param], str) and ',' in layerParams[param]: |
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.
The second condition in this if
is pretty hacky. Please fix. You might want to use a better convention throughout rather than the "1, 0", "0, 1" etc. if it doesn't break anything else.
params['endPoint'] = '1, 1' | ||
for param in params: | ||
if isinstance(params[param], list): | ||
params[param] = str(params[param])[1:-1] |
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.
What does this slicing do?
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.
After converting the array
to str
, [1:-1]
will remove the brackets.
Changes Unknown when pulling f3aeef8 on utsavgarg:python into ** on Cloud-CV:master**. |
Allows to import and export any custom Python layer