A neural network quantization calibration method based on feature map mean square error

By using the mean squared error of feature maps (MSE) as a quantization calibration standard and dynamically adjusting the weight quantization parameters, the accuracy loss and stability problems of existing neural network quantization methods are solved, achieving more efficient model deployment and performance optimization.

CN122263978APending Publication Date: 2026-06-23INGENIC SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INGENIC SEMICON CO LTD
Filing Date
2024-12-20
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing neural network quantization methods have shortcomings in terms of accuracy loss and instability in the calibration process. In particular, MinMax quantization cannot accurately reflect the parameter distribution, leading to a decrease in model accuracy and stability issues.

Method used

The mean square error (MSE) of the feature map is used as the evaluation criterion for quantization calibration. By calculating the MSE error of the floating-point weights and the dequantized feature map, the quantization strategy is dynamically adjusted, the quantization process of the weights is optimized, and the stability and accuracy of the model are ensured.

Benefits of technology

This improves the accuracy and stability of the quantization model, enhances its applicability on resource-constrained devices, and ensures the accuracy and reliability of the quantization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122263978A_ABST
    Figure CN122263978A_ABST
Patent Text Reader

Abstract

This invention provides a neural network quantization calibration method based on the mean square error of feature maps, comprising: S1, constructing a calibration dataset; S2, saving floating-point neural network feature maps; S3, quantizing the neural network input; S4, calibrating quantization parameters; S5, quantizing weights; S6, quantizing feature maps; and S7, evaluating the quantization effect. By using the mean square error (MSE) of the feature maps as the evaluation criterion for weight and feature map quantization calibration, this invention can more accurately assess the impact of quantization on model performance, thereby improving the accuracy and robustness of the quantized model and ultimately enhancing the overall system efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of neural network quantization technology in deep learning, and specifically relates to a neural network quantization calibration method based on feature map mean square error. Background Technology

[0002] In the current technology, with the increasing prevalence of deep learning in various applications, the need to deploy deep learning models on resource-constrained devices is growing. To achieve this goal, model quantization is required to reduce model size and improve inference speed. Existing quantization methods typically use the mean squared error of the weights as a calibration criterion, but this method may not adequately reflect the model's performance when processing real-world data.

[0003] With the rapid development of artificial intelligence technology, deep learning has become one of the key technologies for solving complex problems. Deep neural networks, especially convolutional neural networks, have achieved remarkable success in image recognition, natural language processing, and other fields. However, these neural networks typically contain millions or even billions of parameters, resulting in large size and high computational cost, which limits their application in resource-constrained environments.

[0004] Existing neural network quantization techniques primarily focus on reducing model storage requirements and improving inference speed, especially on resource-constrained devices. These techniques typically involve converting the floating-point parameters of the neural network (such as weights and activations) into low-bit-width integer forms. Common quantization methods include symmetric quantization and asymmetric quantization. Symmetric quantization quantizes parameters to a fixed range (e.g., [-128, 127]), while asymmetric quantization allows parameters to vary within an asymmetric range (e.g., [0, 255]).

[0005] However, the drawbacks of the existing technology are:

[0006] 1. Accuracy Loss Issue: Existing quantization methods, especially simple MinMax quantization, often introduce significant errors during the quantization process, leading to a substantial decrease in model accuracy. This is because MinMax quantization does not consider the distribution of parameter values, which may result in the quantized parameters failing to accurately reflect the information of the original parameters.

[0007] 2. Instability of the calibration process: In some extreme cases, such as when the numerical range of weights or feature maps is very small, existing quantization calibration methods may lead to inappropriate selection of calibration parameters (such as minimum and maximum values), thereby causing quantization anomalies and affecting the stability and reliability of the model.

[0008] In addition, the technical terms in this field include:

[0009] Weight (W): In a neural network, each neuron has a weight used to calculate the neuron's output;

[0010] Feature map: In a convolutional neural network, it refers to the output of the convolution operation, and here it generally refers to the output of each layer of the neural network;

