Run the following command to attempt to recover the accuracy loss from pruning:
$ ./vai_p_caffe finetune -config config.prototxt
Finetuning a pruned model is essentially the same as training the model from scratch. The solver parameters such as initial learning rate, learning rate decay type, etc. may be different. A pruning iteration is composed of the prune and finetune tasks executed sequentially. In general, to achieve a greater weight reduction without significant accuracy loss, several pruning iterations need to be performed.
The configuration file needs to be modified after every pruning iteration
- Increase the rate parameter relative to the baseline model.
- Modify the weights parameter to the best model obtained in the previous finetuning step.
A modified configuration file is shown below:
workspace: "examples/decent_p/"
gpu: "0,1,2,3"
test_iter: 100
acc_name: "top-1"
model: "examples/decent_p/float.prototxt"
#weights: "examples/decent_p/float.caffemodel"
weights: "examples/decent_p/regular_rate_0.1/_iter_10000.caffemodel"
solver: "examples/decent_p/solver.prototxt"
# change rate from 0.1 to 0.2
#rate: 0.1
rate: 0.2
pruner {
method: REGULAR
}