Image detection model training method and device, and readable storage medium

By combining quantization-aware training and feature distillation with dynamic offline quantization, the accuracy and speed of the image detection model are improved, solving the problems of model accuracy loss under low bitrate and difficulty in convergence of small-scale models.

CN115345832BActive Publication Date: 2026-07-24奕行智能科技(广州)有限公司
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
奕行智能科技(广州)有限公司
Filing Date
2022-07-19
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing image detection models suffer significant accuracy loss under low bitrate requirements, and small-scale models are difficult to converge, resulting in poor detection performance.

Method used

The teacher model is obtained through quantization perception training, the student model is obtained through feature distillation, and dynamic offline quantization is combined to ensure that the data feature distribution of the student model is consistent with that of the teacher model, and finally a well-trained image detection model is obtained.

Benefits of technology

It improves the accuracy and speed of image detection models, reduces the training workload, and solves the problem of convergence difficulties for small-scale models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115345832B_ABST
    Figure CN115345832B_ABST
Patent Text Reader

Abstract

An image detection model training method and device, and a readable storage medium, the image detection model training method comprises: acquiring a preset image detection model; performing quantization perception training on the preset image detection model to obtain a teacher model; performing feature distillation on the teacher model to obtain a student model; the data feature distribution of the student model is consistent with the data feature distribution of the teacher model; and performing dynamic offline quantization on the student model to obtain a trained image detection model. By using the above scheme, the precision and speed of the image detection model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image detection technology, and specifically relates to an image detection model training method and apparatus, and a readable storage medium. Background Technology

[0002] With the development of image detection technology, image detection models have increasingly higher requirements for low bit quantization at the edge computing end. However, with the popularization of low bit quantization, the problem of significant accuracy loss in image detection models when processing real-world scene images has become increasingly prominent. Therefore, existing image detection model training methods often result in poor image detection performance. Furthermore, directly training small-scale models can lead to convergence difficulties and inaccuracies. Summary of the Invention

[0003] The embodiments of the present invention address the technical problem of low accuracy and speed in image detection models.

[0004] To address the aforementioned technical problems, this invention provides an image detection model training method, comprising: acquiring a preset image detection model; performing quantitative perceptual training on the preset image detection model to obtain a teacher model; performing feature distillation on the teacher model to obtain a student model; wherein the data feature distribution of the student model is consistent with the data feature distribution of the teacher model; and performing dynamic offline quantization on the student model to obtain a trained image detection model.

[0005] Optionally, obtaining the preset image detection model includes: obtaining labeled scene image data; and training a floating-point model based on the labeled scene image data to obtain the image detection model.

[0006] Optionally, the step of performing quantization perception training on the preset image detection model to obtain the teacher model includes: quantizing the preset image detection model to obtain quantized weights, a quantization table of input and output data for each channel, and a quantization table of weights; using the quantized weights, the quantization table of input and output data for each channel, and the quantization table of weights as inputs to the teacher model to construct the teacher model.

[0007] Optionally, the step of performing feature distillation on the teacher model to obtain the student model includes: training the guiding layer of the student model based on the hidden layer output of the teacher model to obtain the trained guiding layer parameters of the student model; using the trained guiding layer parameters of the student model as the initialization parameters of the student model, performing target distillation training on the student model to obtain the parameters of all layers of the student model.

[0008] Optionally, the step of performing dynamic offline quantization on the student model to obtain a trained image detection model includes: performing dynamic offline quantization based on the data feature distribution and weight distribution of the student model to obtain the trained image detection model.

[0009] To address the aforementioned technical problems, this invention also discloses an image detection model training device, comprising: an acquisition unit for acquiring a preset image detection model; a first quantization unit for performing quantization-based perceptual training on the preset image detection model to obtain a teacher model; a distillation unit for performing feature distillation on the teacher model to obtain a student model; wherein the data feature distribution of the student model is consistent with the data feature distribution of the teacher model; and a second quantization unit for performing dynamic offline quantization on the student model to obtain a trained image detection model.

[0010] Optionally, the acquisition unit is configured to: acquire labeled scene image data; and perform floating-point model training based on the labeled scene image data to obtain the image detection model.

[0011] Optionally, the first quantization unit is configured to: quantize the preset image detection model to obtain quantized weights, a quantization table of input and output data for each channel, and a quantization table of weights; and use the quantized weights, the quantization table of input and output data for each channel, and the quantization table of weights as inputs to the teacher model to construct the teacher model.

[0012] Optionally, the distillation unit is configured to: train the guiding layer of the student model based on the hidden layer output of the teacher model to obtain the trained guiding layer parameters of the student model; use the trained guiding layer parameters of the student model as the initialization parameters of the student model to perform target distillation training on the student model to obtain the parameters of all layers of the student model.

[0013] Optionally, the second quantization unit is used to: perform dynamic offline quantization based on the data feature distribution and weight distribution of the student model to obtain the trained image detection model.

[0014] This invention also discloses a readable storage medium, which is a non-volatile or non-transient storage medium storing computer instructions. When the computer instructions are executed, they perform any of the above-described image detection model training methods.

[0015] This invention also provides an image detection model training apparatus, including a memory and a processor. The memory stores computer instructions that can be executed on the processor. When the processor executes the computer instructions, it performs any of the image detection model training methods described above.

[0016] Compared with the prior art, the technical solution of the embodiments of the present invention has the following beneficial effects:

[0017] The preset image detection model is trained using quantization perception to obtain a teacher model; the teacher model is then subjected to feature distillation to obtain a student model; the data feature distribution of the student model is consistent with that of the teacher model; the student model is then subjected to dynamic offline quantization to obtain a trained image detection model. The teacher model trained using quantization perception achieves good accuracy and convergence. Furthermore, feature distillation is used to obtain a student model with a data feature distribution consistent with the teacher model. Combined with dynamic offline quantization, this reduces the training workload of the image detection model and solves the problem of convergence difficulties for small-scale models during training. Attached Figure Description

[0018] Figure 1 This is a flowchart of an image detection model training method according to an embodiment of the present invention;

[0019] Figure 2 This is a schematic diagram of the structure of an image detection model training device according to an embodiment of the present invention. Detailed Implementation

[0020] In existing technologies, with the development of image detection technology, image detection models have increasingly higher requirements for low bit quantization at the edge computing end. However, with the popularization of low bit quantization, the problem of large accuracy loss in image detection models when processing real-world scene images is becoming increasingly prominent. Therefore, existing image detection model training methods often result in poor image detection performance. Furthermore, directly training small-scale models can lead to convergence difficulties and inaccuracies.

[0021] In this embodiment of the invention, the preset image detection model is subjected to quantization-perception training to obtain a teacher model; the teacher model is then subjected to feature distillation to obtain a student model; the data feature distribution of the student model is consistent with that of the teacher model; the student model is then subjected to dynamic offline quantization to obtain a trained image detection model. The teacher model trained by quantization-perception can achieve good accuracy and convergence. Furthermore, by obtaining a student model with a data feature distribution consistent with the teacher model through feature distillation, combined with dynamic offline quantization, the training workload of the image detection model is reduced. Simultaneously, it solves the problem of convergence difficulties for small-scale models during training.

[0022] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0023] This invention provides an image detection model training method, referring to... Figure 1 The following will provide a detailed explanation through specific steps.

[0024] Step S101: Obtain the preset image detection model.

[0025] In practice, labeled scene image data can be obtained first; then, based on the labeled scene image data, a floating-point model can be trained to obtain a preset image detection model.

[0026] In practical applications, images can be captured and processed to serve as scene image data, or keyframes from videos can be extracted and processed to serve as scene image data. This embodiment of the invention does not limit the specific format of the images.

[0027] In one embodiment of the present invention, video data of an intelligent driving scenario is acquired, key frames are extracted from the video and labeled to obtain labeled scene image data; an image detection model is trained based on the labeled scene image data, and the corresponding floating-point model is obtained by parsing the image detection model as data for subsequent training.

[0028] Step S102: Perform quantitative perception training on the preset image detection model to obtain the teacher model.

[0029] In practical applications, model quantization is a technique that converts floating-point calculations into low-ratio, fixed-point calculations. Existing model quantization techniques can effectively reduce model computation intensity, parameter size, and memory consumption, but they also lead to a loss of accuracy.

