4.1.1.9. Other Dev Tools (Optional)¶
This section introduces those dev tools that are not involved in the regular process described above. These dev tools have their own particular applications and please apply where appropriate.
4.1.1.9.1. Pack Multiple Bin Models into One File¶
The hb_pack model packing tool provides the ability to pack multiple bin models into one file.
During the application development stage, D-Robotics provides the packed models relevant interfaces for users to deal with those application scenarios with multiple models.
Refer to the following command-line of the hb_pack tool:
hb_pack -o dst_name.bin to_pack_1.bin to_pack_2.bin
Specify the packed filename using the -o parameter.
Add the bin models your want to pack up at the end of the command and use space to separate the models.
4.1.1.9.2. View Model Information¶
The hb_model_info model information viewing tool provides the ability to view the model’s configuration parameters at the model conversion stage. Refer to the following command-line:
hb_model_info model_name.bin
Add model name behind the hb_model_info command. If you want to use packed models, remember to add the -p parameter after the hb_model_info command.
This tool should print some conversion environment information and your specified configuration parameters in model conversion.
Please refer to the Convert The Model Using The hb_mapper makertbin Tool .
4.1.1.9.3. Modify the Nodes of Bin Models¶
To pursue ultimate performance in those scenarios with enormous input size,
the quantization and conversion of some input can be fused into data pre-processing.
In such cases, use the hb_model_modifier tool to remove these
nodes(Current nodes that are supported for removal by this tool include: Transpose, Quantize, Cast, and Reshape nodes on the input side and Transpose, Dequantize, DequantizeFilter, Cast, Reshape, and Softmax nodes on the output side of the specified runtime model).
Refer to the following command-line:
hb_model_modifier bin_file -r {node_name}
Use the -r parameter to specify the name of the node to be deleted.
Use the -o parameter to specify specify the name of the new model file that will be generated after the node is deleted.
Use the -a/--all parameter to specify the node type. It supports deleting all corresponding types with one click. If there are multiple types of the nodes to be deleted, you need to specify multiple times.
The name of the node to be deleted must be exactly the same as the name in the bin model, and only one node can be deleted per tool call. The node names can be viewed in the Bin Model Structure described in the Use The hb_perf Tool To Evaluate Model Performance section.
Attention
Deleting nodes may change the model input and output information, you can check the deleted nodes information by hb_model_info tool, the name of the deleted nodes will be printed at the end of the output information.
At the same time, a deleted_nodes_info.txt file is generated, in which each line records the initial information of the corresponding deleted nodes, which can be used to implement quantization/anti-quantization and other processing logic.