Train using predefined weights in Python
LordSputnik opened this issue · 1 comments
LordSputnik commented
Is there a particular reason why it isn't possible at the moment to use the Solver in Python to start from a pretrained network? As far as I can tell (and I don't have much experience with caffe, so I may be completely wrong), it would just be a case of creating a new constructor:
PySGDSolver::PySGDSolver(const string& param_file, const string& pretrained_param_file) {
// as in PyNet, (as a convenience, not a guarantee), create a Python
// exception if param_file can't be opened
CheckFile(param_file);
solver_.reset(new SGDSolver<float>(param_file));
// we need to explicitly store the net wrapper, rather than constructing
// it on the fly, so that it can hold references to Python objects
net_.reset(new PyNet(solver_->net()));
solver_->net()->CopyTrainedLayersFrom(pretrained_param_file);
}