[0030] In a specific implementation, the preset image detection model can be quantized to obtain the quantized model weights, the quantization table of input and output data for each channel, and the quantization table of weights; then, the quantized weights, the quantization table of input and output data for each channel, and the quantization table of weights are used as inputs to the teacher model to build the teacher model.

[0031] In one embodiment of the present invention, the original floating-point weights and network of the preset image detection model are obtained, quantization perception training is performed, the quantization perception result is used as the initial value of the teacher model, and the teacher model is built as the subsequent feature distillation framework.

[0032] Step S103: Perform feature distillation on the teacher model to obtain the student model.

[0033] In practice, the data feature distribution of the student model is consistent with that of the teacher model, which can reduce the accuracy loss of the student model in the subsequent dynamic offline quantization process.

[0034] In practice, the guided layer of the student model can be trained based on the output of the hidden layer of the teacher model to obtain the trained guided layer parameters of the student model; the trained guided layer parameters of the student model can be used as the initialization parameters of the student model to perform target distillation training on the student model to obtain the parameters of all layers of the student model.

[0035] In one embodiment of the present invention, feature distillation is first performed on the hidden layer of the teacher model and the guiding layer of the student model. Specifically, this includes training the guiding layer of the student model based on the hidden feature layer of the teacher model, enabling the student model to learn the features of the teacher model's hidden layer. After training, the parameters of the student model's guiding layer are obtained, including the weights of the guiding layer. Next, the trained parameters of the student model's guiding layer are used as initialization parameters for target distillation. Specifically, this includes selecting a preset distillation temperature to reduce interference from negative labels, enabling the student model to learn the features of the teacher model. Simultaneously, the size of the student model is reduced to improve speed. After training, the parameters of all layers of the student model are obtained.

[0036] Step S104: Perform dynamic offline quantization on the student model to obtain a trained image detection model.

[0037] In practical applications, after the student model undergoes knowledge distillation, it is then dynamically quantized offline to obtain a trained image detection model. This not only reduces the accuracy error caused by dynamic offline quantization in existing technologies, but also reduces the computational load of the image detection model, thereby improving the accuracy and speed of the image detection model.

[0038] In practice, dynamic offline quantization can be performed based on the data feature distribution and weight distribution of the student model to obtain the trained image detection model, which effectively improves the accuracy and speed of the image detection model.

[0039] In summary, the preset image detection model is trained using quantization perception to obtain a teacher model; feature distillation is then performed on the teacher model to obtain a student model; the data feature distribution of the student model is consistent with that of the teacher model; dynamic offline quantization is then performed on the student model to obtain a trained image detection model. The teacher model trained using quantization perception achieves good accuracy and convergence. Furthermore, feature distillation is used to obtain a student model with a data feature distribution consistent with the teacher model. Combined with dynamic offline quantization, this reduces the training workload of the image detection model and solves the problem of convergence difficulties for small-scale models during training.

[0040] Reference Figure 2 This invention also provides an image detection model training device 20, comprising: an acquisition unit 201, a first quantization unit 202, a distillation unit 203, and a second quantization unit 204.

[0041] The acquisition unit 201 is used to acquire a preset image detection model;

[0042] The first quantization unit 202 is used to perform quantization perception training on the preset image detection model to obtain a teacher model;

[0043] The distillation unit 203 is used to perform feature distillation on the teacher model to obtain the student model;

[0044] The second quantization unit 204 is used to perform dynamic offline quantization on the student model to obtain a trained image detection model.

[0045] In practice, the data feature distribution of the student model is consistent with the data feature distribution of the teacher model.

[0046] In a specific implementation, the acquisition unit 201 can be used to: acquire labeled scene image data; and perform floating-point model training based on the labeled scene image data to obtain the image detection model.

[0047] In a specific implementation, the first quantization unit 202 can be used to: quantize the preset image detection model to obtain quantized weights, a quantization table of input and output data for each channel, and a quantization table of weights; and use the quantized weights, the quantization table of input and output data for each channel, and the quantization table of weights as inputs to the teacher model to build the teacher model.

[0048] In a specific implementation, the distillation unit 203 can be used to: train the guiding layer of the student model based on the hidden layer output of the teacher model to obtain the trained guiding layer parameters of the student model; use the trained guiding layer parameters of the student model as the initialization parameters of the student model to perform target distillation training on the student model to obtain the parameters of all layers of the student model.