[0011] Quantization scaling factor (S): scale represents the ratio between real numbers and integers, used to map floating-point values ​​to the range of integer values. The choice of scale should make the quantized value cover the range of the original floating-point value as much as possible.

[0012] Zero point (Z): The bias parameter in symmetric quantization, representing the integer corresponding to 0 in a real number after quantization, used to preserve the range of the original value.

[0013] Mean Squared Error (MSE) is a commonly used metric to measure the difference between predicted and observed values, and is used to evaluate how well a model fits a given dataset. MSE is calculated by averaging the squared differences between the predicted and observed values. Summary of the Invention

[0014] To address the aforementioned problems, the present invention aims to provide a neural network quantization calibration method based on feature map mean square error, offering the following solution to the shortcomings of existing technologies:

[0015] 1. Improve quantization accuracy: By using the mean square error (MSE) of the feature map as the evaluation criterion for quantization calibration, this invention can more accurately measure the error in the quantization process, thereby optimizing the selection of quantization parameters and reducing accuracy loss.

[0016] 2. Optimize weight quantization: This invention focuses on the quantization process of weights. By calculating the MSE error of the feature map inferred from the floating-point weights and the dequantized weights, the quantization strategy is adjusted accordingly to ensure the quantization quality of the weights, thereby improving the overall model performance.

[0017] 3. Enhanced stability of the calibration process: By introducing logical judgment and dynamic adjustment strategies, this invention can automatically adjust quantization parameters when encountering extreme numerical ranges, avoid quantization anomalies, and ensure the stability of the quantization process and the reliability of the quantization model.

[0018] Through these improvements, the present invention not only enhances the accuracy of the quantization model, but also strengthens its applicability and stability under various conditions, especially when deployed on resource-constrained devices, where these advantages are particularly important.

[0019] Specifically, this method is a neural network quantization calibration method based on the mean square error of feature maps, the method comprising the following steps:

[0020] S1. Construct the calibration dataset:

[0021] Before the quantization process begins, a calibration dataset needs to be constructed. This dataset is selected from the test scenarios of the neural network and contains 16 to 20 representative images. These representative images should cover various scenarios that the network model can encounter and have high recognition rates and color uniformity, including: the colors in the images should be uniformly distributed without unnatural color blocks or stripes; for images containing specific objects, the object features should be obvious and easily identifiable. In this way, the calibration dataset can comprehensively reflect the model's performance in real-world applications and provide an accurate reference for subsequent quantization calibration.

[0022] S2. Save the feature map of the floating-point neural network:

[0023] The calibration dataset is forward-propagated using a trained and converged floating-point neural network; in this step, the output of each layer of the network, i.e. the feature map, is saved.

[0024] Feature maps are intermediate representations of the input data processed by the neural network and are crucial for subsequent quantization. The purpose of saving feature maps is to accurately calculate the quantization parameters of each layer during the quantization process.

[0025] S3. Quantize the neural network input:

[0026] Calculate the maximum and minimum values ​​of the input, and use MinMax quantization to quantize the input into an int8 integer; thus, obtain the quantized input q. input as follows:

[0027] First, the S of the neural network input is calculated based on the statistical values ​​of input_min and input_max. input and Z input :

[0028] S input =(input_max-input_min) / 256 (1)

[0029]

[0030] Then, the floating-point input r of the neural network is calculated. input quantization value q input

[0031] q input =r input / S input +Zinput (3)

[0032] S4. Calibrate quantization parameters:

[0033] The mean square error (MSE) quantization calibration method is used to calculate the weight quantization coefficients weight_min, weight_max and the feature map quantization coefficients feature_min, feature_max.

[0034] S5. Quantization Weights:

[0035] Based on the weight quantization coefficients weight_min and weight_max obtained in step S4, S is calculated. weight and Z weight :

[0036] S weight =(weight_max-weight_min) / 256 (9)

[0037]

[0038] Quantization weights:

[0039] q weight =round(r weight / S weight +Z weight (11)

[0040] Then, the quantized weights are truncated to [-128, 127] to ensure that the quantized weights are within the range of n-bit numerical representation.

[0041] S6. Quantization Feature Map:

[0042] Based on the feature map quantization coefficients feature_min and feature_max obtained in step S4, S is calculated. feature and Z feature :

[0043] S feature =(feature_max-feature_min) / 256 (12)

[0044]

[0045] Based on the quantized input q obtained in step S3 input and the quantization weight q calculated in step S4 weight The first layer feature map of the network is quantized as follows:

[0046]

[0047] Then, the quantized feature map is truncated to ensure that it falls within the range of n-bit numerical representation. Subsequent network layer feature map quantization calculations only require taking q from the above formula. input Simply replace it with the output of the previous layer and the quantized feature map of the previous layer;

[0048] S7. Quantitative Evaluation of Results:

[0049] Finally, the quantized neural network is evaluated using a test dataset of floating-point neural networks. This step is to verify whether the quantized model meets the expected performance requirements. The evaluation metrics include the model's accuracy, recall, and whether the precision of the quantized model is within an acceptable range. If the performance of the quantized model meets the expected requirements, then the model can be deployed to the target device. If the performance of the quantized neural network is found to be below expectations in the evaluation, it may be necessary to return to an earlier step in the quantization process for adjustment. If the performance loss caused by quantization is too great and cannot be adjusted to achieve an acceptable performance level, then the process should be abandoned.

[0050] The basic formula for the forward propagation of the neural network in step S2 is as follows:

[0051] F = W·x + b

[0052] Where F is the output of each layer of the neural network, W is the weight of the neural network, x is the input of each layer of the neural network, and b is the weight.

[0053] Step S4 further includes:

[0054] S4.1 Obtain the min and max values ​​of the weights for each layer of the floating-point neural network, and use the MinMax quantization method to calculate the quantization scale and zero point:

[0055] S weight =(weight_max-weight_min) / 256 (4)

[0056]

[0057] Next, the weights are quantized and dequantized:

[0058] q weight =round(r weight / S weight +Z weight (6)

[0059] r qweight =(q weight -Z weight )*S weight (7)

[0060] r weigh represents the original floating - point weight, q weight is the quantized integer value, r qweight is the floating - point value obtained by de - quantization, and round is rounding;

[0061] Initialize a variable best_score to store the minimum MSE LOSS calculated between the floating - point weight and the de - quantized weight. Equation (8) is the calculation formula for MSE LOSS, which is used as the benchmark for quantization calibration:

[0062] best_score = (r feature - r qfrature ) 2 (8)

[0063] r feature and r qfeature are the feature maps calculated from the original floating - point weight and the feature maps calculated from the de - quantized weight respectively;

[0064] S4.2, Judge whether (max - min) is less than 1e - 6. If so, update max to (max + 1e - 6) to avoid the case where the quantization scale is zero, and then end the calibration process; if not, then continue to the next step S4.3;

[0065] S4.3, Enter a loop and update the parameters for N times; here, the value of N depends on multiple factors including the complexity of the model, the size and diversity of the dataset, and N ranges from dozens to hundreds;

[0066] S4.4, Update min, max:

[0067] new_min = min*(1 - (i * 0.01)), new_max = max*(1 - (i * 0.01))

[0068] S4.5, Recalculate the quantization and de - quantization of the weight using the updated min and max values, and then calculate the new MSELOSS using the formula for the minimum MSE LOSS in step S4.1;

[0069] S4.6, If MSE LOSS < best_score, update best_score to MSE LOSS, update min to new_min, and max to new_max; if MSE LOSS ≥ best_score, keep best_score unchanged and do not update.

[0070] The n bit involved in the method includes 8 bit.

[0071] The formulas involved in the method include:

[0072] Quantitative basic formula:

[0073] q = (r / S + Z)

[0074] Where r represents a floating-point real number, q represents a quantized fixed-point integer, S is the scale, representing the ratio between the real number and the integer, and Z is the zero point, representing the integer corresponding to 0 in the real number after quantization.

[0075] The formulas for calculating scale and zero point are:

[0076]

[0077] r max ,r min These are the maximum and minimum values ​​of r, and q. max ,q min Similarly;

[0078] Matrix quantization formula:

[0079] The matrix quantization formula can be derived from the above basic quantization formula:

[0080]

[0081] The beneficial effects of this invention include:

[0082] Compared with the prior art, the advantage of the present invention is that by using the MSE of the feature map as the evaluation criterion for quantization calibration, the impact of quantization on model performance can be evaluated more accurately, thereby improving the accuracy and robustness of the quantization model and thus improving the overall system operating efficiency.

[0083] This invention uses the mean squared error (MSE) of the feature map as the evaluation criterion for quantization calibration, and is mainly applicable to the following projects:

[0084] 1. Image Recognition:

[0085] It is used to automatically identify objects, scenes, text and other information in images, and is commonly used in security monitoring, facial recognition, intelligent photo album classification and other fields.

[0086] 2. Object Detection:

[0087] It is used to identify the location and category of targets in images and is widely used in scenarios such as autonomous driving, video surveillance, and retail analytics.

[0088] 3. Semantic Segmentation:

[0089] Classifying each pixel in an image to understand the detailed structure of the image content is commonly used in Geographic Information Systems (GIS), medical image analysis, and other fields.

[0090] 4. Instance Segmentation:

[0091] It can not only identify different objects in an image, but also distinguish different instances belonging to the same category, making it suitable for fields such as robot vision and augmented reality.

[0092] 5. Video Analysis:

[0093] Including behavior recognition and event detection, it is applied to video surveillance, content review, sports analysis, and other applications. Attached Figure Description

[0094] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.

[0095] Figure 1 This is a flowchart illustrating the technical solution of this application. Detailed Implementation

[0096] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.

[0097] This invention relates to neural network quantization techniques in the field of deep learning, and in particular to a neural network quantization calibration method based on the mean square error (MSE) of feature maps.

[0098] First, let me explain the basic formulas used later:

[0099] 1. The basic formula for forward propagation in neural networks

[0100] F = W·x + b

[0101] Where F is the output of each layer of the neural network, W is the weight of the neural network, x is the input of each layer of the neural network, and b is the weight.

[0102] 2. Quantitative Basic Formulas

[0103] q = (r / S + Z)

[0104] Where r represents a floating-point real number, q represents a quantized fixed-point integer, S is the scale, representing the ratio between the real number and the integer, and Z is the zero point, representing the integer corresponding to 0 in the real number after quantization.

[0105] The formulas for calculating scale and zero point are:

[0106]

[0107] r max ,r min These are the maximum and minimum values ​​of r, and q. max ,q min Similarly.

[0108] 3. Matrix quantization formula

[0109] The matrix quantization formula can be derived from the basic quantization formula (1) above:

[0110]

[0111] In this application, the quantization feature map in step S6 is adapted to the specific application scenario of the quantization feature map using this formula.

[0112] like Figure 1 As shown, the technical solution of the present invention includes the following steps:

[0113] S1. Construct the calibration dataset:

[0114] Before the quantization process begins, a calibration dataset needs to be constructed. This dataset is carefully selected from the test scenarios of the neural network and contains 16 to 20 representative images. 16 to 20 images is a common starting point, but this number can be adjusted based on the specific application and the complexity of the model. If the test scenarios are highly diverse or the model needs to process many different inputs, more images may be needed to ensure the representativeness of the calibration dataset. These images should cover a wide range of scenarios that the network model might encounter and have high recognition rates and color uniformity. The representative images should cover a wide range of scenarios that the network model might encounter and have high recognition rates and color uniformity, including: the colors in the images should be uniformly distributed, without unnatural color blocks or stripes; for images containing specific objects, the object features should be clearly visible and easily identifiable. In this way, the calibration dataset can comprehensively reflect the model's performance in real-world applications, providing an accurate reference for subsequent quantization calibration.

[0115] S2. Save the feature map of the floating-point neural network:

[0116] Using a pre-trained and converged floating-point neural network (NNNN) whose loss function has stabilized and which achieves high accuracy on independent validation sets, forward propagation is performed on a calibration dataset. In this step, the output of each layer of the network, i.e., the feature map, is saved. Feature maps are intermediate representations of the input data after processing by the neural network; they contain rich information and are crucial for subsequent quantization. Saving the feature maps ensures accurate calculation of the quantization parameters for each layer during the quantization process.

[0117] S3. Quantizing Neural Network Input

[0118] Calculate the maximum and minimum values ​​of the input, and then quantize them to int8 integers using MinMax quantization. For feature map quantization, first quantize the input and weights, then perform a convolution operation on the quantized input and weights, and finally multiply by S. input *S weight / S feature Only then can the final quantized value of the feature map be obtained.

[0119] First, the S of the neural network input is calculated based on the statistical values ​​of input_min and input_max. input and Z input :

[0120] S input =(input_max-input_min) / 256 (1)

[0121]

[0122] Then, the floating-point input r of the neural network is calculated. input quantization value q input

[0123] q input =r input / S input +Z input (3)

[0124] S4. Calibrate quantization parameters:

[0125] The weight quantization coefficients weight_min and weight_max are calculated using the MSE quantization calibration method, since this invention focuses on weight quantization and feature map quantization coefficients feature_min and feature_max. The specific steps are as follows:

[0126] S4.1, Obtain the min and max values ​​of the weights for each layer of the floating-point neural network. Using the MinMax quantization method, we calculate the quantization scale and zero point:

[0127] S weight =(weight_max-weight_min) / 256(4)

[0128]

[0129] Next, the weights are quantized and dequantized:

[0130] q weight =round(r weight / S weight +Z weight (6)

[0131] r qweight =(q weight -Z weight )*S weight (7)

[0132] r weigh Represents the original floating-point weight, q weight r is the quantized integer value. qweight This is the floating-point value obtained by dequantization, and round is for rounding.

[0133] Initialize a variable best_score to store the minimum MSE loss calculated between the floating-point weights and the dequantization weights, which will serve as the benchmark for quantization calibration.

[0134] best_score=(r feature -r qfeature ) 2 (8)

[0135] r feature and r qfeature These are feature maps calculated using native floating-point weights and feature maps calculated using inverse quantization weights, respectively.

[0136] S4.2, determine if (max - min) is less than 1e-6. If so, update max to (max + 1e-6) to avoid the quantization scale being zero, and then end the calibration process. If not, proceed to the next step S4.3;

[0137] S4.3, enter the loop, and update the parameters N times; the value of N is usually based on experience and has no fixed limit or basis. It depends on multiple factors including the complexity of the model, the size and diversity of the dataset. Generally speaking, the value of N can range from tens to hundreds.

[0138] S4.4, update min, max:

[0139] new_min = min * (1 - (i * 0.01)), new_max = max * (1 - (i * 0.01))

[0140] S4.5. Recalculate the quantization and dequantization of weights using the updated min and max values, and then calculate the new MSELOSS using the formula for the minimum MSE LOSS in step S4.1;

[0141] S4.6. If MSE LOSS < best_score, update best_score to MSE LOSS, update min to new_min, and max to new_max; if MSE LOSS ≥ best_score, keep best_score unchanged and do not update;

[0142] S5. Quantize weights:

[0143] Calculate S and Z based on the weight quantization coefficients weight_min and weight_max obtained in step S4 weight and Z weight :

[0144] S weight = (weight_max - weight_min) / 256 (9)

[0145]

[0146] Quantize weights:

[0147] q weight = round(r weight / S weight + Z weight ) (11)

[0148] Then perform a truncation operation on the quantized weights to [-128, 127] to ensure that the quantized weights are within the 8-bit numerical representation range;

[0149] S6. Quantize feature maps:

[0150] Calculate S and Z based on the feature map quantization coefficients feature_min and feature_max obtained in step S4 feature and Z feature :

[0151] S feature = (feature_max - feature_min) / 256 (12)

[0152]

[0153] Based on the quantized input q obtained in step S3 input and the quantization weight q calculated in step S4 weight The first layer feature map of the network is quantized as follows:

[0154]

[0155] Then, the quantized feature map is truncated to ensure that it falls within the 8-bit numerical representation range; subsequent network layer feature map quantization calculations only require taking q from the above formula. input Simply replace it with the output of the previous layer and the feature map quantized by the previous layer.

[0156] In summary, steps S3-S6 are summarized as follows:

[0157] Quantizing the feature map should first involve quantizing the input and weights, then performing a convolution operation on the quantized input and weights, and finally multiplying by S. input *S weight / S feature Only then can the final quantized value of the feature map be obtained.

[0158] S7. Quantitative Evaluation of Results:

[0159] Finally, the quantized neural network is evaluated using a test dataset of floating-point neural networks. This step verifies whether the quantized model meets the expected performance requirements. Evaluation metrics include model accuracy and recall, but this invention focuses specifically on whether the accuracy of the quantized model is within an acceptable range, typically controlled within a certain range, for example, not exceeding 1%-5% of the original value. If the performance of the quantized model meets the expected requirements, the model can be deployed to the target device for efficient inference computation. If the performance of the quantized neural network does not meet expectations during evaluation, it may indeed be necessary to return to earlier steps in the quantization process for adjustments. If the performance loss caused by quantization is too large and cannot be adjusted to achieve an acceptable performance level, then the process should be abandoned.

[0160] In summary, the technical solution of this application can be summarized as follows:

[0161] Quantization parameter calibration strategy: The strategy of dynamically adjusting the weighted quantization parameters based on the calculation results of the feature map MSE is an important aspect of this invention. This strategy ensures the accuracy of the quantization process and the optimization of model performance.

[0162] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A neural network quantization calibration method based on feature map mean square error, characterized in that, The method includes the following steps: S1. Construct the calibration dataset: Before the quantization process begins, a calibration dataset needs to be constructed. This dataset is selected from the test scenarios of the neural network and contains 16 to 20 representative images. These representative images should cover various scenarios that the network model can encounter and have high recognition rates and color uniformity, including: the colors in the images should be uniformly distributed without unnatural color blocks or stripes; for images containing specific objects, the object features should be obvious and easily identifiable. In this way, the calibration dataset can comprehensively reflect the model's performance in real-world applications and provide an accurate reference for subsequent quantization calibration. S2. Save the floating-point neural network feature map: The calibration dataset is forward-propagated using a trained and converged floating-point neural network; in this step, the output of each layer of the network, i.e. the feature map, is saved. Feature maps are intermediate representations of the input data processed by the neural network and are crucial for subsequent quantization. The purpose of saving feature maps is to accurately calculate the quantization parameters of each layer during the quantization process. S3. Quantize the neural network input: Calculate the maximum and minimum values ​​of the input, and then use MinMax quantization to quantize the input into an int8 integer; the quantized input qinput is as follows: First, the S of the neural network input is calculated based on the statistical values ​​of input_min and input_max. input and Z input : S input =(input_max-input_min) / 256 (1) Then, the floating-point input r of the neural network is calculated. input quantization value q input q input =r input / S input +Z input (3) S4. Calibrate quantization parameters: The mean square error (MSE) quantization calibration method is used to calculate the weight quantization coefficients weight_min, weight_max and the feature map quantization coefficients feature_min, feature_max. S5. Quantization Weights: Based on the weight quantization coefficients weight_min and weight_max obtained in step S4, S is calculated. weight and Z weight : S weight =(weight_max-weight_min) / 256 (9) Quantization weights: q weight = round(r weight / S weight + Z weight ) (11) Then, the quantized weights are truncated to [-128, 127] to ensure that the quantized weights are within the range of n-bit numerical representation. S6. Quantization Feature Map: Based on the feature map quantization coefficients feature_min and feature_max obtained in step S4, S is calculated. feature and Z feature : S feature =(feature_max-feature_min) / 256 (12) Based on the quantized input q obtained in step S3 input and the quantization weight q calculated in step S4 weight The first layer feature map of the network is quantized as follows: Then, the quantized feature map is truncated to ensure that it falls within the range of n-bit numerical representation. Subsequent network layer feature map quantization calculations only require taking q from the above formula. input Simply replace it with the output of the previous layer and the quantized feature map of the previous layer; S7. Quantitative Evaluation of Results: Finally, the quantized neural network is evaluated using a test dataset of floating-point neural networks. This step is to verify whether the quantized model meets the expected performance requirements. The evaluation metrics include the model's accuracy, recall, and whether the precision of the quantized model is within an acceptable range. If the performance of the quantized model meets the expected requirements, then the model can be deployed to the target device. If the performance of the quantized neural network is found to be below expectations in the evaluation, it may be necessary to return to an earlier step in the quantization process for adjustment. If the performance loss caused by quantization is too great and cannot be adjusted to achieve an acceptable performance level, then the process should be abandoned.

2. The neural network quantization calibration method based on feature map mean square error according to claim 1, characterized in that, The basic formula for the forward propagation of the neural network in step S2 is as follows: F = W·x + b Where F is the output of each layer of the neural network, W is the weight of the neural network, x is the input of each layer of the neural network, and b is the weight.

3. The neural network quantization calibration method based on feature map mean square error according to claim 1, characterized in that, Step S4 further includes: S4.1 Obtain the min and max values ​​of the weights for each layer of the floating-point neural network, and use the MinMax quantization method to calculate the quantization scale and zero point: S weight =(weight_max-weight_min) / 256 (4) Next, the weights are quantized and dequantized: q weight =round(r weight / S weight +Z weight ) (6) r qweight =(q weight -Z weight )*S weight (7)r weigh Represents the original floating-point weight, q weight r is the quantized integer value. qweight This is the floating-point value obtained by dequantization; round is for rounding. Initialize a variable best_score to store the minimum MSE LOSS calculated between the floating-point weights and the de-quantized weights. Formula (8) is the MSE LOSS calculation formula, which serves as the benchmark for quantization calibration benchmark: best_score=(r feature -r qfeature ) 2 (8) r feature and r qfeature These are the feature maps calculated using native floating-point weights and the feature maps calculated using inverse quantization weights, respectively. S4.2, determine whether (max - min) is less than 1e-6. If so, update max to (max + 1e-6) to avoid the case where the quantization scale is zero, and then end the calibration process; if not, then continue to the next step S4.3; S4.3, enter a loop, and update the parameters for N times. Here, the value of N depends on multiple factors including the complexity of the model, the size and diversity of the dataset, and N ranges from dozens to hundreds; S4.4, update min and max: new_min = min * (1 - (i * 0.01)), new_max = max * (1 - (i * 0.01)) S4.5, recalculate the quantization and de-quantization of the weights using the updated min and max values, and then calculate the new MSELOSS using the formula for the minimum MSE LOSS in step S4.1; S4.6, if MSE LOSS < best_score, update best_score to MSE LOSS, update min to new_min, and max to new_max; if MSE LOSS ≥ best_score, keep best_score unchanged without updating.

4. The neural network quantization calibration method based on feature map mean square error according to claim 1, characterized in that, The n bit involved in the method includes 8bit.

5. The neural network quantization calibration method based on feature map mean square error according to claim 1, characterized in that, The formulas involved in the method include: Quantization basic formula: q = (r / S + Z) Where, r represents the floating-point real number, q represents the quantized fixed-point integer, S is the scale, representing the proportional relationship between the real number and the integer, and Z is the zero_point, representing the integer corresponding to 0 in the real number after quantization, The calculation formulas for scale and zero_point are: r max ,r min These are the maximum and minimum values ​​of r, and q. max ,q min Similarly; Matrix quantization formula: The matrix quantization formula can be deduced from the above basic quantization formula: