IP Library › Granted Patent US 12,380,328
Granted Patent B2
US 12,380,328 · App. 18/108,956 · Granted Aug 5, 2025

Lightweight model training method, image processing method, electronic device, and storage medium

Inventors: Ruoyu Guo (Beijing, CN); Yuning Du (Beijing, CN); Chenxia Li (Beijing, CN); Baohua Lai (Beijing, CN); Yanjun Ma (Beijing, CN)
Assignee: Beijing Baidu Netcom Science Technology Co., Ltd.
G06N3/08G06V10/82
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,380,328
App. No.
18/108,956
Granted
Aug 5, 2025
Kind
B2
Abstract

Provided is a lightweight model training method, an image processing method, a device and a medium. The lightweight model training method includes: acquiring first and second augmentation probabilities and a target weight adopted in an e-th iteration; performing data augmentation on a data set based on the first and second augmentation probabilities respectively, to obtain first and second data sets; obtaining a first output value of a student model and a second output value of a teacher model based on the first data set; obtaining a third output value and a fourth output value based on the second data set; determining a distillation loss function, a truth-value loss function and a target loss function; training the student model based on the target loss function; and determining a first augmentation probability or target weight to be adopted in an (e+1)-th iteration in a case of e is less than E.

Claims (94)

1. A lightweight model training method, comprising:

acquiring a first augmentation probability, a second augmentation probability and a target weight adopted in an e-th iteration, the target weight being a weight of a distillation loss value, e being a positive integer not greater than E, and E being a maximum quantity of iterations and being a positive integer greater than 1;

performing data augmentation on a data set based on the first augmentation probability and the second augmentation probability respectively, to obtain a first data set and a second data set;

obtaining a first output value of a student model and a second output value of a teacher model based on the first data set;

obtaining a third output value of the student model and a fourth output value of the teacher model based on the second data set, and the student model being a lightweight model;

determining a distillation loss function based on the first output value and the second output value;

determining a truth-value loss function based on the third output value and the fourth output value;

determining a target loss function based on the distillation loss function and the truth-value loss function;

training the student model based on the target loss function; and

determining a first augmentation probability or target weight to be adopted in an (e+1)-th iteration in a case of e is less than E.

2. The method of claim 1 , further comprising:

acquiring a maximum augmentation probability; and

determining the second augmentation probability based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability.

3. The method of claim 2 , wherein determining the first augmentation probability to be adopted in the (e+1)-th iteration, comprises:

determining the first augmentation probability to be adopted in the (e+1)-th iteration based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability of the e-th iteration.

4. The method of claim 1 , further comprising:

acquiring a maximum target weight;

wherein determining the target weight to be adopted in the (e+1)-th iteration, comprises:

determining the target weight to be adopted in the (e+1)-th iteration based on the maximum target weight, the maximum quantity of iterations, and the target weight of the e-th iteration.

5. The method of claim 1 , wherein determining the target loss function based on the distillation loss function and the truth-value loss function, comprises:

determining the distillation loss function as the target loss function in a case of the target weight is not less than the maximum target weight or the distillation loss function is not less than the truth-value loss function; and

determining the truth-value loss function as the target loss function in other cases.

6. The method of claim 1 , wherein determining the distillation loss function based on the first output value and the second output value, comprises:

determining the distillation loss function according to a formula as follow:

l 1=( a+a dft ×2/ E )× L dist ( o 1 s,o 1 t )+(1− a−a dft ×2/ E )× L gt ( o 1 s,gt );

wherein l1 represents the distillation loss function, L dist (o1s,o1t) represents a distillation loss value determined according to the first output value and the second output value, L gt (o1s,gt) represents a truth-value loss value determined according to the first output value and a truth-value, a represents the target weight, a dft represents a maximum target weight, E represents the maximum quantity of iterations, gt represents the truth-value, o1s represents the first output value, and o1t represents the second output value.

7. The method of claim 1 , wherein determining the truth-value loss function based on the third output value and the fourth output value, comprises:

determining the truth-value loss function according to a formula as follow:

l 2= a×L dist ( o 2 s,o 2 t )+(1− a )× L gt ( o 2 s,gt );

wherein l2 represents the truth-value loss function, L dist (o2s,o2t) represents a distillation loss value determined according to the third output value and the fourth output value, L gt (o2s,gt) represents a truth-value loss value determined according to the third output value and a truth-value, a represents the target weight, gt represents the truth-value, o2s represents the third output value, and o2t represents the fourth output value.

