6.1. Freeze a model
The trained neural network is extracted from a checkpoint and dumped into a protobuf(.pb) file. This process is called “freezing” a model. The idea and part of our code are from Morgan. To freeze a model, typically one does
$ dp freeze -o model.pb
in the folder where the model is trained. The output model is called model.pb.
$ dp --pt freeze -o model.pth
in the folder where the model is trained. The output model is called model.pth.
In multi-task mode:
This process will in default output several models, each of which contains the common descriptor and one of the user-defined fitting nets in fitting_net_dict, let’s name it
fitting_key, together frozen ingraph_{fitting_key}.pb. Those frozen models are exactly the same as single-task output with fitting netfitting_key.If you add
--united-modeloption in this situation, the total multi-task model will be frozen into one unitgraph.pb, which is mainly for multi-task initialization and can not be used directly for inference.