The hb_verifier tool is used to support performing cosine similarity comparisons of model-by-layer operator outputs. The tool supports performing comparisons between onnx models and between onnx model and hbir model.
The cosine similarity indicates the consistency between quantized models at different stages. As the cosine similarity gets closer to 1, it indicates that the outputs of the two quantized models being compared are closer to each other.
| PARAMETER | DESCRIPTION |
-h, --help | Displays help information and exits. |
-m, --model | Specifies the image to be used for inference testing, only *.npy files are supported. There are two ways to add pictures to a multi-input model by passing parameters, and multiple images are separated by “,”:
|
Take the model optimization stage model optimized_float_model.onnx and the model calibration stage model calibrated_model.onnx as an example:
Take the model optimization stage model optimized_float_model.onnx and the model quantization stage fixed-point model quantized_model.bc as an example:
The cosine similarity information for the compared models will be printed within the terminal, as shown in the example below:
Among them: