In engineering practice, since not all floating-point models can be converted to quantized models, checking is required before conversion. This checking process will go through the process of a model conversion, the basic flow of its operation is shown below:
However, for those more time-consuming procedures, we simplified the checking process. This command will output the check results and the OP deployment on the device when it finishes the checking of the model.
Please use the HBRuntime to inference your floating-point onnx model to make sure the model is legal, and then refer to the method below to use hb_compile to check if the model can be converted to a quantized model.
| Parameter Name | Parameter Description |
-h, --help | Show help information and exit. |
--march | BPU's micro architectures.
|
-m, --model | Floating-point model file of Caffe/ONNX.
|
--proto | Specify the Prototxt file of the Caffe model. |
-i, --input-shape | Input node and input shape of the node, optional, where the shape should be separated byx. The value is {input_name} {NxHxWxC/NxCxHxW}, and the input_nameis separated from the shape by space.
For example, if the model input node name isdata, and the input shape is[1,3,224,224], the value should be data 1x3x224x224.
If the shape configured here is not the same as the shape information in the model, the configuration here will take precedence.Note that an --input-shapeonly accepts one name and shape combination, if your model has multiple input nodes, just configure the --input-shapeparameter multiple times in the command. |
If you find that the The converted model node information results during model checking does not match the The converted model node information results during model quantized compilation,
it may be because there is actually a default yaml configuration during the model checking process, and if you configured the yaml before the conversion,
some parameter differences may cause this if you configure yaml before model quantized compilation, some parameters may cause this situation.
The yaml configuration parameters that may cause this to happen include: mean_value , scale_value std_value and quant_config.
When checking a single-input model using hb_compile, the reference instruction is as follows:
When checking a multi-input model using hb_compile, the reference instruction is as follows: