Methods and apparatus for reducing quantization errors in neural network models using regularization techniques

By modifying the neural network model through regularization and linear transformation, the problem of accuracy loss during quantization was solved, the model accuracy and anti-interference ability were improved, and high-precision environmental perception effect was achieved.

CN117764136BActive Publication Date: 2026-05-26TIANJIN QINGZHI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIANJIN QINGZHI TECH CO LTD
Filing Date
2023-11-28
Publication Date
2026-05-26

Smart Images

  • Figure CN117764136B_ABST
    Figure CN117764136B_ABST
Patent Text Reader

Abstract

This invention provides a method and apparatus for reducing quantization errors in neural network models using regularization techniques, belonging to the field of artificial intelligence technology. The method includes: analyzing the model's target interval to determine the target interval; applying regularization techniques and a linear transformation algorithm to quantize the model to be quantized; training the quantized model; and deploying the trained model using quantization, thereby enabling the vehicle to perform environmental perception tasks in intelligent driving scenarios based on images of the external environment captured by an onboard camera. This invention can improve the model's resistance to quantization errors, thus improving the accuracy of the quantized model and achieving high-precision environmental perception in intelligent driving scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a method and apparatus for reducing quantization errors in neural network models using regularization. Background Technology

[0002] The perception module plays a crucial role in the intelligent driving domain controller. It receives signals such as video and point cloud data collected by sensors such as cameras, and outputs the perception results of the surrounding environment through preprocessing, inference and decoding operations of neural network models, which are then used for subsequent fusion and planning control.

[0003] Typically, a model represented using floating-point (float32) data on a PC is converted to an integer (int8) data representation through an operation called "quantization" before being deployed to embedded devices. Quantization truncates precision (32 bits -> 8 bits), resulting in quantization loss that affects model deployment accuracy and the effectiveness of subsequent processes. Currently, there are no methods to improve the model's robustness to quantization errors. Summary of the Invention

[0004] This invention provides a method and apparatus for reducing quantization error in neural network models using regularization techniques. This addresses the technical problem that in the prior art, the model's precision is truncated during the quantization process, resulting in quantization loss, which in turn affects the model's deployment accuracy and the effectiveness of subsequent steps. Currently, there is no effective means to improve the model's resistance to quantization error.

[0005] To address the aforementioned technical problems, the embodiments of the present invention provide the following technical solutions:

[0006] On one hand, embodiments of the present invention provide a method for reducing quantization error of a neural network model using regularization techniques. The method for reducing quantization error of a neural network model using regularization techniques includes:

[0007] Analyze the target interval of the model to determine the target interval of the model;

[0008] Regularization techniques and linear transformation algorithms are used to quantize the model to be quantized.

[0009] Train the quantized model until it converges;

[0010] The trained model is quantized and deployed so that the deployed model can be used to realize the environmental perception task of the vehicle in intelligent driving scenarios based on the images of the external environment collected by the vehicle camera.

[0011] Furthermore, the analysis of the model target interval to determine the model target interval includes:

[0012] The target interval of the model is analyzed to determine the target interval of the model; wherein, the target interval includes the target interval of the classification head and the target interval of the regression head; for the classification head, its target interval is [-127, 128]; for the regression head, its target interval needs to be balanced between accuracy and value range, in order to control the maximum interval between adjacent representable values ​​without losing too much value range.

[0013] Furthermore, the process of using regularization techniques and linear transformation algorithms to quantize the model to be quantized includes:

[0014] Based on different output value ranges, the model head is split into multiple parts to achieve model head modification;

[0015] A linear transformation operation is inserted at the beginning of the original decoding process of the model; wherein, the linear transformation operation takes the output of the model as input, and is used to linearly transform the output of the model, mapping the value range of the data corresponding to the output of the model from the interval [-127, 128] to the target interval; and then the mapping result is output to the original decoding process;

[0016] In addition to the original loss function of the model, a regularized loss function is added in a linearly weighted manner to penalize the portion of the overflow interval [-127, 128] in the original inference result before the linear transformation.

[0017] Furthermore, the process of using regularization techniques and linear transformation algorithms to quantize the model to be quantized also includes:

[0018] Modify the original loss function using regularization: Apply regularization to the boundary of the target interval to degrade the original loss function, so as to avoid pushing the model's inference results away from the target interval.

[0019] Furthermore, the model to be quantified is any one or more combinations of a preset type of target detection model, target recognition and classification model, and target prediction model.

[0020] On the other hand, the present invention also provides an apparatus for reducing the quantization error of a neural network model using regularization methods, the apparatus comprising:

[0021] The target interval analysis module is used to analyze the target interval of the model and determine the target interval of the model.

[0022] The quantization transformation module is used to perform quantization transformation on the model to be quantized using regularization techniques and linear transformation algorithms.

[0023] The quantization training module is used to train the quantized model until it converges.

[0024] The model deployment and application module is used to quantitatively deploy the trained model, so that the deployed model can be used to realize the environmental perception task of the vehicle in the intelligent driving scenario based on the external environment images collected by the vehicle camera.

[0025] Furthermore, the target interval analysis module is specifically used for:

[0026] The target interval of the model is analyzed to determine the target interval of the model; wherein, the target interval includes the target interval of the classification head and the target interval of the regression head; for the classification head, its target interval is [-127, 128]; for the regression head, its target interval needs to be balanced between accuracy and value range, in order to control the maximum interval between adjacent representable values ​​without losing too much value range.

[0027] Furthermore, the quantization modification module is specifically used for:

[0028] Based on different output value ranges, the model head is split into multiple parts to achieve model head modification;

[0029] A linear transformation operation is inserted at the beginning of the original decoding process of the model; wherein, the linear transformation operation takes the output of the model as input, and is used to linearly transform the output of the model, mapping the value range of the data corresponding to the output of the model from the interval [-127, 128] to the target interval; and then the mapping result is output to the original decoding process;

[0030] In addition to the original loss function of the model, a regularized loss function is added in a linearly weighted manner to penalize the portion of the overflow interval [-127, 128] in the original inference result before the linear transformation.

[0031] Furthermore, the quantization modification module is specifically used for:

[0032] Modify the original loss function using regularization: Apply regularization to the boundary of the target interval to degrade the original loss function, so as to avoid pushing the model's inference results away from the target interval.

[0033] Furthermore, the model to be quantified is any one or more combinations of a preset type of target detection model, target recognition and classification model, and target prediction model.

[0034] In another aspect, the present invention also provides an electronic device including a processor and a memory; the memory stores at least one instruction, which is loaded and executed by the processor to implement the above-described method.

[0035] In another aspect, the present invention also provides a computer-readable storage medium storing at least one instruction that is loaded and executed by a processor to implement the above-described method.

[0036] The beneficial effects of the technical solution provided by this invention include at least the following:

[0037] This invention utilizes regularization techniques and linear transformation algorithms to quantize and modify the model to be quantized, optimizing the training process of the neural network model and solving the problem of excessive accuracy loss caused by quantization. This improves the model's resistance to quantization errors, thereby enhancing the accuracy of the quantized model and enabling high-precision environmental perception in intelligent driving scenarios, thus possessing significant application potential. Attached Figure Description

[0038] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:

[0039] Figure 1 This is a schematic diagram of the execution flow of a method for reducing quantization error in a neural network model using regularization, according to an embodiment of the present invention.

[0040] Figure 2 This is a system structure block diagram of a device for reducing quantization errors in neural network models using regularization, according to an embodiment of the present invention. Detailed Implementation

[0041] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention. It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0042] Furthermore, it should be noted that the terms "first," "second," etc., in the specification, claims, and related drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Moreover, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0043] First Embodiment

[0044] This embodiment provides a method for reducing quantization errors in neural network models using regularization techniques, used to obtain more accurate on-board models in the deep learning model deployment stage of intelligent driving. The method in this embodiment can be implemented by an electronic device, which can be a terminal or a server. Specifically, the execution flow of this method is as follows: Figure 1 As shown, it includes the following process steps:

[0045] S1, Analyze the target interval of the model to determine the target interval of the model;

[0046] Specifically, in this embodiment, S1 is as follows: analyze the target interval of the model to determine the target interval of the classification head and the target interval of the regression head; for the classification head, its target interval is [-127, 128]; for the regression head, its target interval needs to be balanced between accuracy and value range, in order to control the maximum interval between adjacent representable values ​​without losing too much value range.

[0047] S2 uses regularization techniques and linear transformation algorithms to quantize the model to be quantized.

[0048] Specifically, in this embodiment, the process of quantizing the model in S2 includes:

[0049] S21, Modify the model head: Divide the model head into multiple parts according to different output value ranges;

[0050] S22, Modify the decoding process with linear transformation: Insert a linear transformation operation at the beginning of the original decoding process of the model; wherein, the linear transformation operation takes the output of the model as input, and performs a linear transformation on the output of the model to linearly map the value range of the data corresponding to the output of the model from the interval [-127, 128] to the target interval; and then output the mapping result to the original decoding process;

[0051] S23, Add regularized loss function: In addition to the original loss function of the model, add a regularized loss function in a linear weighted manner. This loss function takes the original inference result before the linear transformation and penalizes the portion of the result that overflows in the interval [-127, 128].

[0052] S24. Modify the original loss function using regularization: Apply regularization to degrade the original loss function near the boundary of the target interval, so as to avoid pushing the model's inference results away from the target interval as much as possible.

[0053] S3, train the quantized model until it converges;

[0054] S4 quantizes and deploys the trained model to enable the vehicle to perform environmental perception tasks in intelligent driving scenarios based on images of the external environment captured by the vehicle's onboard camera.

[0055] It should be noted that, in this embodiment, the model to be quantified is any one or more combinations of a preset type of target detection model, target recognition and classification model, and target prediction model.

[0056] After quantifying and deploying the above model, the corresponding environmental perception tasks can be achieved through images of the external environment acquired by the vehicle-mounted camera. For example, pedestrian detection, road traffic sign detection, road marking line detection, path planning, and collision warning can be achieved through images collected by the vehicle-mounted camera.

[0057] In summary, this embodiment provides a method for reducing quantization error in neural network models using regularization. By applying the same quantization operation to the neural network model trained using this method, the accuracy of the resulting quantized model is significantly improved compared to the model before using this method.

[0058] Furthermore, it should be noted that, through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the embodiments of the present invention.

[0059] Second Embodiment

[0060] This embodiment provides an apparatus for reducing quantization errors in a neural network model using regularization techniques. This apparatus is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated. Figure 2 As shown, the device includes the following modules:

[0061] The target interval analysis module is used to analyze the target interval of the model and determine the target interval of the model.

[0062] The quantization transformation module is used to perform quantization transformation on the model to be quantized using regularization techniques and linear transformation algorithms.

[0063] The quantization training module is used to train the quantized model until it converges.

[0064] The model deployment and application module is used to quantitatively deploy the trained model, so that the deployed model can be used to realize the environmental perception task of the vehicle in the intelligent driving scenario based on the external environment images collected by the vehicle camera.

[0065] It should be noted that the device for reducing quantization error of neural network models using regularization in this embodiment corresponds to the method for reducing quantization error of neural network models using regularization in the first embodiment described above; wherein, the functions implemented by each functional module in the device for reducing quantization error of neural network models using regularization in this embodiment correspond one-to-one with the process steps in the method for reducing quantization error of neural network models using regularization in the first embodiment described above; therefore, it will not be described again here.

[0066] Furthermore, it should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0067] Third Embodiment

[0068] This embodiment provides an electronic device including a processor and a memory; wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the method of the first embodiment described above. This electronic device can vary considerably due to differences in configuration or performance, and may include one or more processors and one or more memories, wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the method of the first embodiment.

[0069] Fourth embodiment

[0070] This embodiment provides a computer-readable storage medium storing at least one instruction, which is loaded and executed by a processor to implement the above-described method. The computer-readable storage medium may be a ROM, random access memory, CD-ROM, magnetic tape, floppy disk, or optical data storage device, etc. The instruction stored therein can be loaded and executed by a processor in a terminal using the method of the first embodiment.

[0071] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0072] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0073] In the several embodiments provided by this invention, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection of units or modules may be electrical or other forms.

[0074] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0075] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0076] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0077] Finally, it should be noted that the above are merely preferred embodiments of the present invention. It should be pointed out that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the preferred embodiments.

Claims

1. A method for reducing quantization error in neural network models using regularization, characterized in that, The methods for reducing quantization errors in neural network models using regularization include: Analyze the target interval of the model to determine the target interval of the model; Regularization techniques and linear transformation algorithms are used to quantize the model to be quantized. Train the quantized model until it converges; The trained model is quantized and deployed so that the deployed model can be used to realize the environmental perception task of the vehicle in the intelligent driving scenario based on the images of the external environment collected by the vehicle camera. The process of quantizing the model to be quantized using regularization techniques and linear transformation algorithms includes: Based on different output value ranges, the model head is split into multiple parts to achieve model head modification; A linear transformation operation is inserted at the beginning of the original decoding process of the model; wherein, the linear transformation operation takes the output of the model as input, and is used to linearly transform the output of the model, mapping the value range of the data corresponding to the output of the model from the interval [-127, 128] to the target interval; and then the mapping result is output to the original decoding process; In addition to the original loss function of the model, a regularized loss function is added in a linearly weighted manner to penalize the portion of the overflow interval [-127, 128] in the original inference result before linear transformation; The step of analyzing and determining the target interval of the model includes: analyzing the target interval of the model to determine the target interval of the model; wherein, the target interval includes the target interval of the classification head and the target interval of the regression head; for the classification head, its target interval is [-127, 128]; for the regression head, its target interval needs to be balanced between accuracy and value range, in order to control the maximum interval between adjacent representable values ​​without losing too much value range. The method of using regularization and linear transformation algorithm to quantize the model to be quantized also includes: modifying the original loss function with regularization: applying regularization to degenerate the original loss function at the boundary of the target interval to avoid pushing the inference results of the model away from the target interval.

2. The method for reducing quantization error of a neural network model using regularization as described in claim 1, characterized in that, The model to be quantified is any one or more combinations of a preset type of target detection model, target recognition and classification model, and target prediction model.

3. A device for reducing quantization error in a neural network model using regularization, characterized in that, A method for reducing quantization error of a neural network model using regularization as described in any one of claims 1 and 2; the apparatus for reducing quantization error of a neural network model using regularization comprises: The target interval analysis module is used to analyze the target interval of the model and determine the target interval of the model. The quantization transformation module is used to perform quantization transformation on the model to be quantized using regularization techniques and linear transformation algorithms. The quantization training module is used to train the quantized model until it converges. The model deployment and application module is used to quantitatively deploy the trained model, so that the deployed model can be used to realize the environmental perception task of the vehicle in the intelligent driving scenario based on the external environment images collected by the vehicle camera.

4. The apparatus for reducing quantization error of a neural network model using regularization as described in claim 3, characterized in that, The target interval analysis module is specifically used for: The target interval of the model is analyzed to determine the target interval of the model; wherein, the target interval includes the target interval of the classification head and the target interval of the regression head; for the classification head, its target interval is [-127, 128]; for the regression head, its target interval needs to be balanced between accuracy and value range, in order to control the maximum interval between adjacent representable values ​​without losing too much value range.

5. The apparatus for reducing quantization error of a neural network model using regularization as described in claim 3, characterized in that, The quantization transformation module is specifically used for: Based on different output value ranges, the model head is split into multiple parts to achieve model head modification; A linear transformation operation is inserted at the beginning of the original decoding process of the model; wherein, the linear transformation operation takes the output of the model as input, and is used to linearly transform the output of the model, mapping the value range of the data corresponding to the output of the model from the interval [-127, 128] to the target interval; and then the mapping result is output to the original decoding process; In addition to the original loss function of the model, a regularized loss function is added in a linearly weighted manner to penalize the portion of the overflow interval [-127, 128] in the original inference result before the linear transformation.

6. The apparatus for reducing quantization error of a neural network model using regularization as described in claim 5, characterized in that, The quantification transformation module is also specifically used for: Modify the original loss function using regularization: Apply regularization to the boundary of the target interval to degrade the original loss function, so as to avoid pushing the model's inference results away from the target interval.

7. The apparatus for reducing quantization error of a neural network model using regularization as described in any one of claims 3-6, characterized in that, The model to be quantified is any one or more combinations of a preset type of target detection model, target recognition and classification model, and target prediction model.