IP Library Granted Patent US 11,625,594
Granted Patent B2
US 11,625,594 · App. 16/004,363 · Granted Apr 11, 2023

Method and device for student training networks with teacher networks

Inventors: Naiyan Wang (Beijing, CN); Zehao Huang (Beijing, CN)
Assignee: BEIJING TUSEN ZHITU TECHNOLOGY CO., LTD.
G06N3/08G06N3/04G06N3/0454G06N20/10
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 11,625,594
App. No.
16/004,363
Granted
Apr 11, 2023
Kind
B2
Abstract

A method and device for training a neural network are disclosed. The method comprises: selecting, by a training device, a teacher network performing the same functions of a student network; and iteratively training the student network and obtaining a target network, through aligning distributions of features between a first middle layer and a second middle layer corresponding to the same training sample data, so as to transfer knowledge of features of a middle layer of the teacher network to the student network.

Claims (360)

1. A method for training a neural network, the method comprising:

selecting, by a training device, a teacher network performing the same functions of a student network;

iteratively training the student network and obtaining a target network, through aligning distributions of features between a first middle layer and a second middle layer corresponding to the same training sample data, so as to transfer knowledge of features of a middle layer of the teacher network to the student network; wherein, the features of the first middle layer refer to a feature map F T output from a first specific network layer of the teacher network after the training sample data are provided to the teacher network, and the features of the second middle layer refer to a feature map F S output from a second specific network layer of the student network after the training sample data are provided to the student network,

wherein iteratively training the student network and obtaining the target network, comprises:

building an objective function of the student network, wherein the objective function comprises:

= ( y true ,p S )+λ MMD 2 ( F T ,F S )

wherein, (y true , p S ) refers to the cross-entropy loss function, MMD 2 (F T , F S ) refers to the distance loss function, λ refers to the weight of the distance loss function, F T refers to the feature map (i.e. the features of the first middle layer) output from the first specific network layer of the teacher network given the training sample data, F S refers to the feature map (i.e. the features of the second middle layer) output from the second specific network layer of the student network given the training sample data, y true refers to the ground-truth labels of the training sample data, and p S refers to the output classification probability of the student network, F S ∈ C S ×HW , F T ∈ C T ×HW , C T refers to a number of channels of F T , C S refers to a number of channels of F S , H is a larger one of heights of F T and F S , W is a larger one of widths of F T and F S ,

the method further comprising:

interpolating F T and F S according to H and W.

2. The method according to claim 1 , wherein iteratively training the student network and obtaining a target network, through aligning distributions of features between a first middle layer and a second middle layer corresponding to the same training sample data, comprises:

building an objective function of the student network, where the objective function includes a task specific loss function and a distance loss function, and the distance loss function is a function used to measure the distance between the distributions of the features of the first middle layer and the distributions of the features of the second middle layer corresponding to the same training sample data;

iteratively training the student network by using the training sample data; and,

obtaining the target network, when the iteration number of training reaches a threshold or the objective function satisfies the preset convergence conditions.

3. The method according to claim 2 , wherein iteratively training the student network by using the training sample data, comprises:

iteratively training the student network for multiple times by taking the steps described below:

feeding the training sample data in the current iteration into the teacher network and the student network respectively, and obtaining the features of the first middle layer and the second middle layer corresponding to the training sample data in the current iteration;

calculating the value of the objective function according to the training sample data in the current iteration and the corresponding features of the first middle layer and the second middle layer thereto, and adjusting the weights of the student network according to the value of the objective function; and,

continuing to the training of next iteration based on the weight adjusted student network.

4. The method according to claim 3 , wherein adjusting the weights of the student network according to the value of the objective function, comprises:

adjusting the weights of the student network according to the value of the objective function with a gradient descent optimization function.

5. The method according to claim 1 , wherein MMD 2 (F T , F S ) in the objective function comprises:

1

C

T

2

i

=

1

C

T

i

=

1

C

T

k

(

f

T

i

·

f

T

i

·

2

,

f

T

i

·

f

T

i

·

2

)

+

1

C

S

2

j

=

1

C

S

j

=

1

C

S

k

(

f

S

j

·

f

S

j

·

2

,

f

S

j

·

f

S

j

·

2

)

-

1

C

T

C

S

i

=

1

C

T

j

=

1

C

S

k

(

f

T

i

·

f

T

i

·

2

,

f

S

j

·

f

S

j

·

2

)

