Starting Pruning Loop - Starting Pruning Loop - 1.1 English - UG1333

AI Optimizer User Guide (UG1333)

Document_ID
UG1333
Release_Date
2020-07-07
Version
1.1 English

Once the command ana has ended, you can start pruning the model. The command prune is very similar to command ana, requiring the same config 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 excluded from pruning" \
  --output_nodes="output node names of the network"

There is one new arguments in this command:

--sparsity
The sparsity of network after pruning. The larger the value, the sparser the model is after pruning.

When the prune command finishes, the vai_p_tensorflow outputs FLOPs of network before and after pruning.