A target detection low-bit quantization method based on degeneration calibration distillation

By using a degenerate calibration distillation method, the differences between the quantized student detector and the teacher detector are analyzed, classification and localization losses are constructed, and the supervision weights are optimized. This solves the problem of inaccurate detection results of low-bit quantization detectors in dense target detection and improves detection accuracy.

CN123181818APending Publication Date: 2026-11-27ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611685145.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing low-bit quantization methods struggle to effectively distinguish between the original expression differences in the student model and the added biases in the quantization path of the detection head in dense target detection, leading to inaccurate detection results.

Method used

A degeneracy calibration distillation-based approach is adopted. By analyzing the forward inference differences between the student detector and the teacher detector, classification distillation loss and localization structure distillation loss are constructed. The supervision weights are adjusted using calibration coefficients and teacher confidence modulation factors. Combined with localization branch constraints, the quantified student detector is optimized.

Benefits of technology

It improves the detection accuracy of low-bit quantization detectors, especially in the detection of medium and large targets, with a 1.3 percentage point increase in mAP and a 1.2 and 3.0 percentage point increase in AP for medium and large targets, respectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181818A_ABST
    Figure CN123181818A_ABST
Patent Text Reader

Abstract

The application discloses a target detection low-bit quantization method based on degeneration calibration distillation, and relates to the technical field of computer vision and neural network quantization. Quantization forward is performed on the same student feature and detection head parameters, reference forward is performed by closing the detection head quantization and stopping the gradient, and teacher output is obtained; the probability deviation of two student outputs relative to the teacher output is compared, the calibration coefficient of stopping the gradient is generated by combining the quantization residual, and the re-weighted classification distillation loss is obtained; the probability shape, the direction and the weighted connection system constraint are constructed at the positive sample position of the selected feature layer, and the positioning structure distillation loss is obtained; the above loss and the original detection loss are combined for quantization perception training. After training, only the quantization student detector is reserved, which is used for outputting target categories, confidence and a bounding box, so that the target detection precision under the low-bit quantization condition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision and neural network model quantization technology, specifically to a low-bit quantization method for target detection based on degenerate calibration distillation. Background Technology

[0002] Dense object detectors predict object categories and bounding boxes on feature layers of different resolutions. To reduce the storage and computational burden during model deployment, low-bit quantization can be applied to network weights and activations. Quantization-aware training introduces simulated quantization during the training phase, allowing network parameters to adapt to quantization errors. The Learning Step Size Quantization (LSQ) method, published by Esser et al. in "Learned Step Size Quantization" (ICLR 2020), uses the quantization step size as a learnable parameter, and is an example of this type of method. Low-bit quantization can still alter the classification response and boundary regression distribution, affecting the final detection results.

[0003] Knowledge distillation utilizes the output of the teacher model to supervise the student model. For dense detection classification tasks, Yang et al., in their paper "Bridging Cross-task Protocol Inconsistency for Distillation in DenseObject Detection" (ICCV 2023), published the BCKD method, which treats the class output as multiple binary predictions to alleviate protocol inconsistencies between classification tasks and distillation supervision. This type of teacher-student classification matching provides basic supervision, but by only observing the quantized differences between students and teachers, it's difficult to distinguish between the original expressive differences in the student model and the biases added by the detection head's quantization path. Without this distinction, the supervisory weights may not be focused on the relatively degraded class responses after quantization.

[0004] Zheng et al., in their paper "Localization Distillation for Dense Object Detection" (CVPR 2022), presented the localization distillation (LD) method, which uses boundary location distributions to convey localization knowledge to students and investigates valuable localization distillation regions. For quantized detectors that represent boundary distances with discrete distributions, in addition to the differences in probability distributions of individual boundaries, it is also necessary to consider the direction of the regression logits vector and the statistical relationship between discrete values. Furthermore, different feature layers correspond to different spatial resolutions, and uniformly imposing additional localization constraints on each layer may not be suitable for quantifying the student's learning process. Summary of the Invention

