Caffe: API: expose SolverParameter in python

Created on 14 Jul 2015  ·  6Comments  ·  Source: BVLC/caffe

How feasible would it be to expose SolverParameters in the Python API, so that it would be possible to create Solver instance without needing a prototxt file?

Python enhancement

All 6 comments

You can almost do this already. Create a SolverParameter (caffe.proto.caffe_pb2.SolverParameter) instance in Python, fill in its attributes, convert it to prototxt (google.protobuf.text_format.MessageToString()), save it to a temporary file, and use the filename to create a Solver.

Nice--thanks @seanbell.

See also: #2686

The full solver with parameters is already exposed in the OpenCL branch. It's really convenient for multistage training, as parameters can easily be changed and the solver re-instantiated. If needed, this could just be pulled over to the Master branch.
This example shows how to use it: https://github.com/naibaf7/opencl_caffe_examples/blob/master/celsius_farenheit/celsius_farenheit.ipynb

@naibaf7 I think that would be great.

The SolverParameter wrapper and direct instantiation of the solver in @naibaf7's example is more concise than the protobuf approach in https://github.com/BVLC/caffe/blob/master/examples/02-fine-tuning.ipynb for example. I'd welcome it in master.

Was this page helpful?
0 / 5 - 0 ratings