Once the ana
command has executed successfully,
you can start pruning the model. The command prune
is
very similar to command ana
, which requires the same
configuration file:
vai_p_tensorflow \
--action=prune \
--input_graph=inference_graph.pbtxt \
--input_ckpt=model.ckpt \
--output_graph=sparse_graph.pbtxt \
--output_ckpt=sparse.ckpt \
--workspace=/home/deephi/tf_models/research/slim \
--sparsity=0.1 \
--exclude="conv node names that should be excluded from pruning" \
--output_nodes="output node names of the network"
There is one new argument in this command:
- --sparsity
- The sparsity of network after pruning. It has a value between 0 and 1. The larger the value, the sparser the model is after pruning.
After the prune
command executes, the vai_p_tensorflow
command outputs the number of FLOPs
(floating-point operations) used by the network before and after pruning.