android13/hardware/rockchip/rknn-toolkit2/examples/functions/hybrid_quant
liiir1985 7f62dcda9f initial 2024-06-22 20:45:49 +08:00
..
README.md initial 2024-06-22 20:45:49 +08:00
box_priors.txt initial 2024-06-22 20:45:49 +08:00
dataset.txt initial 2024-06-22 20:45:49 +08:00
dog_bike_car_300x300.jpg initial 2024-06-22 20:45:49 +08:00
result_truth.jpg initial 2024-06-22 20:45:49 +08:00
ssd_mobilenet_v2.pb initial 2024-06-22 20:45:49 +08:00
ssd_post_process.py initial 2024-06-22 20:45:49 +08:00
step1.py initial 2024-06-22 20:45:49 +08:00
step2.py initial 2024-06-22 20:45:49 +08:00

README.md

How to use hybrid-quantization function

Model Source

The model used in this example come from:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md ssd_mobilenet_v2_coco

Script Usage

Usage:

1. python step1.py
2. modify ssd_mobilenet_v2.quantization.cfg according to the prompt of step1.py
3. python step2.py

Description:

  • The default target platform in script is 'rk3566', please modify the 'target_platform' parameter of 'rknn.config' according to the actual platform.
  • If connecting board is required, please add the 'target' parameter in 'rknn.init_runtime'.

Expected Results

This example will outputs the results of the accuracy analysis and save the result of object detection to the 'result.jpg', as follows:

layer_name                                                                                                     simulator_error        
                                                                                                              entire    single        
--------------------------------------------------------------------------------------------------------------------------------------
[Input] FeatureExtractor/MobilenetV2/MobilenetV2/input:0                                                     1.000000  1.000000       
[exDataConvert] FeatureExtractor/MobilenetV2/MobilenetV2/input:0_int8                                        0.999964  0.999964       
[Conv] Conv__343:0                                                                                           
[Clip] FeatureExtractor/MobilenetV2/Conv/Relu6:0                                                             0.999976  0.999976   

...

[Conv] BoxPredictor_0/BoxEncodingPredictor/BiasAdd:0                                                         0.997577  0.999687       
[Transpose] BoxPredictor_0/BoxEncodingPredictor/BiasAdd__341:0                                               0.997577  0.999960       
[Reshape] concat_swap_concat_reshape_i0_out                                                                  0.997577  0.999960       
[Concat] concat_swap_concat_reshape_o0_out                                                                   0.997513  0.999939       
[Reshape] concat:0_int8                                                                                      0.997513  0.999943       
[exDataConvert] concat:0                                                                                     0.997513  0.999943 

result

  • Note: Different platforms, different versions of tools and drivers may have slightly different results.