wherein, k(⋅,⋅) refers to a preset kernel function, C T refers to the number of channels of F T , C S refers to the number of channels of F S , f T 1⋅ represents the vectorized feature map of the i-th channel of F T , f T 1′⋅ represents the vectorized feature map of the i′-th channel of F T , f S j⋅ refers to the vectorized feature map of the j-th channel of F S , and f S j′⋅ refers to the vectorized feature map of the j′-th channel of F S .

6. The method according to claim 5 , wherein k(⋅,⋅) is a preset linear kernel function, a preset polynomial kernel function, or a preset Gaussian kernel function.

7. The method according to claim 1 , wherein the first specific network layer is a middle network layer or the last network layer of the teacher layer; and the second specific network layer is a middle network layer or the last network layer of the student layer.

8. A device for training a neural network, the device comprising:

a selecting element, configured to select a teacher network performing the same functions of a student network; and,

a training element, configured to iteratively train the student network and obtain a target network, through aligning distributions of features of a first middle layer and a second middle layer corresponding to the same training sample data, so as to transfer knowledge of features of a middle layer of the teacher network into the student network; wherein, the features of the first middle layer refer to a feature map F T output from a first specific network layer of the teacher network after the training sample data are provided to the teacher network, and the features of the second middle layer refer to a feature map F S output from a second specific network layer of the student network after the training sample data are provided to the student network,

wherein the training element comprises:

a building module configured to build an objective function of the student network wherein the objective function built by the building module comprises:

= ( y true ,p S )+λ MMD 2 ( F T ,F S )

wherein, (y true , p S ) refers to the cross-entropy loss function, MMD 2 (F T , F S ) refers to the distance loss function, λ refers to the weight of the distance loss function, F T refers to the feature map (i.e. the features of the first middle layer) output from the first specific network layer of the teacher network given the training sample data, F S refers to the feature map (i.e. the features of the second middle layer) output from the second specific network layer of the student network given the training sample data, y true refers to the ground-truth labels of the training sample data, and p S refers to the output classification probability of the student network, F S ∈ C S ×HW , F T ∈ C T ×HW , C T refers to a number of channels of F T , C S refers to a number of channels of F S , H is a larger one of heights of F T and F S , W is a larger one of widths of F T and F S ,

wherein the building module is further configured to:

interpolate F T and F S according to H and W.

9. The device according to claim 8 , wherein

the building module is further configured to build an objective function of the student network, where the objective function includes a task specific loss function and a distance loss function, and the distance loss function is a function used to measure the distance between the distributions of the features of the first middle layer and the distributions of the features of the second middle layer corresponding to the same training sample data,

the training element further comprises:

a training module, configured to iteratively train the student network using the training sample data; and,

a determining module, configure to obtain the target network, when the iteration number of training reaches a threshold or the objective function satisfies the preset convergence conditions.

10. The device according to claim 9 , wherein the training module, configured to iteratively train the student network for multiple times, is configured to:

feed the training sample data in the current iteration into the teacher network and the student network respectively, and obtain the features of the first middle layer and the second middle layer corresponding to the training sample data in the current iteration;

calculate the value of the objective function according to the training sample data in the current iteration and the corresponding features of the first middle layer and the second middle layer thereto, and adjust the weights of the student network according to the value of the objective function; and,

continue to the training of next iteration based on the weight adjusted student network.

11. The device according to claim 10 , wherein the training module, configured to adjust the weights of the student network according to the value of the objective function, is specifically configured to:

adjust the weights of the student network according to the value of the objective function with a gradient descent optimization function.

12. The device according to claim 8 , wherein MMD 2 (F T , F S ) in the objective function comprises:

1

C

T

2

i

=

1

C

T

i

=

1

C

T

k

(

f

T

i

·

f

T

i

·

2

,

f

T

i

·

f

T

i

·

2

)

+

1

C

S

2

j

=

1

C

S

j

=

1

C

S

k

(

f

S

j

·

f

S

j

·

2

,

f

S

j

·

f

S

j

·

2

)

-

2

C

T

C

S

i

=

1

C

T

j

=

1

C

S

k

(

f

T

i

·

f

T

i

·

2

,

f

S

j

·

f

S

j

·

2

)

wherein, k(⋅,⋅) refers to a preset kernel function, C T refers to the number of channels of F T , C S refers to the number of channels of F S , f T i⋅ represents the vectorized feature map of the i-th channel of F T , f T i′⋅ represents the vectorized feature map of the i′-th channel of F T , f S j⋅ refers to the vectorized feature map of the j-th channel of F S , and f S j′⋅ refers to the vectorized feature map of the j′-th channel of F S .

13. The device according to claim 12 , wherein k(⋅,⋅) is a preset linear kernel function, a preset polynomial kernel function, or a preset Gaussian kernel function.

14. The device according to claim 8 , wherein the first specific network layer is a middle network layer or the last network layer of the teacher layer; and the second specific network layer is a middle network layer or the last network layer of the student layer.

15. A device for training a neural network, the device comprising a processor and at least one memory, the at least one memory storing at least one machine executable instruction, which is executed by the processor to:

select a teacher network performing the same functions of a student network;

iteratively train the student network and obtain a target network, through aligning distributions of features between a first middle layer and a second middle layer corresponding to the same training sample data, so as to transfer knowledge of features of a middle layer of the teacher network to the student network; wherein, the features of the first middle layer refer to a feature map F T output from a first specific network layer of the teacher network after the training sample data are provided to the teacher network, and the features of the second middle layer refer to a feature map F S output from a second specific network layer of the student network after the training sample data are provided to the student network,

wherein the processor executes the at least one machine executable instruction to iteratively train the student network and obtain the target network, the at least one machine executable instruction being executed by the processor to:

build an objective function of the student network, wherein the objective function comprises:

= ( y true ,p S )+λ MMD 2 ( F T ,F S )

wherein, (y true , p S ) refers to the cross-entropy loss function, MMD 2 (F T , F S ) refers to the distance loss function, λ refers to the weight of the distance loss function, F T refers to the feature map (i.e. the features of the first middle layer) output from the first specific network layer of the teacher network given the training sample data, F S refers to the feature map (i.e. the features of the second middle layer) output from the second specific network layer of the student network given the training sample data, y true refers to the ground-truth labels of the training sample data, and p S refers to the output classification probability of the student network, F S ∈ C S ×HW , F T ∈ C T ×HW , C T refers to a number of channels of F T , C S refers to a number of channels of F S , H is a larger one of heights of F T and F S , W is a larger one of widths of F T and F S , and interpolate F T and F S according to H and W.

16. The device according to claim 15 , wherein the processor executes the at least one machine executable instruction to iteratively train the student network and obtain a target network, through aligning distributions of features between a first middle layer and a second middle layer corresponding to the same training sample data, the at least one machine executable instruction being executed by the processor to:

build an objective function of the student network, where the objective function includes a task specific loss function and a distance loss function, and the distance loss function is a function used to measure the distance between the distributions of the features of the first middle layer and the distributions of the features of the second middle layer corresponding to the same training sample data;

iteratively train the student network by using the training sample data; and

obtain the target network, when the iteration number of training reaches a threshold or the objective function satisfies the preset convergence conditions.

17. The device according to claim 16 , wherein the processor executes the at least one machine executable instruction to iteratively train the student network using the training sample data, the at least one machine executable instruction being executed by the processor to:

iteratively train the student network over multiple iterations by:

feeding the training sample data in a current iteration into the teacher network and the student network respectively, and obtaining the features of the first middle layer and the second middle layer corresponding to the training sample data in the current iteration;

calculating the value of the objective function according to the training sample data in the current iteration and the corresponding features of the first middle layer and the second middle layer thereto, and adjusting the weights of the student network according to the value of the objective function; and

continuing the training for a next iteration based on the weight adjusted student network.

Assignments (5)
CHANGE OF NAME Recorded Dec 9, 2025
From: TUSIMPLE, INC.
To: CREATEAI, INC.
Reel/Frame 073158/0715 →
CHANGE OF NAME Recorded Dec 9, 2025
From: BEIJING TUSEN ZHITU TECHNOLOGY CO., LTD.
To: BEIJING OCGEN TECHNOLOGY CO., LTD.
Reel/Frame 073916/0416 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 26, 2022
From: TUSIMPLE, INC.
To: BEIJING TUSEN ZHITU TECHNOLOGY CO., LTD.
Reel/Frame 058779/0374 →
CHANGE OF NAME Recorded Jan 30, 2020
From: TUSIMPLE
To: TUSIMPLE, INC.
Reel/Frame 051757/0470 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 17, 2018
From: HUANG, ZEHAO; WANG, NAIYAN
To: TUSIMPLE
Reel/Frame 047534/0428 →
Priority Claims (1)
CN 201710454691.6 · Jun 15, 2017 · national
Continuity (1)
Related Publication 20180365564A1 · Dec 20, 2018