[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing a low-bit quantization method for target detection based on degradation calibration distillation.

[0006] To achieve the above objectives, the present invention provides a low-bit quantization method for target detection based on degradation calibration distillation, comprising: Step S1: Input the training image into the quantized student detector to be trained, extract the student feature set X; and determine the category label, label weight and positive sample for each prediction position; Step S2: Input the training image into the pre-trained teacher detector to obtain the original scores for teacher classification and teacher boundary regression. During this process, the parameters remain fixed and the forward calculation stops the gradient. The detection head of the quantized student detector performs forward inference on the student feature set X in the quantization enabled state to obtain the original scores for quantized classification and quantized boundary regression. Step S3: Reuse the student feature set X with the same set of detection head parameters, temporarily disable the quantization operation of the detection head, and run the detection head again in the stopped gradient state to obtain the original score of the reference classification. Step S4: Construct a classification distillation loss based on the original scores of the teacher classification, the original scores of the quantified classification, and the original scores of the reference classification; Step S5: Select the feature layer for positioning structure distillation according to the preset feature layer step size condition, and calculate the positioning structure distillation loss of each selected feature layer. Step S6: Calculate the total loss based on the native detection loss, classification distillation loss, and localization structure distillation loss of the quantized student detector; backpropagate based on the total loss to update the network parameters and learnable quantization parameters of the quantized student detector. Step S7: After training is complete, discard the teacher detector and the reference prediction operation logic, vectorize the student detector, input the image to be detected, and output the target detection result.

[0007] Furthermore, the method for constructing the classified distillation loss is as follows: The original scores for teacher classification, quantitative classification, and reference classification are converted into corresponding probabilities. Based on the aforementioned probability, construct basic classification distillation terms; Based on the probability, calculate the probability degradation residual corresponding to the i-th position and the c-th category. Form an effective set A for the position-category pairs with probability degradation residuals greater than 0. If the effective set A is empty, set the calibration coefficient of each position-category pair to 1 and perform distillation training using the basic classification distillation term; otherwise, proceed to the next step. The quantization residual of the original classification score between the original classification score and the reference original classification score is calculated, and the calibration coefficient is calculated based on the probability degradation residual and the quantization residual of the original classification score. The calculation process of the calibration coefficient is performed by applying a stopping gradient. The classification distillation loss is generated based on the calibration coefficients.

[0008] Furthermore, the specific method for converting the original scores for teacher classification, quantitative classification, and reference classification into corresponding probabilities is as follows: ; ; ; Where t is the probability corresponding to the original teacher classification score, and zt is the original teacher classification score. To stop gradient calculation, Let p be the probability corresponding to the original quantized classification score, zq be the original quantized classification score, r be the probability corresponding to the original reference classification score, and zr be the original reference classification score.

[0009] Furthermore, the basic classification distillation item is represented as follows: ; in, For the i-th predicted position and c-th category, the basic classification distillation item, Let represent the binary cross-entropy with the original classification score as the first input and the teacher probability as the objective, internally applying a Sigmoid mapping to the first input. Let be the raw quantitative classification score for the i-th predicted location and the c-th category. Let be the probability corresponding to the original teacher classification score for the i-th predicted position and the c-th category. Quantize the probability corresponding to the original classification score for the i-th predicted position and the c-th category. It is the absolute value symbol. It is the probability difference modulation index.

[0010] Furthermore, the probability degradation residual corresponding to the i-th position and the c-th category is calculated as follows: ; in, Let be the probability degradation residual corresponding to the i-th position and the c-th category. To find the function with the maximum value, For degradation margin; The calculation method for the quantization residual of the original classification score between the original classification score and the reference classification score is as follows: ; in, The residual is quantized to represent the original classification score corresponding to the calculated i-th position and c-th category.

[0011] Furthermore, the calibration coefficient is calculated as follows: ; ; ; ; in, The calibration coefficients corresponding to the i-th position and c-th category are calculated. The preweights are for the i-th position and the c-th category. For calibrating the intensity, Let be the normalized fusion index corresponding to the i-th position and the c-th category. Let be the mask factor corresponding to the i-th position and the c-th category. It takes a value of 1 if the element belongs to the valid set A, and a value of 0 otherwise. The lower bound for pre-weighting. The upper limit of the pre-weighted cutoff is given by f, where f represents the original multi-factor fusion indexes within the effective set A. As the original index for multi-factor fusion, To quantify residuals from raw classification scores The residual factor obtained by normalization This refers to the normalized degradation amount corresponding to the i-th position and c-th category, calculated based on the probability degradation residual. To calculate the mean of all elements in the valid set A, Let be the teacher confidence modulation factor at the i-th position mapped from the teacher confidence level. For numerically stable terms, This indicates that the average value is calculated for all elements of the current layer at all positions and of the same category.

[0012] Furthermore, the method for generating the classified distillation loss is as follows: ; in, For the first Layer-specific distillation losses, The global weight hyperparameters for the classification loss are... Let the label weight be at position i. This represents the total number of positive sample locations.

[0013] Furthermore, step S5 specifically includes: The detection output and native detection supervision of each feature layer of the quantitative student detector are retained. Feature layers are selected according to preset feature layer step size conditions, and localization structure distillation is performed only on the selected feature layers. The positive samples are obtained in each selected feature layer. The output of the corresponding position is extracted from the original scores of the teacher boundary regression and the original scores of the quantized boundary regression. The discrete distance original scores of the four sides of each positive sample are expanded into a row to obtain the teacher regression original score matrix and the student regression original score matrix with the same dimension. The initial sample weights are generated based on the quantization of the student maximum class probability using stopping gradient. They are first normalized by the mean of the positive initial sample weights, then truncated. A weighted mean is defined based on the obtained weights, and stopping gradient is applied to the teacher regression output. Based on the original regression scores of teachers and students, we construct probabilistic shape constraint loss, representation direction constraint loss, and weighted relational statistical constraint loss, respectively. The probabilistic shape constraint loss, the representation direction constraint loss, and the weighted relational statistical constraint loss are combined to obtain the localization structure distillation loss of the selected feature layer, and the localization structure distillation loss of each selected layer is summed.

[0014] Furthermore, the probabilistic shape constraint loss is expressed as: ; ; ; in, For probabilistic shape constraint loss, The KL divergence is calculated for the discrete distance probability distribution of each edge. Let U be the probability distribution on the student side, and U be the element-wise arithmetic mean of the probability distributions on the student side and the teacher side. For the teacher's probability distribution, The weighted mean is defined based on the weights after mean normalization and truncation. The normalized exponential function is calculated row-by-row along the discrete distance dimension of each edge. To regress the original score matrix for students, To regress the original score matrix for teachers, It is a positive distillation temperature coefficient; The loss representing the directional constraint is expressed as: ; in, To represent the directional constraint loss, For L2 vector normalization, For the student to regress the original score matrix, the first... row vectors For the teacher regression of the original score matrix, the first... Row vectors; The weighted relational statistical constraint loss is expressed as: ; ; ; in, To constrain the loss for weighted relational statistics, Weighted covariance matrix for students, Weighted covariance matrix for teachers, Let T be the student-centered matrix, and T be the transpose of the matrix. It is a diagonal matrix. The weights are obtained by mean normalization and truncation of the initial sample weights. The weights obtained by mean normalization and truncation of the initial sample weights in the j-th row are then calculated. It is a teacher-centered matrix.

[0015] Furthermore, the total loss is expressed as: ; ; in, For the total loss, To quantify the native detection loss of the student detector, For the first obtained according to step S4 Layer distillation loss, For the first Distillation loss due to layered positioning structure; It is a set consisting of all detection feature layers. The set of feature layers selected in step S5, and for A subset of; , , These are the weighting coefficients for the three positioning constraint terms. This represents the overall weighting coefficient for the positioning structure distillation; the 2 in the denominator is a fixed scaling factor. It is a small positive constant.

[0016] Beneficial effects: 1. By performing quantization forward and reference forward on the same student features and the same detector head parameters, the difference between the two corresponds to the change in the detector head quantization path; then, by comparing with the teacher probability, direct evidence is provided for identifying the relatively degenerate position and category; thus, the supervisory weights can be redistributed on the basic classification distillation. 2. The calibration coefficient of this invention combines the teacher confidence modulation factor and the quantization residual, first truncates the preweights, and then performs mean normalization, which helps to limit the extreme values ​​of the preweights and control the average scale of the calibration coefficients; the calculation of the calibration coefficients stops the gradient, and the basic probability difference modulation term still retains the student gradient, making the data dependence of weight allocation on student classification learning clear. 3. The localization branches constrain the probability shape, regression representation direction, and weighted relationship between discrete values ​​of a single edge, and use layer selection to control the scope of the additional constraints; the original detection supervision continues to cover all detection layers, and the application position of localization distillation can be adjusted while retaining the original multi-scale detection task. 4. Both branches serve the same quantized student. During deployment, the existing detection structure of the student is used, without the need to run the teacher or reference head for repeated forward passes, nor is it necessary to add a new inference fusion structure dedicated to distillation. During the training phase, the teacher forward pass and one student detection head reference forward pass are required. 5. Under the COCO target detection dataset and W4A4 quantization settings in this embodiment, the present invention improves the mAP of the quantized student detector from 42.5% of the LSQ quantization baseline to 43.8%, an increase of 1.3 percentage points; the AP of medium targets and large targets are improved by 1.2 and 3.0 percentage points respectively, thereby improving the detection accuracy of the low-bit quantization detector. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the target detection low-bit quantization method based on degradation calibration distillation, according to an embodiment of the present invention. Detailed Implementation

[0018] The present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments. These embodiments are implemented based on the technical solutions of the present invention, and it should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention.

[0019] like Figure 1 As shown, this embodiment of the invention provides a low-bit quantization method for target detection based on degradation calibration distillation, comprising: Step S1: Input the training image into the backbone feature extraction network and feature pyramid network (FPN) of the quantized student detector to be trained, and extract the student feature set X; based on the annotation in the training image and the detector sample allocation rules, determine the category label, label weight and positive sample at each prediction position.

[0020] Step S2: Input the training image into the pre-trained teacher detector for forward inference, outputting the original teacher classification score (logits) and the original teacher boundary regression score. The teacher detector parameters remain fixed, and the forward gradient calculation stops. The quantized student detector's head performs forward inference on the student feature set X with quantization enabled, obtaining the original quantized classification score and the original quantized boundary regression score. The teacher detector and the quantized student detector have corresponding prediction positions and category dimensions, and the boundary regression outputs at each prediction position use corresponding discrete distance values.

[0021] Step S3: Reuse the same set of detector head parameters for the student feature set X and the quantized student detector, temporarily disable the quantization operation of the detector head, perform a reference forward pass in the stopped gradient state to obtain the original reference classification score, and then restore the quantization state of the detector head. The reference forward pass still uses the features extracted by the quantized student detector in this step, which is not equivalent to performing a full-precision forward pass on the entire student detector.

[0022] Step S4: Convert the original scores for teacher classification, the original scores for quantitative classification, and the original scores for reference classification into corresponding probabilities, and construct a basic classification distillation term based on the original scores for quantitative classification, the quantitative classification probabilities, and the teacher classification probabilities; compare the deviations between the quantitative classification probabilities and the teacher classification probabilities, and the deviations between the reference classification probabilities and the teacher classification probabilities to determine the probability degradation residuals; when there are position-category pairs with probability degradation residuals greater than zero, calculate the calibration coefficient for the stopping gradient based on the probability degradation residuals and the residuals between the original scores for quantitative classification and the original scores for reference classification, and use the calibration coefficients to weight the basic classification distillation term to obtain the classification distillation loss; when there are no position-category pairs with probability degradation residuals greater than zero, obtain the classification distillation loss based on the basic classification distillation term. The above classification distillation is called degradation-calibrated classification distillation, denoted as DCCD. The specific construction method is as follows: The raw scores for teacher classification, quantitative classification, and reference classification are converted into corresponding probabilities, as follows: ; ; ; Where t is the probability corresponding to the original teacher classification score, and zt is the original teacher classification score. To stop gradient calculation, Let p be the probability corresponding to the original quantized classification score, zq be the original quantized classification score, r be the probability corresponding to the original reference classification score, and zr be the original reference classification score.

[0023] Based on the above probabilities, the basic classification distillation terms are constructed as follows: ; in, For the i-th predicted position and c-th category, the basic classification distillation item, Let represent the binary cross-entropy with the original classification score as the first input and the teacher probability as the objective, internally applying a Sigmoid mapping to the first input. Let be the raw quantitative classification score for the i-th predicted location and the c-th category. Let be the probability corresponding to the original teacher classification score for the i-th predicted position and the c-th category. Quantize the probability corresponding to the original classification score for the i-th predicted position and the c-th category. It is the absolute value symbol. It is the probability difference modulation index.

[0024] Based on the above probabilities, the probability degradation residuals corresponding to the i-th position and the c-th category are calculated as follows: ; in, Let be the probability degradation residual corresponding to the i-th position and the c-th category. To find the function with the maximum value, This is a degradation margin. The residual characterizes the additional deviation of the quantified classification probability from the teacher's classification probability relative to the reference classification probability, and is not the prediction error calculated directly from the true class label.

[0025] Degenerate probability residuals The position-category pairs with values ​​greater than 0 constitute a valid set A. If the valid set A is empty, set the calibration coefficient of each position-category pair to 1, perform distillation training using the basic classification distillation term, and do not perform the following calibration coefficient calculation; otherwise, proceed to the next step.

[0026] The quantized residual of the original classification score between the original classification score and the reference original classification score is calculated as follows: ; in, The residual is quantized to represent the original classification score corresponding to the calculated i-th position and c-th category.

[0027] Then based on the probabilistic degradation residual and the quantification residuals of the original classification scores The calibration coefficients are calculated by applying a stopping gradient, as follows: The normalized degradation amount is calculated based on the probabilistic degradation residual: ; in, This is the normalized degradation amount corresponding to the i-th position and c-th category. To calculate the mean of all elements in the effective set A, let d be the probability degenerate residuals of all elements in the effective set A. This is a numerically stable term, specifically a minimal constant.

[0028] First, take the maximum class probability of the teacher at position i as the teacher confidence level. ,Right now The teacher confidence level is mapped to a teacher confidence level modulation factor as follows: ; in, Let be the teacher confidence modulation factor at the i-th position. This is a truncation function. The teacher confidence score is the maximum probability among all categories for the teacher at the i-th position. The teacher confidence threshold is less than 1. This is a confidence index. To extract the positive part. Embodiments of the present invention. =0.05 =1, so the first branch of the above formula is used. The calculation of the teacher confidence level and its modulation factor both stop at gradient.

[0029] The calibration coefficients are calculated as follows: ; ; ; ; ; in, The calibration coefficients corresponding to the i-th position and c-th category are calculated. The preweights are for the i-th position and the c-th category. For calibrating the intensity, Let be the normalized fusion index corresponding to the i-th position and the c-th category. Let be the mask factor corresponding to the i-th position and the c-th category. It takes a value of 1 if the element belongs to the valid set A, and a value of 0 otherwise. The lower bound for pre-weighting. The upper limit of the pre-weighted cutoff is given by f, where f represents the original multi-factor fusion indexes within the effective set A. As the original index for multi-factor fusion, Let be the normalized residual factor corresponding to the i-th position and the c-th category. To calculate the mean of all position-category elements in the current layer, the preweights are first truncated, and then the mean is normalized. The upper and lower limits of the truncation directly constrain the preweights and do not represent a fixed range of values ​​for the normalized calibration coefficients.

[0030] Based on the above calibration coefficients The classification distillation loss is generated as follows: ; in, For the first Layer-specific distillation losses, The global weight hyperparameters for the classification loss are... Let be the label weight at position i, used to filter out invalid positions. This represents the total number of positive sample locations.

[0031] Step S5: Select the feature layers for structural distillation according to the preset feature layer step size condition. Based on the teacher boundary regression original score and quantization boundary regression original score corresponding to the positive sample positions of each selected feature layer, construct the probability shape, representation direction, and weighted relationship statistical constraints to obtain the structural distillation loss of each selected feature layer, and sum the structural distillation losses. Specifically, as follows: The detection outputs and native detection supervision of each feature layer of the quantized student detector are retained. Feature layers are selected according to preset feature layer step size conditions, and localization structure distillation is performed only on the selected feature layers. In this embodiment, layers with a step size of no more than 16 do not increase the localization structure distillation loss, while layers with step sizes of 32, 64, and 128 increase the loss.

[0032] Positive samples assigned by the quantized student detector are obtained from the selected feature layer. The outputs at the corresponding positions are extracted from the original scores of the teacher boundary regression and the original scores of the quantized boundary regression. The discrete distance original scores of the four sides of each positive sample are expanded into a row to obtain the teacher regression original score matrix. Regression of student original score matrix The dimensions are all M×K; M is four times the number of positive samples in this layer, and K is the number of discrete distance values ​​for each edge.

[0033] Initial sample weights are generated based on the quantized student maximum class probability of the stopping gradient. Specifically, the initial weight of each positive sample is the quantized student maximum class probability of the stopping gradient, and this weight is copied to its four edges to form the initial sample weights: ; in, The initial sample weights for the j-th row are... To obtain the maximum value of the probability of all categories for this sample, i.e., the confidence of the student detector in this target. The j-th row is obtained by expanding one edge corresponding to the positive sample position i, and the initial weight of each positive sample position is copied to its four edges.

[0034] The initial sample weights are first normalized using the mean of positive weights, and then truncated, as specifically expressed as: ; in, The weights are the weights after normalization and truncation of the initial sample weights in the j-th row. This represents the average of all initial sample weights greater than 0, with a lower bound of 1. .

[0035] The weighted mean is calculated based on the normalized and truncated weights, as follows: ; in, This is the weighted mean calculated based on the normalized and truncated weights. The first step between student regression output and teacher regression output Losses.

[0036] A stopping gradient is applied to the teacher regression output, and probabilistic shape constraint loss, representation direction constraint loss, and weighted relational statistical constraint loss are constructed based on the original teacher regression score matrix and the original student regression score matrix, respectively.

[0037] Specifically, the probabilistic shape constraint loss is expressed as: ; ; ; in, For probabilistic shape constraint loss, The KL divergence is calculated for the discrete distance probability distribution of each edge. Let U be the probability distribution on the student side, and U be the element-wise arithmetic mean of the probability distributions on the student side and the teacher side. For the teacher's probability distribution, The normalized exponential function is calculated row-by-row along the discrete distance dimension of each edge. To regress the original score matrix for students, To regress the original score matrix for teachers, The distillation temperature coefficient is positive, preferably 4.

[0038] The direction constraint loss is expressed as: ; in, To represent the directional constraint loss, For L2 vector normalization, For the student's regression to the j-th row vector of the original score matrix, Let be the vector in the j-th row of the teacher regression original score matrix. Here, direction refers only to the direction of the K-dimensional regression representation vector, and does not represent the direction of target motion, physical boundary direction, or contour direction.

[0039] The weighted relational statistical constraint loss is expressed as: ; ; ; in, To constrain the loss for weighted relational statistics, Weighted covariance matrix for students, Weighted covariance matrix for teachers, Let T be the student-centered matrix, and T be the transpose of the matrix. It is a diagonal matrix. The weights are obtained by mean normalization and truncation of the initial sample weights. For the first The initial sample weights are normalized to the mean and truncated to obtain the weights. It is a teacher-centered matrix. and The dimensions of all are M×K. and The dimensions of all matrices are K×K; the square of the matrix difference is the element-wise square. This represents the arithmetic mean of the resulting K×K elements. The teacher-side centering matrix stops the gradient.

[0040] The probabilistic shape constraint loss, representation direction constraint loss, and weighted relational statistical constraint loss are combined to obtain the localization structure distillation loss for the selected feature layer, and the localization structure distillation loss for each selected layer is summed. Specifically, this can be expressed as: ; in, For the first Distillation loss due to layered positioning structure; , , These are the weighting coefficients for the three positioning constraint terms. This represents the overall weighting coefficient for the positioning structure distillation; the 2 in the denominator is a fixed scaling factor. It is a small positive constant; in this embodiment, it is taken as... .

[0041] Step S6: Sum the native detection loss of the quantized student detector, the sum of the classification distillation loss of all detection feature layers, and the sum of the localization structure distillation loss of all selected feature layers to obtain the total loss; based on backpropagation of the total loss, update the network parameters and learnable quantizable parameters of the quantized student detector. The teacher detector and the reference forward do not accept gradients. Specifically, the total loss is expressed as: ; in, For the total loss, To quantify the native detection loss of the student detector, including the original classification, bounding box regression, and distribution regression supervision of the student detector, this embodiment uses quality focus loss, generalized intersection-union loss, and distribution focus loss. It is a set consisting of all detection feature layers. The set of feature layers selected in step S5, and for Subset; Classification of distillation loss pairs Layer summation in the middle, positioning structure distillation loss on The summation of layers.

[0042] Step S7: After training, discard the teacher detector and reference prediction logic, vectorize the student detector, input the image to be detected, and output the target detection result. Output the probability and boundary distance distribution of each layer's categories, convert the expected distribution into boundary distance, decode the bounding box, and output the target category, confidence score, and bounding box according to the original screening and non-maximum suppression process of the detector. The teacher detector, reference forward feed, and distillation loss are only used during training.

[0043] Example:

[0044] 1. Network Selection This embodiment employs the GFL object detection framework, using a full-precision GFL detector with ResNet-101 as the backbone as the teacher network and a GFL detector with ResNet-50 as the student network. The teacher provides supervision with classification probabilities and boundary regression distributions, while the student uses the LSQ learning step size quantization method for quantization-aware training. The bit width of both the quantization weights and quantization activations is set to 4 bits, denoted as W4A4.

[0045] In this embodiment, the GFL detector head outputs the raw classification score and discrete boundary distance distribution, which are used for the aforementioned degradation calibration classification distillation (DCCD) and localization structure distillation, respectively. The teacher detector and student detector employ feature pyramid layers with corresponding spatial positions and step sizes, ensuring that the category and boundary distance distributions at the same predicted location correspond to each other. The teacher detector uses a ResNet-101 backbone, while the student detector uses a ResNet-50 backbone. The student detector is used for quantization perception training and deployment.

[0046] The student feature pyramid consists of five output layers, each with 256 channels and strides of 8, 16, 32, 64, and 128. The classification and regression sub-networks of the detection head both employ four stacked convolutional layers, with a class number C of 80. The discrete distance K for each edge ranges from 0 to 16, with a value of 17. Each prediction location outputs 68 regression logits across four edges.

[0047] 2. Parameter values ​​in the steps Corresponding to steps S2 and S3, the teacher classification logits are used for classification distillation in step S4, and the teacher boundary regression logits are used for localization structure distillation in step S5. Gradient is stopped in both teacher forward passes. The student features and the same set of detector head parameters are reused in the reference forward pass; detector head quantization is only disabled and gradient is stopped in the reference forward pass. After obtaining the reference output, the quantization detection path is restored, the loss of both branches is calculated, and the student is trained together.

[0048] In step S4, the total weight of the classification distillation Set to 1, calibrate intensity The probability difference modulation index β is set to 1, and the teacher confidence threshold is set to 0.5. 0.05, confidence index Set to 1, degradation margin Set to 0, numerical stability term Pick Lower bound of preweighting Take 0.5 to truncate the upper limit. Take 1.5. In step S5, localization structure distillation is only added to layers P5, P6, and P7; layers P3 and P4 continue to participate in the calculation of native detection loss and classification distillation loss. The positive sample localization weights are taken as the student maximum class probability of the stopping gradient, copied to the four edges, and then normalized to the mean of the positive weights. The lower and upper cutoff limits are set to 0.25 and 2, respectively. Distillation temperature coefficient. Choose 4. , , , The weights are set sequentially to 0.5, 1, 0.5, and 5. In step S6, the weights for the quality focus loss in the original detection supervision are set to 1, the modulation index to 2, the generalized intersection-union loss to 2, and the distribution focus loss to 0.25. After training, the target category, confidence score, and bounding box are output using quantized student data according to step S7.

[0049] 3. Verification of testing results Experiments were conducted on the COCO object detection dataset using the GFL-ResNet-101 teacher detector and the GFL-ResNet-50 student detector. The results compared training schemes with LSQ quantization baseline, degenerate calibration classification distillation DCCD, and further localization structure distillation, with the full-precision student detector used as a reference. All quantization schemes used W4A4. Evaluation metrics included the mean accuracy (mAP) within the IoU threshold range of 0.50 to 0.95, and the mean accuracy for small, medium, and large targets, denoted as AP. S AP m And AP1. All accuracy indicators are expressed as percentages, and the results are shown in Table 1.

[0050] Table 1. Detection results of different training schemes ; As shown in Table 1, after adding DCCD, the mAP of the quantized student detector increased from 42.5% to 43.7%, an increase of 1.2 percentage points; after further adding positioning structure distillation, the mAP increased to 43.8%, an increase of 0.1 percentage points compared with only adding DCCD, a cumulative increase of 1.3 percentage points compared with the LSQ quantization baseline, and an increase of 0.9 percentage points compared with the full-precision student detector of 42.9%.

[0051] At different target scales, the AP for medium targets in the dual-branch scheme of this invention increased from 46.6% to 47.8%, and the AP for large targets increased from 53.4% ​​to 56.4%, representing increases of 1.2 and 3.0 percentage points, respectively; the AP for small targets decreased from 27.3% to 27.2%. These results indicate that, under the settings of this embodiment, this invention can improve the overall detection performance of the quantization detector, with the performance gain mainly reflected in the detection of medium and large targets.

[0052] 4. Compare the detection results with those of the selected method. Table 2 lists the comparison results on the COCO dataset, the GFL-ResNet-50 student detector, and the LSQ four-bit quantization setting. The comparison methods include the quantization optimization method HQOD, the classification and localization coordination method HarDet, and knowledge distillation methods such as MGD, CWD, PKD, LD, and BCKD; among them, the distillation scheme using the teacher model employs the GFL-ResNet-101 teacher detector. This invention adopts a two-branch training scheme combining DCCD and localization structure distillation.

[0053] Table 2. Detection results of the selected comparison methods ; As shown in Table 2, the mAP of the dual-branch scheme of this invention is 43.8%, which is 0.8 and 0.9 percentage points higher than HQOD and HarDet, respectively, and 0.7, 1.6, 0.7, 0.5, and 1.7 percentage points higher than MGD, CWD, PKD, LD, and BCKD, respectively. Among the other comparison methods listed, LD has the highest mAP, but this invention still improves it by 0.5 percentage points. The AP for large targets of this invention reaches 56.4%, higher than the other comparison methods in the table; the AP for medium targets is 47.8%, slightly lower than HarDet's 47.9%; and the AP for small targets is 27.2%, lower than HQOD and HarDet. These results demonstrate that, under the comparison settings of this embodiment, this invention has advantages in overall detection accuracy and large target detection accuracy.

[0054] The above description is merely a preferred embodiment of the present invention. It should be noted that for those skilled in the art, other parts not specifically described are existing technology or common knowledge. Several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A low-bit quantization method for target detection based on degenerate calibration distillation, characterized in that, include: Step S1: Input the training images into the quantized student detector to be trained, and extract the student feature set X; And determine the category label, label weight, and positive samples for each predicted location; Step S2: Input the training image into the pre-trained teacher detector to obtain the original scores for teacher classification and teacher boundary regression. During this process, the parameters remain fixed and the forward calculation stops the gradient. The detection head of the quantized student detector performs forward inference on the student feature set X in the quantization enabled state to obtain the original scores for quantized classification and quantized boundary regression. Step S3: Reuse the student feature set X with the same set of detection head parameters, temporarily disable the quantization operation of the detection head, and run the detection head again in the stopped gradient state to obtain the original score of the reference classification. Step S4: Construct a classification distillation loss based on the original scores of the teacher classification, the original scores of the quantified classification, and the original scores of the reference classification; Step S5: Select the feature layer for positioning structure distillation according to the preset feature layer step size condition, and calculate the positioning structure distillation loss of each selected feature layer. Step S6: Calculate the total loss based on the native detection loss, classification distillation loss, and localization structure distillation loss of the quantized student detector; Based on backpropagation of total loss, update the network parameters and learnable quantization parameters of the quantized student detector. Step S7: After training is complete, discard the teacher detector and the reference prediction operation logic, vectorize the student detector, input the image to be detected, and output the target detection result.

2. The target detection low-bit quantization method based on degenerate calibration distillation according to claim 1, characterized in that, The method for constructing the classified distillation loss is as follows: The original scores for teacher classification, quantitative classification, and reference classification are converted into corresponding probabilities. Based on the aforementioned probability, construct basic classification distillation terms; Based on the probability, calculate the probability degradation residual corresponding to the i-th position and the c-th category. Form an effective set A for the position-category pairs with probability degradation residuals greater than 0. If the effective set A is empty, set the calibration coefficient of each position-category pair to 1 and perform distillation training using the basic classification distillation term; otherwise, proceed to the next step. The quantization residual of the original classification score between the original classification score and the reference original classification score is calculated, and the calibration coefficient is calculated based on the probability degradation residual and the quantization residual of the original classification score. The calculation process of the calibration coefficient is performed by applying a stopping gradient. The classification distillation loss is generated based on the calibration coefficients.

3. The low-bit quantization method for target detection based on degenerate calibration distillation according to claim 2, characterized in that, The specific method for converting the original scores for teacher classification, quantitative classification, and reference classification into corresponding probabilities is as follows: ; ; ; Where t is the probability corresponding to the original teacher classification score, and zt is the original teacher classification score. To stop gradient calculation, Let p be the probability corresponding to the original quantized classification score, zq be the original quantized classification score, r be the probability corresponding to the original reference classification score, and zr be the original reference classification score.

4. The low-bit quantization method for target detection based on degenerate calibration distillation according to claim 3, characterized in that, The basic classification distillation item is represented as follows: ; in, For the i-th predicted position and c-th category, the basic classification distillation item, Let represent the binary cross-entropy with the original classification score as the first input and the teacher probability as the objective, internally applying a Sigmoid mapping to the first input. Let be the raw quantitative classification score for the i-th predicted location and the c-th category. Let be the probability corresponding to the original teacher classification score for the i-th predicted position and the c-th category. Quantize the probability corresponding to the original classification score for the i-th predicted position and the c-th category. It is the absolute value symbol. It is the probability difference modulation index.

5. The target detection low-bit quantization method based on degenerate calibration distillation according to claim 4, characterized in that, The probability degradation residual corresponding to the i-th position and the c-th category is calculated as follows: ; in, Let be the probability degradation residual corresponding to the i-th position and the c-th category. To find the function with the maximum value, For degradation margin; The calculation method for the quantization residual of the original classification score between the original classification score and the reference classification score is as follows: ; in, The residual is quantized to represent the original classification score corresponding to the calculated i-th position and c-th category.

6. The low-bit quantization method for target detection based on degenerate calibration distillation according to claim 5, characterized in that, The calibration coefficient is calculated as follows: ; ; ; ; in, The calibration coefficients are calculated for the i-th position and the c-th category. The preweights are for the i-th position and the c-th category. For calibrating the intensity, Let be the normalized fusion index corresponding to the i-th position and the c-th category. Let be the mask factor corresponding to the i-th position and the c-th category. It takes a value of 1 if the element belongs to the valid set A, and a value of 0 otherwise. The lower bound for pre-weighting. The upper limit of the pre-weighted cutoff is given by f, where f represents the original multi-factor fusion indexes within the effective set A. As the original index for multi-factor fusion, To quantify residuals from raw classification scores The residual factor obtained by normalization This refers to the normalized degradation amount corresponding to the i-th position and c-th category, calculated based on the probability degradation residual. To calculate the mean of all elements in the valid set A, Let be the teacher confidence modulation factor at the i-th position mapped from the teacher confidence level. For numerically stable terms, This indicates that the average value is calculated for all elements of the current layer at all positions and of the same category.

7. The low-bit quantization method for target detection based on degenerate calibration distillation according to claim 6, characterized in that, The method for generating the classified distillation loss is as follows: ; in, For the first Layer-specific distillation losses, The global weight hyperparameters for the classification loss are... Let the label weight be at position i. This represents the total number of positive sample locations.

8. The low-bit quantization method for target detection based on degenerate calibration distillation according to claim 6, characterized in that, Step S5 specifically includes: The detection output and native detection supervision of each feature layer of the quantitative student detector are retained. Feature layers are selected according to preset feature layer step size conditions, and localization structure distillation is performed only on the selected feature layers. The positive samples are obtained in each selected feature layer. The output of the corresponding position is extracted from the original scores of the teacher boundary regression and the original scores of the quantized boundary regression. The discrete distance original scores of the four sides of each positive sample are expanded into a row to obtain the teacher regression original score matrix and the student regression original score matrix with the same dimension. The initial sample weights are generated based on the quantization of the student maximum class probability using stopping gradient. They are first normalized by the mean of the positive initial sample weights, then truncated. A weighted mean is defined based on the obtained weights, and stopping gradient is applied to the teacher regression output. Based on the original regression scores of teachers and students, we construct probabilistic shape constraint loss, representation direction constraint loss, and weighted relational statistical constraint loss, respectively. The probabilistic shape constraint loss, the representation direction constraint loss, and the weighted relational statistical constraint loss are combined to obtain the localization structure distillation loss of the selected feature layer, and the localization structure distillation loss of each selected layer is summed.

9. A low-bit quantization method for target detection based on degenerate calibration distillation according to claim 8, characterized in that, The probabilistic shape constraint loss is expressed as: ; ; ; in, For probabilistic shape constraint loss, The KL divergence is calculated for the discrete distance probability distribution of each edge. For the student side probability distribution, This is the element-wise arithmetic mean of the probability distributions for students and teachers. For the teacher's probability distribution, The weighted mean is defined based on the weights after mean normalization and truncation. The normalized exponential function is calculated row-by-row along the discrete distance dimension of each edge. To regress the original score matrix for students, To regress the original score matrix for teachers, It is a positive distillation temperature coefficient; The loss representing the directional constraint is expressed as: ; in, To represent the directional constraint loss, For L2 vector normalization, For the student to regress the original score matrix, the first... row vectors For the teacher regression of the original score matrix, the first... Row vectors; The weighted relational statistical constraint loss is expressed as: ; ; ; in, To constrain the loss for weighted relational statistics, Weighted covariance matrix for students, Weighted covariance matrix for teachers, Let T be the student-centered matrix, and T be the transpose of the matrix. It is a diagonal matrix. The weights are obtained by mean normalization and truncation of the initial sample weights. The weights obtained by mean normalization and truncation of the initial sample weights in the j-th row are then calculated. It is a teacher-centered matrix.

10. A low-bit quantization method for target detection based on degenerate calibration distillation according to claim 9, characterized in that, The total loss is expressed as: ; ; in, For the total loss, To quantify the native detection loss of the student detector, For the first obtained according to step S4 Layer distillation loss, For the first Distillation loss due to layered positioning structure; It is a set consisting of all detection feature layers. The set of feature layers selected in step S5, and for A subset of; , , These are the weighting coefficients for the three positioning constraint terms. This represents the overall weighting coefficient for the positioning structure distillation; the 2 in the denominator is a fixed scaling factor. It is a small positive constant.