I have a train.prototxt
create with Python code and would like to remove the loss
layers to create the deploy.prototxt
automatically. However, I know only the method to remove a layer by an integer like this:
net_param = deploy_net.to_proto()
del net_param.layer[0]
Is there any possibility to remove a layer by its name? Where is the documentation for the Python API? I cannot really find it. Do I just have to look at the C++ code and try to convert it into Python code?
EDIT
I am initialising the net with.
net = caffe.NetSpec()
net.layer_dict
is a dictionary of all the layer. So to delete you can do:
del net.layer_dict['layer_name'];
You can look into pycaffe.py
for details of Python Api.