A low-bit quantization method, system, device and medium for a YOLO target detection model
By employing sparse quantization and task regularization strategies to perform low-bit quantization on the YOLO object detection model, the performance and efficiency issues of the YOLO series models when deployed on edge devices are resolved. This achieves high-precision low-bit quantization, reduces inference latency and energy consumption, and is suitable for edge devices and real-time detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NAT UNIV OF DEFENSE TECH
- Filing Date
- 2026-04-10
- Publication Date
- 2026-07-14
Smart Images

Figure CN122024012B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and computer vision technology, and in particular to a low-bit quantization method, system, device and medium for YOLO object detection models. Background Technology
[0002] Object detection has been widely applied in fields such as autonomous driving, smart security, industrial quality inspection, and medical image analysis. Its core task is to achieve rapid and accurate target localization and classification, and model performance directly determines the system's real-time performance and reliability. Due to its end-to-end, one-stage detection characteristics and good balance between speed and accuracy, the YOLO series models have become the mainstream choice in these scenarios. However, with the proliferation of edge devices and mobile terminals, models face stringent limitations in terms of computing power, storage, and energy consumption. This makes model compression technology crucial for ensuring the efficient deployment and widespread applicability of object detection models.
[0003] Existing object detection models, when deployed to resource-constrained edge devices, are limited by computing power, storage space, and energy consumption, typically requiring model compression and quantization techniques to achieve efficient inference. However, mainstream post-training quantization (PTQ) methods are mostly designed for image classification tasks and lack consideration for the characteristics of detection tasks.
[0004] When such methods are directly applied to YOLO series end-to-end detection models, significant performance degradation occurs, mainly in the following aspects: (1) Due to task heterogeneity and the core role of intersection-to-union ratio (IoU) in bounding box overlap calculation, the detection model is much more sensitive to quantization error than the classification model; (2) The activation distribution of the YOLO model exhibits significant long-tail characteristics, and the SiLU activation function exacerbates this problem, further complicating low-bit quantization; (3) The detection head structure is complex, containing multi-scale, multi-task parallel branches. The traditional unified quantization granularity cannot take into account the heterogeneous characteristics of different sub-modules, resulting in an imbalance in quantization accuracy.
[0005] Therefore, how to achieve a balance between performance and efficiency under low bit quantization conditions is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] To address the aforementioned issues, this invention provides a low-bit quantization method, system, device, and medium for YOLO target detection models. This method enables high-precision low-bit quantization of YOLO series models without retraining the model, effectively reducing inference latency and energy consumption while maintaining detection accuracy close to that of the full-precision model. It is particularly suitable for edge devices and real-time detection scenarios.
[0007] The first objective of this invention is to provide a low-bit quantization method for YOLO target detection models;
[0008] The technical solution provided by this invention is as follows:
[0009] A low-bit quantization method for YOLO object detection models includes the following steps:
[0010] The activation distribution of the YOLO target detection model is sparsely quantized and inferred using a sparse quantization strategy to obtain the target output.
[0011] After sparse quantization inference is completed, a large number of convolution weights in the Backbone–Neck region are compressed to low bits using a task regularization strategy.
[0012] The detection head of the YOLO object detection model is functionally deconstructed based on the scale × task path paradigm using a head quantization strategy.
[0013] Preferably, the step of performing sparse quantization inference on the activation distribution of the YOLO target detection model using a sparse quantization strategy to obtain the target output specifically includes:
[0014] An adaptive cutoff threshold is selected based on the activation distribution;
[0015] The activation distribution is divided into a primary activation portion and a long-tail activation portion;
[0016] The main activation portion is then subjected to low-bit quantized convolution to obtain the first result;
[0017] The long-tail activation portion is sparsely convolved to obtain the second result;
[0018] The target output is obtained based on the first result and the second result.
[0019] Preferably, after sparse quantization inference is completed, the process of performing low-bit compression on the large number of convolutional weights in the Backbone-Neck region using a task regularization strategy specifically includes:
[0020] The task loss is constructed at the detection head level;
[0021] Based on the task loss, a large number of convolutional weights in the Backbone–Neck region are compressed to low bits.
[0022] Preferably, the task loss for constructing the detection head level specifically includes:
[0023] The task loss at the detection head level is constructed using bounding box regression loss, classification loss, and target confidence loss. The specific calculation formula is as follows:
[0024] ;
[0025] in, This represents the number of positive sample detection boxes; This represents the bounding box regression loss; This represents the classification loss; This represents the target confidence loss; The weighting coefficients represent the bounding box regression loss; The weighting coefficients represent the classification loss. The weighting coefficient represents the loss of target confidence.
[0026] Preferably, both the classification loss and the target confidence loss are obtained by optimizing the cross-entropy loss.
[0027] Preferably, the bounding box regression loss is obtained through CIoU loss, and the specific calculation formula for the bounding box regression loss is as follows:
[0028] ;
[0029] in, Represents the bounding box predicted by the full-precision model; This represents the output of sparse quantization inference; This represents the Euclidean distance between their centers; This represents the diagonal length of the smallest bounding rectangle that covers both boxes; This indicates that the consistency of the aspect ratio has been quantified; This represents a positive trade-off parameter.
[0030] Preferably, the step of functionally deconstructing the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy specifically includes:
[0031] The detection head of the YOLO target detection model is divided into six sub-modules according to the scale × task path paradigm;
[0032] The final output of the submodule is used to reconstruct the error in order to construct an optimization objective for the submodule.
[0033] The second objective of this invention is to provide a low-bit quantization system for the YOLO target detection model;
[0034] The technical solution provided by this invention is as follows:
[0035] A low-bit quantization system for YOLO object detection models includes: a quantization inference module, a compression module, and a deconstruction module;
[0036] The quantization inference module is used to perform sparse quantization inference on the activation distribution of the YOLO target detection model through a sparse quantization strategy in order to obtain the target output.
[0037] The compression module is used to perform low-bit compression on a large number of convolutional weights in the Backbone-Neck region after sparse quantization inference is completed, using a task regularization strategy.
[0038] The deconstruction module is used to functionally deconstruct the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy.
[0039] The third objective of this invention is to provide an electronic device;
[0040] The technical solution provided by this invention is as follows:
[0041] An electronic device, comprising:
[0042] At least one processor; and
[0043] A memory communicatively connected to the at least one processor, the memory storing a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method steps of any one of the low-bit quantization methods for the YOLO object detection model.
[0044] A fourth objective of this invention is to provide a computer-readable storage medium;
[0045] The technical solution provided by this invention is as follows:
[0046] A computer-readable storage medium for storing a computer program for causing a computer to perform the steps of any one of the low-bit quantization methods for a YOLO object detection model.
[0047] Compared with existing technologies, this invention provides a low-bit quantization method for YOLO object detection models, comprising the following steps: performing sparse quantization inference on the activation distribution of the YOLO object detection model using a sparse quantization strategy to obtain the target output; after the sparse quantization inference is completed, performing low-bit compression on a large number of convolutional weights in the Backbone-Neck region using a task regularization strategy; and performing functional deconstruction of the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy. This method can achieve high-precision low-bit quantization of YOLO series models without retraining the model, effectively reducing inference latency and energy consumption, while maintaining detection accuracy close to that of the full-precision model, making it particularly suitable for edge devices and real-time detection scenarios.
[0048] This invention also provides a low-bit quantization system for the YOLO target detection model. Since this system and the low-bit quantization method for the YOLO target detection model solve the same technical problem and belong to the same technical concept, they should have the same beneficial effects, and will not be described in detail here. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 A flowchart illustrating a low-bit quantization method for a YOLO target detection model, as provided in one embodiment;
[0051] Figure 2 A flowchart illustrating the overall execution of a low-bit quantization method for a YOLO target detection model, as provided in one embodiment.
[0052] Figure 3 A flowchart of sparse quantization inference provided for one embodiment;
[0053] Figure 4 A percentage diagram of the number of detection head parameters provided in one embodiment;
[0054] Figure 5 A line graph comparing the reconstruction loss of a layer-by-layer strategy and a STAHQ strategy provided in one embodiment;
[0055] Figure 6 A structural diagram of a low-bit quantization system for a YOLO target detection model provided in one embodiment;
[0056] Figure 7 This is a schematic diagram of the structure of an electronic device provided in one embodiment. Detailed Implementation
[0057] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] like Figures 1 to 2As shown in the figure, an embodiment of the present invention provides a low-bit quantization method for YOLO target detection models, comprising the following steps:
[0059] S1. Perform sparse quantization inference on the activation distribution of the YOLO target detection model using a sparse quantization strategy to obtain the target output;
[0060] S2. After sparse quantization inference is completed, the large number of convolution weights in the Backbone–Neck region are compressed to low bit size using a task regularization strategy.
[0061] S3. The detection head of the YOLO object detection model is functionally deconstructed according to the scale × task path paradigm using a head quantization strategy.
[0062] In step S1, a sparse quantization mechanism is first introduced to eliminate the impact of long-tailed activations on quantization accuracy by addressing the activation distribution generated by the various basic layers (such as convolutional layers and normalized layers) at the lowest level of the model. Through adaptive threshold detection and activation sparsification, the activation dynamic range is significantly reduced, providing more stable numerical characteristics for subsequent deep quantization of the network.
[0063] In step S2, during the backbone and feature fusion layer (Neck) stages, the network is mainly responsible for feature extraction and multi-scale feature fusion; quantization errors in this process directly affect the semantic expressiveness of the detection task. To address this, a regularization mechanism based on detection task awareness is designed, which allows weight quantization to consider both the importance of feature gradients and the task loss related to IoU, thereby maintaining the discriminative power of the backbone features while compressing the model.
[0064] In step S3, the detection head directly outputs the bounding box coordinates and class prediction, which is most sensitive to quantization noise. To address the severe performance degradation caused by traditional quantization strategies at the detection head, a dedicated quantization method based on scale adaptation and task awareness is proposed. This method jointly considers the regression scale, feature distribution, and IoU-related loss, enabling the head quantization to maintain accurate localization and classification capabilities even under low bit conditions.
[0065] In this embodiment, the quantization of a floating-point number is mainly based on three parameters: scaling factor (Scale s), zero-point (Z), and bit-width (Bit-width b). Here, s is a floating-point number representing the ratio between real and integer values; z is an integer representing the integer corresponding to zero after quantization, which reduces errors caused by zero-padding or ReLU operations; and b is also an integer representing the bit width of the quantization, with lower bit widths increasing the difficulty of quantization. However, quantization always introduces errors. The following formula represents the pseudo-quantized floating-point number obtained after quantization and dequantization of a floating-point number x. This is also the value used in actual quantitative reasoning. Operations like clip can lead to... There is a certain error between x and quantization. By using the above method, the quantization error can be reduced, thereby achieving low-bit-width quantization of the regression model.
[0066] ;
[0067] A regression model can be divided into three parts: the backbone, the feature fusion layer (Neck), and the head. Each part consists of many modules, each containing one or more layers, with the layer being the most basic module. The inference process of the model is as follows: First, the activations are calculated by the layers in the backbone. After calculation by multiple layers, the activations of the modules are obtained. The activations of the backbone are then processed by multiple modules. Next, the feature fusion layer (Neck) processes the activations of the backbone, and the head (Head) processes the activations of the feature fusion layer (Neck).
[0068] Compared with existing technologies, the above method can achieve high-precision low-bit quantization of YOLO series models without retraining the model, effectively reducing inference latency and energy consumption, while maintaining detection accuracy close to that of the full-precision model, making it particularly suitable for edge devices and real-time detection scenarios.
[0069] Preferably, the step of performing sparse quantization inference on the activation distribution of the YOLO target detection model using a sparse quantization strategy to obtain the target output specifically includes:
[0070] An adaptive cutoff threshold is selected based on the activation distribution;
[0071] The activation distribution is divided into a primary activation portion and a long-tail activation portion;
[0072] The main activation portion is then subjected to low-bit quantized convolution to obtain the first result;
[0073] The long-tail activation portion is sparsely convolved to obtain the second result;
[0074] The target output is obtained based on the first result and the second result.
[0075] In practical applications, during conventional reasoning, the calculation of a layer can be represented as:
[0076] ;
[0077] Input activation With weight Convolution yields the output However, in regression-based detection models, activations often exhibit a pronounced long-tailed distribution. This necessitates that the quantizer cover a very wide range of values, resulting in a large number of small-amplitude activations being compressed to the same quantization level, ultimately leading to loss of detail and amplification of quantization errors.
[0078] To alleviate this problem, a sparse quantization strategy based on activation truncation and precision allocation is proposed. The core idea is to use efficient low-bit quantization for high-density small activations, while retaining sparse but large-amplitude long-tail activations separately and calculating them with high precision. For example... Figure 3 As shown, this sparse quantization strategy first adaptively selects a cutoff threshold based on the activation distribution, dividing the activation into:
[0079] Main activation part This part has a high proportion and concentrated values, making it safe to perform low-bit quantization convolution.
[0080] Long tail activation part Although few in number, they are crucial to the model's expression, so their original accuracy is preserved and they are computed through sparse convolution.
[0081] Subsequently, the inference process of the layer is split into two branches: one branch performs efficient low-bit quantized convolutions, and the other branch processes a small number of high-precision sparse activations. Thanks to the linear additivity of convolutions, the computation results of the two branches can be directly added to reconstruct an output that is completely equivalent to the original convolution.
[0082] This differentiated quantization method can specifically protect the key information of long-tail activations, while significantly reducing the quantization overhead of most activations. It effectively improves the numerical stability and quantization accuracy of the model in long-tail activation scenarios while maintaining inference efficiency.
[0083] Preferably, after sparse quantization inference is completed, the process of performing low-bit compression on the large number of convolutional weights in the Backbone-Neck region using a task regularization strategy specifically includes:
[0084] The task loss is constructed at the detection head level;
[0085] Based on the task loss, a large number of convolutional weights in the Backbone–Neck region are compressed to low bits.
[0086] In practical applications, after sparse quantization of layer-level activations, robust low-bit compression of the numerous convolutional weights in the Backbone and Neck is also required. Traditional post-training quantization (PTQ) methods typically employ an optimization objective primarily focused on reconstruction error, i.e., fine-tuning the quantization parameters by minimizing the Euclidean distance between features before and after quantization. This objective can be approximated by Taylor expansion, meaning that the quantization error in the local region mainly manifests as a second-order perturbation of the output features. A second-order approximation model of the final task loss relative to the quantization perturbation is established, as shown in the following equation:
[0087] ;
[0088] in Representation module The output, It's the difference in output before and after quantization. Corresponding to task loss regarding The Hessian matrix. Because the Hessian matrix is too large, its calculation is usually approximated by the diagonal of the Fisher Information Matrix (FIM).
[0089] ;
[0090] While this approach performs well in classification tasks, its effectiveness is significantly limited for object detection models. This paradigm ignores a crucial fact: in object detection, the relationship between feature reconstruction and final detection performance is not linear. This is because the detection task includes two sub-tasks: classification prediction and bounding box regression. Especially in the regression part, small deviations in the predicted box positions are nonlinearly amplified in the Intersection over Union (IoU) calculation, causing a sharp drop in performance. Traditional feature reconstruction losses cannot reflect this geometric constraint relationship and therefore cannot effectively guide quantization optimization in detection tasks. Based on this, a regularization strategy guided by the detection head task loss is proposed to guide gradient learning of local reconstruction errors. The task loss at the detection head level is defined. This method measures the structural difference in prediction results between a pre-trained, full-precision YOLO model and a quantized version of that pre-trained model. The strategy introduces a regularization term related to the detection task during the quantization calibration phase, ensuring that weight quantization maintains feature approximation while prioritizing the fidelity of gradient directions, spatial structure, and scale semantics relevant to object detection. This significantly mitigates the task shift caused by quantization in the backbone-neck region and better maintains the effectiveness of the detection head's input features, thereby improving overall quantization accuracy.
[0091] Preferably, the task loss for constructing the detection head level specifically includes:
[0092] The task loss at the detection head level is constructed using bounding box regression loss, classification loss, and target confidence loss. The specific calculation formula is as follows:
[0093] ;
[0094] in, This represents the number of positive sample detection boxes; This represents the bounding box regression loss; This represents the classification loss; This represents the target confidence loss; The weighting coefficients represent the bounding box regression loss; The weighting coefficients represent the classification loss. The weighting coefficient represents the loss of target confidence.
[0095] In practical applications, this loss function consists of three parts: bounding box regression loss. Classification loss and target confidence loss The loss function The overall expression is as follows:
[0096] ;
[0097] in, This represents the number of positive sample detection boxes; The weighting coefficients represent the bounding box regression loss; The weighting coefficients represent the classification loss. This represents the weighting coefficients of the target confidence loss. For the classification and confidence branches, cross-entropy (CE) loss is used for optimization. For the regression branch, CIoU (Complete IoU) loss is introduced as... To better capture structural differences, the specific formula is as follows:
[0098] ;
[0099] in, This represents the bounding box predicted by the full-precision model. This represents the output of sparse quantization inference. This represents the Euclidean distance between their centers; This represents the diagonal length of the smallest bounding rectangle that covers both boxes. This indicates that the consistency of the aspect ratio has been quantified. To represent a positive tradeoff parameter, they are defined as follows:
[0100] ;
[0101] ;
[0102] Therefore, the first Total fine-tuning loss for each module for:
[0103] ;
[0104] in, For structure-guided terms based on local reconstruction errors, To detect task-oriented regularization terms, both methods are jointly optimized to guide the fine-tuning of quantization parameters in local modules towards greater structural robustness. In this embodiment, the full-precision model represents an existing pre-trained full-precision YOLO model.
[0105] Preferably, the step of functionally deconstructing the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy specifically includes:
[0106] The detection head of the YOLO target detection model is divided into six sub-modules according to the scale × task path paradigm;
[0107] The final output of the submodule is used to reconstruct the error in order to construct an optimization objective for the submodule.
[0108] In practical applications, after quantizing the backbone and the neck, the detection head of the YOLO series models remains the main bottleneck in the overall quantization process. Many existing lightweight or quantization studies, due to difficulties in handling the structural complexity and quantization sensitivity of the detection head, typically choose to skip the quantization of the detection head and only optimize the backbone or the backbone + neck. However, this approach is not reasonable for object detection tasks.
[0109] like Figure 4As shown, the proportion of parameters in the detection head in the YOLO model is not negligible: it accounts for as much as 19.8% in YOLOv5, and even in the more efficient YOLOv12 with its attention mechanism, this proportion remains at 9.1%. This means that the detection head not only has a significant presence in terms of parameter scale, but also undertakes high-density convolutional computations and task output processing. Its computational cost and energy consumption are equally significant in edge device deployment scenarios. Therefore, if the strategy of "non-quantization" or "no need for quantization" of the detection head continues, the overall speedup of the model in edge inference will inevitably be limited, ultimately affecting real-time performance, power consumption, and deployment costs. Based on this, achieving high-fidelity low-bit quantization of the detection head is not only an important step in further compressing the YOLO model, but also a key link in building a truly efficient end-to-end detection model.
[0110] Based on the systematic analysis of the YOLO detection head structure, it was found that it exhibits significant heterogeneity, mainly in the following three aspects: (1) Multi-scale structure: The feature responses of small, medium and large targets are processed at different scales, and their statistical characteristics are significantly different; (2) Multi-output branches: Both classification and regression outputs are generated at the same scale; (3) Multi-task nature: The classification task focuses on semantic distinction, while the regression task focuses on geometric accuracy. The two have essential differences in numerical space, activation dynamic range and error sensitivity.
[0111] In this highly heterogeneous architecture, the sensitivity of each convolutional module to quantization perturbations exhibits significant unevenness. Some modules are exceptionally sensitive to quantization errors, while others are relatively robust. This imbalance not only undermines the assumptions of traditional layer-by-layer quantization strategies but also makes it difficult to directly apply mainstream block-wise reconstruction granularity to detector heads. This is because such strategies rely on the similarity of statistical properties between modules, while cross-scale and cross-task differences in detector heads prevent reconstruction errors from being effectively propagated between layers, ultimately leading to significant performance degradation.
[0112] To address the aforementioned issues, a scale-and-task-aware head-wise (STAHQ) strategy is proposed. This strategy functionally deconstructs the YOLO detection head according to a scale × task path paradigm, dividing it into six sub-modules (i.e., three scales × two tasks). These functional sub-modules serve as new basic units for quantization, making the quantization process more consistent with the semantic structure and task logic of the detection head.
[0113] Building upon this foundation, STAHQ departs from the traditional layer-by-layer independent reconstruction approach, instead jointly optimizing the final output reconstruction error of the entire submodule. By constructing an optimization objective oriented towards the entire module, STAHQ enables the transmission, sharing, and compensation of error information within submodules, forming a cross-layer collaborative global quantization optimization mechanism. This mechanism avoids the excessive reliance on local optima for layer-by-layer quantization, allowing the quantization process to adaptively adjust the quantization tolerances of different layers, collectively serving the final detection accuracy of the entire module.
[0114] like Figure 5 As shown, where, Figure 5 (a) represents the layer-by-layer reconstruction error of each layer of the detection head; Figure 5 (b) represents the reconstruction loss in the functional submodule, obtained by comparing STAHQ (red) with the traditional layer-by-layer optimization method (green). Experimental results show that the STAHQ strategy, by introducing controllable local error tolerance in selected convolutional layers, achieves optimization at the submodule level, effectively reducing the reconstruction error of the functional submodule. This method overcomes the limitations of traditional layer-by-layer optimization, namely, the inconsistency between focusing on minimizing local errors and global performance, and the neglect of the potential to utilize inter-module similarity at the block level. By achieving cross-layer error coordination, the proposed strategy achieves balanced reconstruction quality across task-specific submodules.
[0115] like Figure 6 As shown, an embodiment of the present invention provides a low-bit quantization system for the YOLO target detection model, comprising: a quantization inference module, a compression module, and a destructuring module;
[0116] The quantization inference module is used to perform sparse quantization inference on the activation distribution of the YOLO target detection model through a sparse quantization strategy in order to obtain the target output.
[0117] The compression module is used to perform low-bit compression on a large number of convolutional weights in the Backbone-Neck region after sparse quantization inference is completed, using a task regularization strategy.
[0118] The deconstruction module is used to functionally deconstruct the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy.
[0119] In practical applications, the low-bit quantization system for the YOLO object detection model comprises a quantization inference module, a compression module, and a deconstruction module. The compression module is connected to both the quantization inference and deconstruction modules. The quantization inference module performs sparse quantization inference on the activation distribution of the YOLO object detection model using a sparse quantization strategy to obtain the target output, and then transmits the signal with completed sparse quantization inference to the compression module. After completing sparse quantization inference, the compression module performs low-bit compression on the numerous convolutional weights in the Backbone-Neck region using a task regularization strategy, and then transmits the low-bit compressed signal to the deconstruction module. The deconstruction module then performs functional deconstruction of the YOLO object detection model's detection head according to the scale × task path paradigm using a head quantization strategy. This system enables high-precision low-bit quantization of YOLO series models without retraining the model, effectively reducing inference latency and energy consumption while maintaining detection accuracy close to that of the full-precision model, making it particularly suitable for edge devices and real-time detection scenarios.
[0120] Furthermore, embodiments of this application also disclose an electronic device, Figure 7 This is a structural diagram of an electronic device according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of use of this application.
[0121] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of this application. The electronic device 20 specifically includes: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the low-bit quantization method for the YOLO target detection model disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment can specifically be an electronic computer.
[0122] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a low-bit quantization channel for the electronic device 20 to communicate with external devices for the YOLO target detection model, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0123] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222 and data 223, etc., and the storage method can be temporary storage or permanent storage.
[0124] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform operations and processing on the data 223 in the memory 22. It can be Windows Server, Netware, Unix, Linux, etc. The computer program 222, in addition to including a computer program capable of performing the low-bit quantization method for the YOLO target detection model executed by the electronic device 20 as disclosed in any of the foregoing embodiments, may further include computer programs capable of performing other specific tasks. The data 223 may include data received by the low-bit quantization device for the YOLO target detection model from external devices, and may also include data collected by its own input / output interface 25.
[0125] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0126] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned low-bit quantization method for the YOLO object detection model. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0127] It should be understood that the use of terms such as "method," "apparatus," "unit," and / or "module" in this application is merely to distinguish one method of different components, elements, parts, sections, or assemblies at different levels. However, if other terms can achieve the same purpose, they may be replaced by other expressions.
[0128] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "a," and / or "the" are not specifically singular and may include the plural. Generally, the terms "comprising" and "including" only indicate the inclusion of expressly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements. An element defined by the phrase "comprising an..." does not exclude the presence of other identical elements in the process, method, product, or apparatus that includes the element.
[0129] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0130] If a flowchart is used in this application, it is used to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, the steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.
[0131] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A low-bit quantization method for YOLO object detection models, characterized in that, Includes the following steps: The activation distribution of the YOLO target detection model is sparsely quantized and inferred using a sparse quantization strategy to obtain the target output. After sparse quantization inference is completed, a large number of convolution weights in the Backbone–Neck region are compressed to low bits using a task regularization strategy. The detection head of the YOLO object detection model is functionally deconstructed based on the scale × task path paradigm using a head quantization strategy. The step of performing sparse quantization inference on the activation distribution of the YOLO object detection model using a sparse quantization strategy to obtain the target output specifically includes: An adaptive cutoff threshold is selected based on the activation distribution; The activation distribution is divided into a primary activation portion and a long-tail activation portion; The main activation portion is then subjected to low-bit quantized convolution to obtain the first result; The long-tail activation portion is sparsely convolved to obtain the second result; The target output is obtained based on the first result and the second result; The step of obtaining the target output based on the first result and the second result specifically includes: The inference process of a layer is split into two branches: one branch performs efficient low-bit quantized convolutions, and the other branch processes a small number of high-precision sparse activations; the results of the two branches are directly added together to reconstruct an output that is completely equivalent to the original convolution. The process of functionally deconstructing the detection head of the YOLO object detection model based on the scale × task path paradigm using a head quantization strategy specifically includes: The detection head of the YOLO object detection model is divided into six sub-modules based on the scale × task path paradigm; specifically: The scale- and task-aware head quantization strategy deconstructs the detection head of the YOLO object detection model according to the scale × task path paradigm, dividing the detection head of the YOLO object detection model into six sub-modules. That is, the detection head of the YOLO object detection model is functionally divided into three scales: small, medium, and large. At the same scale, both classification and regression task outputs are generated simultaneously. Each task corresponding to each scale is a sub-module. Based on the final output of the submodule, the reconstruction error is used to construct an optimization objective for the submodule.
2. The low-bit quantization method for YOLO target detection model according to claim 1, characterized in that, After sparse quantization inference is completed, a task regularization strategy is used to perform low-bit compression on the large number of convolutional weights in the Backbone-Neck region, specifically including: The task loss is constructed at the detection head level; Based on the task loss, the large number of convolutional weights in the Backbone–Neck region are compressed to low bits.
3. The low-bit quantization method for YOLO target detection model according to claim 2, characterized in that, The task loss for constructing the detection head layer specifically includes: The task loss at the detection head level is constructed using bounding box regression loss, classification loss, and target confidence loss. The specific calculation formula is as follows: ; in, This represents the number of positive sample detection boxes; This represents the bounding box regression loss; This represents the classification loss; This represents the target confidence loss; The weighting coefficients represent the bounding box regression loss; The weighting coefficients represent the classification loss. The weighting coefficient represents the loss of target confidence.
4. The low-bit quantization method for YOLO target detection model according to claim 3, characterized in that, Both the classification loss and the target confidence loss are obtained by optimizing the cross-entropy loss.
5. The low-bit quantization method for YOLO target detection model according to claim 3, characterized in that, The bounding box regression loss is obtained through CIoU loss, and the specific calculation formula for the bounding box regression loss is as follows: ; in, Represents the bounding box predicted by the full-precision model; This represents the output of sparse quantization inference; This represents the Euclidean distance between their centers; This represents the diagonal length of the smallest bounding rectangle that covers both boxes; This indicates that the consistency of the aspect ratio has been quantified; This represents a positive trade-off parameter.
6. A low-bit quantization system for the YOLO target detection model, characterized in that, include: Quantization inference module, compression module, and destructuring module; The quantization inference module is used to perform sparse quantization inference on the activation distribution of the YOLO target detection model through a sparse quantization strategy in order to obtain the target output. The compression module is used to perform low-bit compression on a large number of convolutional weights in the Backbone-Neck region after sparse quantization inference is completed, using a task regularization strategy. The deconstruction module is used to functionally deconstruct the detection head of the YOLO object detection model according to the scale × task path paradigm using a head quantization strategy. The quantization inference module is specifically used for: An adaptive cutoff threshold is selected based on the activation distribution; The activation distribution is divided into a primary activation portion and a long-tail activation portion; The main activation portion is then subjected to low-bit quantized convolution to obtain the first result; The long-tail activation portion is sparsely convolved to obtain the second result; The target output is obtained based on the first result and the second result; The step of obtaining the target output based on the first result and the second result specifically includes: The inference process of a layer is split into two branches: one branch performs efficient low-bit quantized convolutions, and the other branch processes a small number of high-precision sparse activations; the results of the two branches are directly added together to reconstruct an output that is completely equivalent to the original convolution. The deconstruction module is specifically used for: The detection head of the YOLO object detection model is divided into six sub-modules based on the scale × task path paradigm; specifically: The scale- and task-aware head quantization strategy deconstructs the detection head of the YOLO object detection model according to the scale × task path paradigm, dividing the detection head of the YOLO object detection model into six sub-modules. That is, the detection head of the YOLO object detection model is functionally divided into three scales: small, medium, and large. At the same scale, both classification and regression task outputs are generated simultaneously. Each task corresponding to each scale is a sub-module. Based on the final output of the submodule, the reconstruction error is used to construct an optimization objective for the submodule.
7. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor, the memory storing a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The storage medium is used to store a computer program, which is used to cause a computer to perform the method according to any one of claims 1-5.