hb_model_info工具

hb_model_info 是用于解析*.hbm和*.bc编译时的依赖及参数信息、*.onnx模型基本信息,同时支持对*.bc可删除节点进行查询的工具,可通过启动webserver以查看模型结构。

hb_mpdel_info_tool

支持范围

支持查看 *.onnx模型基本信息,*.bc模型的依赖及参数信息、可删除节点信息,*.hbm模型的依赖及参数信息。

使用方法

Usage: hb_model_info [OPTIONS] MODEL_PATH

  A tool to get info about model compilation parameters, properties

Options:
  -h, --help       Show this message and exit.
  --version        Show the version and exit.
  -v, --visualize  Start netron server to show model structure

命令行参数

参数名称                        参数说明
-h, --help显示帮助信息。
--version显示版本并退出。
-v, --visualize启动webserver以查看模型结构,查看完毕后可使用 Ctrl+C 关闭。

使用示例

resnet50_224x224_nv12.hbm模型为例,使用以下命令查看模型编译信息:

hb_model_info ./model_output/resnet50_224x224_nv12.hbm

输出内容说明

输出部分包括模型编译时的一些输入信息,以及模型上板运行时会占用的内存信息,如下所示:

注解

以下代码块中的版本号信息等内容将随发布包版本变化,此处仅为示例。

log will be stored in /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/03_classification/03_resnet50/hb_model_info.log
Start hb_model_info....
hb_model_info version 3.4.3
hbm_path: /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/03_classification/03_resnet50/model_output/resnet50_224x224_nv12.hbm
pid:94252 tid:94252 hbrt4_log/src/logger.rs:402: Logger of HBRT4 initialized, version = 4.4.3
pid:94252 tid:94252 hbrt4_loader/src/parsing.rs:91: Load hbm from file; filename="resnet50_224x224_nv12.hbm"
pid:94361 tid:94361 hbrt4_log/src/logger.rs:402: Logger of HBRT4 initialized, version = 4.4.3
pid:94361 tid:94361 hbrt4_loader/src/parsing.rs:42: Load hbm header from file; filename="resnet50_224x224_nv12.hbm"
pid:94361 tid:94361 hbrt4_log/src/logger.rs:402: Logger of HBRT4 initialized, version = 4.4.3
pid:94361 tid:94361 hbrt4_loader/src/parsing.rs:91: Load hbm from file; filename="resnet50_224x224_nv12.hbm"
  FPS=1145.9400000000001, latency = 872.60000000000002 us, DDR = 26316800 bytes, Compiling HBDK version = "4.4.3"   (see .hb_model_info/resnet50_224x224_nv12.html)
HBDK hbm perf SUCCESS
************* resnet50_224x224_nv12 *************
############# model deps info #############
builder version     : 3.4.3
hbdk version        : 4.4.3
hmct version        : 2.0.5
############# model_parameters info #############
onnx_model          : /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/01_common/model_zoo/mapper/classification/resnet50/resnet50.onnx
BPU march           : nash-e
layer_out_dump      : False
working dir         : /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/03_classification/03_resnet50/model_output
output_model_file_prefix: resnet50_224x224_nv12
node_info           : {}
############# input_parameters info #############
------------------------------------------
---------input info : input  ---------
input_name          : input 
input_type_rt       : nv12
input_space&range   : regular
input_type_train    : rgb
input_layout_train  : NCHW
norm_type           : data_mean_and_scale
input_shape         : 1x3x224x224
mean_value          : [123.675, 116.28, 103.53]
scale_value         : [0.01712475, 0.017507, 0.01742919]
std_value           : []
separate_batch      : False
---------input info : input end -------
------------------------------------------
############# calibration_parameters info #############
calibration_type    : default
max_percentile      : None
per_channel         : False
cal_data_dir        : /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/03_classification/03_resnet50/calibration_data_rgb
############# compiler_parameters info #############
debug               : True
optimize_level      : O2
compile_mode        : latency
core_num            : 1
balance_factor      : 100
input_source        : {'input': 'pyramid'}
cache_mode          : disable
############# memory info #############
input memory        : 75264
output memory       : 4096
static memory       : 26478248
dynamic memory      : 79360
intermediate memory : 0
temporary memory    : 0
min memory requirement: 26557608
hbm_path: /open_explorer/samples/ai_toolchain/horizon_model_convert_sample/03_classification/03_resnet50/model_output/resnet50_224x224_nv12.hbm
pid:94252 tid:94252 hbrt4_loader/src/parsing.rs:42: Load hbm header from file; filename="resnet50_224x224_nv12.hbm"
pid:94252 tid:94252 hbrt4_log/src/logger.rs:402: Logger of HBRT4 initialized, version = 4.4.3
pid:94252 tid:94252 hbrt4_loader/src/parsing.rs:91: Load hbm from file; filename="resnet50_224x224_nv12.hbm"
############# Model input/output info #############
NAME   TYPE   SHAPE            DATA_TYPE
------ ------ ---------------- ---------
input_y  input  [1, 224, 224, 1] UINT8
input_uv input  [1, 112, 112, 2] UINT8
output   output [1, 1000]        FLOAT32