8. An image processing method, comprising:

receiving an image to be processed in a target scene; and

inputting the image to be processed into a student model, to acquire a processed result of the image to be processed output by the student model;

wherein the student model is obtained by adopting the lightweight model training method of claim 1 .

9. The method of claim 8 , wherein receiving the image to be processed in the target scene, comprises at least one of:

acquiring an image to be processed in an image classification scene;

acquiring an image to be processed in an image recognition scene; or

acquiring an image to be processed in a target detection scene.

10. An electronic device, comprising:

at least one processor; and

a memory connected in communication with the at least one processor;

wherein the memory stores an instruction executable by the at least one processor, and the instruction, when executed by the at least one processor, enables the at least one processor to execute operations, comprising:

acquiring a first augmentation probability, a second augmentation probability and a target weight adopted in an e-th iteration, the target weight being a weight of a distillation loss value, e being a positive integer not greater than E, and E being a maximum quantity of iterations and being a positive integer greater than 1;

performing data augmentation on a data set based on the first augmentation probability and the second augmentation probability respectively, to obtain a first data set and a second data set;

obtaining a first output value of a student model and a second output value of a teacher model based on the first data set;

obtaining a third output value of the student model and a fourth output value of the teacher model based on the second data set, and the student model being a lightweight model;

determining a distillation loss function based on the first output value and the second output value;

determining a truth-value loss function based on the third output value and the fourth output value;

determining a target loss function based on the distillation loss function and the truth-value loss function;

training the student model based on the target loss function; and

determining a first augmentation probability or target weight to be adopted in an (e+1)-th iteration in a case of e is less than E.

11. The electronic device of claim 10 , wherein the operations further comprise:

acquiring a maximum augmentation probability; and

determining the second augmentation probability based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability.

12. The electronic device of claim 11 , wherein determining the first augmentation probability to be adopted in the (e+1)-th iteration, comprises:

determining the first augmentation probability to be adopted in the (e+1)-th iteration based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability of the e-th iteration.

13. The electronic device of claim 10 , wherein the operations further comprise:

acquiring a maximum target weight;

wherein determining the target weight to be adopted in the (e+1)-th iteration, comprises:

determining the target weight to be adopted in the (e+1)-th iteration based on the maximum target weight, the maximum quantity of iterations, and the target weight of the e-th iteration.

14. An electronic device, comprising:

at least one processor; and

a memory connected in communication with the at least one processor;

wherein the memory stores an instruction executable by the at least one processor, and the instruction, when executed by the at least one processor, enables the at least one processor to execute operations, comprising:

receiving an image to be processed in a target scene; and

inputting the image to be processed into a student model, to acquire a processed result of the image to be processed output by the student model;

wherein the student model is obtained by adopting the lightweight model training method of claim 1 .

15. The electronic device of claim 14 , wherein receiving the image to be processed in the target scene, comprises at least one of:

acquiring an image to be processed in an image classification scene;

acquiring an image to be processed in an image recognition scene; or

acquiring an image to be processed in a target detection scene.

16. A non-transitory computer-readable storage medium storing a computer instruction thereon, wherein the computer instruction is used to cause a computer to execute operations, comprising:

acquiring a first augmentation probability, a second augmentation probability and a target weight adopted in an e-th iteration, the target weight being a weight of a distillation loss value, e being a positive integer not greater than E, and E being a maximum quantity of iterations and being a positive integer greater than 1;

performing data augmentation on a data set based on the first augmentation probability and the second augmentation probability respectively, to obtain a first data set and a second data set;

obtaining a first output value of a student model and a second output value of a teacher model based on the first data set;

obtaining a third output value of the student model and a fourth output value of the teacher model based on the second data set, and the student model being a lightweight model;

determining a distillation loss function based on the first output value and the second output value;

determining a truth-value loss function based on the third output value and the fourth output value;

determining a target loss function based on the distillation loss function and the truth-value loss function;

training the student model based on the target loss function; and

determining a first augmentation probability or target weight to be adopted in an (e+1)-th iteration in a case of e is less than E.

17. The storage medium of claim 16 , wherein the operations further comprise:

acquiring a maximum augmentation probability; and

determining the second augmentation probability based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability.

18. The storage medium of claim 17 , wherein determining the first augmentation probability to be adopted in the (e+1)-th iteration, comprises:

determining the first augmentation probability to be adopted in the (e+1)-th iteration based on the maximum augmentation probability, the maximum quantity of iterations and the first augmentation probability of the e-th iteration.

19. A non-transitory computer-readable storage medium storing a computer instruction thereon, wherein the computer instruction is used to cause a computer to execute operations, comprising:

receiving an image to be processed in a target scene; and

inputting the image to be processed into a student model, to acquire a processed result of the image to be processed output by the student model;

wherein the student model is obtained by adopting the lightweight model training method of claim 1 .

20. The storage medium of claim 19 , wherein receiving the image to be processed in the target scene, comprises at least one of:

acquiring an image to be processed in an image classification scene;

acquiring an image to be processed in an image recognition scene; or

acquiring an image to be processed in a target detection scene.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 13, 2023
From: GUO, RUOYU; DU, YUNING; LI, CHENXIA; LAI, BAOHUA; MA, YANJUN
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 062676/0885 →
Priority Claims (1)
CN 202211059602.5 · Aug 30, 2022 · national
Continuity (1)
Related Publication 20240070454A1 · Feb 29, 2024
References Cited (28)
US 20200311552A1 · A · 2020 [cited by examiner]
US 20220076136A1 · Passban · 2022 [cited by examiner]
US 20220101184A1 · Asif · 2022 [cited by examiner]
US 20220101185A1 · Asif · 2022 [cited by examiner]
US 20220261599A1 · Kastaniotis · 2022 [cited by examiner]
US 20220301310A1 · Kim · 2022 [cited by examiner]
US 20230005165A1 · Cai · 2023 [cited by examiner]
US 20230214670A1 · Liu · 2023 [cited by examiner]
CN 111242297A · 2020 [cited by applicant]
CN 112966744A · 2021 [cited by applicant]
CN 112990342A · 2021 [cited by examiner]
CN 113592023A · 2021 [cited by examiner]
CN 113807390A · 2021 [cited by applicant]
CN 114463798A · 2022 [cited by applicant]
CN 114863248A · 2022 [cited by examiner]
CN 114897160A · 2022 [cited by applicant]
WO WO2021044591A1 · 2021 [cited by examiner]
WO WO2022132967A1 · 2022 [cited by examiner]
Jaeyong Kang et al. , “Ensemble Learning of Lightweight Deep Learning Models Using Knowledge Distillation for Image Classification,” Sep. 24, 2020, Mathematics 2020,8,1652, pp. 1-10. [cited by examiner]
Kui Ren et al., “Adversarial Attacks and Defenses in Deep Learning,” Jan. 3, 2020,Enginering 6( 2020), pp. 348-356. [cited by examiner]
Jianping Gou et al., “Knowledge Distillation: A Survey,” Mar. 22, 2021, International Journal of Computer Vision,pp. 1-10. [cited by examiner]
Tianze Gao et al., “Revisiting knowledge distillation for light-weight visual object detection,” Aug. 13, 2021,Transactions of the Institute of Measurement and Control 2021, vol. 43(13),pp. 2888-2897. [cited by examiner]
Abdollah Amirkhani et al., “Robust Semantic Segmentation With Multi-Teacher Knowledge Distillation,” Sep. 2, 2021, IEEE Access, vol. 9,2021,pp. 119049-119060. [cited by examiner]
Dongdong Wang et al., “Neural Networks are More Productive Teachers Than Human Raters: Active Mixup for Data-Efficient Knowledge Distillation from a Blackbox Model,” Jun. 2020, Proceedings of the IEEE/CVF Conference on … [cited by examiner]
Japanese Patent Office; Japanese Office Action; Japanese Application No. 2023-070644; 8 pages; dated May 21, 2024. [cited by applicant]
The State Intellectual Property Office of People's Republic of China; Chinese Application No. 202211059602.5; First Office Action; 8 pages; dated May 17, 2023. [cited by applicant]
The State Intellectual Property Office of People's Republic of China; Chinese Application No. 202211059602.5; Notification on Grant of the Patent Right for Invention; 6 pages; dated Jan. 4, 2024. [cited by applicant]
Ren, Kui et al.; Adversarial Attack and Defense in Deep Learning; English Abstract; Elsevier; 19 pages; Mar. 15, 2020. [cited by applicant]