[0049] In a specific implementation, the second quantization unit 204 can be used to: perform dynamic offline quantization based on the data feature distribution and weight distribution of the student model to obtain the trained image detection model.

[0050] This invention also provides a readable storage medium, which is a non-volatile or non-transient storage medium storing computer instructions. When the computer instructions are executed, they perform the image detection model training method provided in the above embodiments of this invention.

[0051] This invention also provides an image detection model training apparatus, including a memory and a processor. The memory stores computer instructions that can be executed on the processor. When the processor executes the computer instructions, it performs the image detection model training method provided in the above embodiments of this invention.

[0052] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in any computer-readable storage medium, which may include ROM, RAM, disk, or optical disk, etc.

[0053] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. A method for training an image detection model, characterized in that, include: Obtain the preset image detection model; The preset image detection model is subjected to quantitative perception training to obtain a teacher model; The teacher model is subjected to feature distillation to obtain the student model, which includes: Based on the hidden layer output of the teacher model, the guiding layer of the student model is trained to obtain the trained guiding layer parameters of the student model. The trained guidance layer parameters of the student model are used as the initialization parameters of the student model. Target distillation training is then performed on the student model to obtain the parameters of all layers of the student model. The data feature distribution of the student model is consistent with the data feature distribution of the teacher model. The student model is dynamically quantized offline to obtain a trained image detection model.

2. The image detection model training method as described in claim 1, characterized in that, The process of obtaining the preset image detection model includes: Obtain labeled scene image data; The image detection model is obtained by training a floating-point model based on the labeled scene image data.

3. The image detection model training method as described in claim 1, characterized in that, The step of performing quantitative perception training on the preset image detection model to obtain the teacher model includes: The preset image detection model is quantized to obtain the quantized weights, the quantization table of the input and output data of each channel, and the quantization table of the weights. The teacher model is constructed by using the quantized weights, the quantization table of the input and output data of each channel, and the quantization table of the weights as inputs to the teacher model.

4. The image detection model training method as described in claim 1, characterized in that, The step of performing dynamic offline quantization on the student model to obtain the trained image detection model includes: Based on the data feature distribution and weight distribution of the student model, dynamic offline quantization is performed to obtain the trained image detection model.

5. An image detection model training device, characterized in that, include: The acquisition unit is used to acquire a preset image detection model; The first quantization unit is used to perform quantization perception training on the preset image detection model to obtain the teacher model; A distillation unit is used to perform feature distillation on the teacher model to obtain a student model. The distillation unit is used to: train the guiding layer of the student model based on the hidden layer output of the teacher model to obtain the trained guiding layer parameters of the student model; use the trained guiding layer parameters of the student model as the initialization parameters of the student model to perform target distillation training on the student model to obtain the parameters of all layers of the student model; the data feature distribution of the student model is consistent with the data feature distribution of the teacher model. The second quantization unit is used to perform dynamic offline quantization on the student model to obtain a trained image detection model.

6. The image detection model training device as described in claim 5, characterized in that, The acquisition unit is used to: acquire labeled scene image data; and perform floating-point model training based on the labeled scene image data to obtain the image detection model.

7. The image detection model training device as described in claim 5, characterized in that, The first quantization unit is used to: quantize the preset image detection model to obtain the quantized weights, a quantization table of the input and output data of each channel, and a quantization table of the weights; The teacher model is constructed by using the quantized weights, the quantization table of the input and output data of each channel, and the quantization table of the weights as inputs to the teacher model.

8. The image detection model training device as described in claim 5, characterized in that, The second quantization unit is used to: perform dynamic offline quantization based on the data feature distribution and weight distribution of the student model to obtain the trained image detection model.

9. A readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and computer instructions are stored thereon, characterized in that, The computer instructions, when executed on the processor, perform the image detection model training method according to any one of claims 1 to 4.

10. An image detection model training apparatus, comprising a memory and a processor, wherein the memory stores computer instructions executable on the processor, characterized in that, When the processor executes the computer instructions, it performs the image detection model training method according to any one of claims 1 to 4.