(6) MNN quantitative research

Using MNN for quantization and converting the weight parameter float32 to int8 can speed up the model. Taking NanoDet-Plus as an example, this article describes its process in detail:

1. ModelConfig.json configuration format

{
    "format":"BGR",           
    "mean":[103.53, 116.28, 123.675],
    "normal":[0.017429, 0.017507, 0.017125],
    "width":256,
    "height":256,
    "path":"/gzy_mnt/NanoDet-Plus/gan/img",
    "used_image_num":500,
    "feature_quantize_method":"KL",
    "weight_quantize_method":"MAX_ABS"
}

Note that format, mean, normal, width, and height above are model input parameters.

path refers to the path where the image is stored. It should be noted that the size of the stored image is required by the model.

used_image_num: used to specify how many images in the above directory are used for correction, all images in the path are used by default

feature_quantize_method: Specify the method to calculate the feature quantization coefficient, (KL, ADMM)

weight_quantize_method: Specify the weight quantization method, (MAX_ABS, ADMM)

2、

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324122060&siteId=291194637