Post

NBG Model Test Tool: NBinfo

NBG Model Test Tool: NBinfo

nbinfo is a command-line tool for analyzing NBG model files on the PC, running on the X86 Linux platform.

The analysis provided by nbinfo for NBG models includes:

  • Model input/output information, including tensor shapes, quantization parameters, memory details, etc.
  • Runtime memory analysis, including total memory size, system memory size, feature map size statistics, etc.
  • Layer statistics, including total layer count, operator types for each layer, quantization information for each layer, etc.

Install tools

It’s already stay in /docker_data/ai-sdk/tools/nbinfo or you still can install via wget cmd

1
wget https://github.com/ZIFENG278/ai-sdk/raw/refs/heads/main/tools/nbinfo

Usage

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Usage: nbinfo <options> <nbfilepath>

Options:
-a                                      print [a]ll info
-b                                      print [b]rief summary
-n                                      print [n]bg header
-l                                      print [l]ayers
-o                                      print [o]perations
-in                                     print [in]put
-out                                    print [out]put
-m                                      print [m]emory
-m -d                                   print [m]emory, shows detail memory profile
-m -f                                   print [m]emory, for creating network from flash project
-h                                      [h]elp
OptionDescription
-aPrint all information
-bPrint brief summary
-nPrint nbg header
-lPrint layer information
-oPrint operation information
-inPrint input information
-outPrint output information
-mPrint memory information
-m -dPrint memory information with detailed memory profile
-m -fPrint memory information for creating network from flash project
-hDisplay help information

Examples

View Brief Model Information

1
./tools/nbinfo -b models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
nbg file name models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb

 nbinfo version 2.0.0.b7fb7b62
********************************************************************************
Overall Info
********************************************************************************
Network Name:                                                 yolov8n_uint8_NCHW
Version:                                                                 0x1001e
Target:                                                               0x10000016
Core Count:                                                                    1
AXI SRAM Size:                                                                 0
VIP SRAM Size:                                                           0x7e900
Memory Pool Size (bytes):                                                7138880
Memory Pool Alignment:                                                        64
Layer Count:                                                                 189
Operation Count:                                                            2103
Input Count:                                                                   1
Output Count                                                                   1
CheckSum Value:                                                       0x4f1c7a83
********************************************************************************

View Model Input Information

1
./tools/nbinfo -in models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
nbg file name models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb

 nbinfo version 2.0.0.b7fb7b62
********************************************************************************
Input Table
********************************************************************************
Input 0
Dim Count:                                                                     4
Size of Dim[0]:                                                              640
Size of Dim[1]:                                                              640
Size of Dim[2]:                                                                3
Size of Dim[3]:                                                                1
Data Format:                                             VIP_BUFFER_FORMAT_UINT8
Data Type:                                                VIP_BUFFER_TYPE_TENSOR
Quantization Format:                                VIP_BUFFER_QUANTIZE_TF_ASYMM
TF Scale:                                                               0.003676
TF Zeropoint:                                                                  0
Memory Size (bytes):                                                     1228800
input name:                                                        uid_201_out_0
********************************************************************************

View Model Output Information

1
./tools/nbinfo -out models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
nbg file name models/yolov8n/wksp/yolov8n_uint8_nbg_unify/network_binary.nb

 nbinfo version 2.0.0.b7fb7b62


********************************************************************************
Output Table
********************************************************************************
Output 0
Dim Count:                                                                     3
Size of Dim[0]:                                                             8400
Size of Dim[1]:                                                               84
Size of Dim[2]:                                                                1
Data Format:                                              VIP_BUFFER_FORMAT_FP16
Data Type:                                                VIP_BUFFER_TYPE_TENSOR
Quantization Format:                                    VIP_BUFFER_QUANTIZE_NONE
Memory Size (bytes):                                                     1411200
output name:                                                        uid_39_out_0
********************************************************************************
This post is licensed under CC BY 4.0 by the author.