A small sample image classification model compression method based on classroom learning

Through a classroom-based learning method, combined with joint learning of Euclidean space supervision and spherical space supervision, the problem of limited application of small sample image classification models in mobile terminals and unreliability of knowledge distillation is solved, and the model performance and compression effect are improved.

CN118052259BActive Publication Date: 2024-08-30SHENZHEN ZHONGHUA ROAD EDUCATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410264000.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-08
Publication Date
2024-08-30
Estimated Expiration
2044-03-08

AI Technical Summary

Technical Problem

Existing small-sample image classification models have limited application on mobile terminals and embedded devices, and traditional knowledge distillation methods have unreliable knowledge transfer problems caused by the gap between teacher networks and student networks.

Method used

A method based on classroom learning is used to construct a terminal three-branch teacher network and a terminal single-branch student network. The teacher network is pre-trained through joint learning of Euclidean space supervision, spherical space supervision and Euclidean self-supervision, combined with grouping and then grouping convolution. and a multi-stage feature deviation mechanism to realize preview and real-time classroom learning of student networks, integrating offline and online knowledge distillation algorithms.

Benefits of technology

It improves the small-sample image classification performance of lightweight models, promotes their application in mobile terminals and embedded devices, improves model compression performance, and integrates the advantages of offline and online knowledge distillation algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118052259B
    Figure CN118052259B
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and in particular to a small sample image classification model compression method based on classroom learning, comprising: first, constructing a terminal three-branch teacher network model, and using a base class data set to train the parameters in the three-branch teacher network model using a joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision. Then, construct a class based on a terminal single-branch student network, and use a new class data set to eliminate the backward class. Next, construct an auxiliary teaching aid based on grouping and regrouping convolution to help the student network complete the preview. Afterwards, a competition mechanism based on multi-stage feature deviation is used to generate a student network monitor. Finally, the terminal single-branch student network learns from each other under the guidance of the terminal three-branch teacher network to complete classroom learning. The present invention can improve the small sample image classification performance of a lightweight model and promote its application in practical occasions such as mobile terminals and embedded devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a small sample image classification model compression method based on classroom learning. Background Art

[0002] The study of small sample image classification has important research value in reducing data labeling costs and narrowing the gap between artificial intelligence and human intelligence. The purpose of this task is to complete the classification and recognition of unknown categories using only a small amount of labeled data. Since the supervision information provided by the unknown category is very limited, the small sample classification algorithm introduces additional base class data sets to learn and obtain prior classification knowledge. According to the learning method of processing the base class data set, the current small sample image classification algorithms can be roughly divided into meta-learning-based methods and transfer learning-based methods. In view of the fact that several research works have shown that feature representation plays an important role in improving the performance of small sample image classification, both methods are currently gradually using complex networks to enhance the feature representation performance of the model, such as Resnet12, WRN28 and even Vit-B. In particular, compared with the meta-learning method, the transfer learning-based method is more inclined to complex deep neural networks, and some advanced learning strategies such as self-supervised learning do not work well in lightweight networks. However, complex deep neural networks are not suitable for situations where computing resources are limited, such as mobile terminals and embedded devices. In contrast to the above situation, lightweight networks are more suitable for practical applications in industrial production because of their small number of model parameters. In this context, the present invention proposes a small sample image classification model compression task.

[0003] In addition, network pruning and knowledge distillation are common model compression techniques. Network pruning leads to high time costs due to iterative fine-tuning and is limited to a fixed series of model architectures. Knowledge distillation technology allows lightweight models to improve performance without additional costs and is flexible in form. Therefore, the present invention uses knowledge distillation to compress small sample image classification models. Traditional knowledge distillation algorithms use offline methods, which unidirectionally transfer knowledge from a pre-trained teacher network to a student network. Subsequently, online distillation methods have attracted widespread attention due to their excellent performance. In this method, student networks interact bidirectionally and learn together. Thanks to a powerful teacher network, offline knowledge distillation methods have developed rapidly, but the method is still limited by the gap between the teacher network and the student network. In view of the dynamic knowledge exchange between student networks with the same parameter capacity, online knowledge distillation methods have received increasing attention, but due to the lack of a powerful teacher network, the knowledge transferred in this method is unreliable. In order to solve the above problems, the present invention discloses a small sample image classification model compression method based on classroom learning. Summary of the invention

[0004] The purpose of this invention is to solve the shortcomings existing in the prior art, and to propose a small sample image classification model compression method based on classroom learning, which can improve the small sample image classification performance of lightweight models, and at the same time integrate the advantages of online knowledge distillation algorithm and offline knowledge distillation algorithm to improve model compression performance.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] A small sample image classification model compression method based on classroom learning, the specific steps are as follows:

[0007] Step 1, training of the teacher network: construct a terminal three-branch teacher network model, and use the joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision to pre-train the parameters in the three-branch teacher network model using the base class dataset;

[0008] Step 2, formation of student network class: construct a terminal single-branch student network to form a terminal single-branch student network class, and use the new class data set to eliminate the backward class;

[0009] Step 3: Preview of the student network: Construct an auxiliary teaching aid based on group-regroup convolution, and use the base class data set to preview the terminal single-branch student network;

[0010] Step 4, generation of class monitor: construct a competition mechanism based on multi-stage feature deviation to generate student network class monitor;

[0011] Step 5, real-time classroom learning: Build a real-time classroom learning mechanism, where the terminal single-branch student network learns from each other and grows together under the guidance of the terminal three-branch teacher network.

[0012] Preferably, in step 1, the specific steps are as follows:

[0013] S11: Construct a terminal three-branch teacher network model, abbreviated as in is the backbone network with parameter θ, The parameter matrix is ​​W t The Euclidean space supervision branch, The parameter matrix is ​​V t The spherical space supervision branch, The parameter matrix is ​​R t The Euclidean space self-supervised branch;

[0014] S12: Extract a batch of N images from the base class dataset, and any image is represented as x i , the base class label value is represented by y i, rotate it by four angles, and the corresponding rotation label value is represented by R i ; x i Input to the backbone network of the three-branch teacher network to obtain d t The feature of the dimension is expressed as feature Through the Euclidean space supervision branch, the spherical space supervision branch, and the Euclidean space self-supervision branch, the following outputs are obtained respectively:

[0015]

[0016]

[0017]

[0018] In formula (1), Denote the parameter matrix as W t The jth component of , C represents the total number of classification categories of the base class image; in formula (2), Represents the parameter matrix V t The kth component of , ||·|| represents the L2 norm operation; Formula (3), Represents the parameter matrix as R t The rth component of , R represents the total number of rotation categories of the base class image;

[0019] S13: Based on formula (1), formula (2) and formula (3), a Euclidean space supervised learning function, a spherical space supervised learning function and a Euclidean self-supervised learning function are established, which are respectively expressed as:

[0020]

[0021]

[0022]

[0023] In formula (5) represents the set of all images with the same label value as the i-th image.

[0024] Represents the output value of the spherical space supervision branch of the a-th image;

[0025] S14: Establish the objective function of the joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision, which is expressed as:

[0026]

[0027] In formula (7), α1 and α2 are adjustable parameters. Formula (7) is used to optimize the parameters in the terminal three-branch teacher network model using the gradient descent method to complete the training of the teacher network.

[0028] Preferably, in step 2, the specific steps are as follows:

[0029] S21: Construct a terminal single-branch student network model, abbreviated as in The parameter is θ s The backbone network, The parameter matrix is ​​W s Euclidean space supervision branch; suppose there are D classes, each class is composed of M terminal single-branch student networks, and the d∈D class is represented by d={s1,s2,...s M};

[0030] S22: Extract a batch of N images from the new class dataset, and any image is represented by I i , and its corresponding label value is expressed as It is input into the terminal single-branch student network model of each class respectively, and the output value of the Mth terminal single-branch student network of the dth class is expressed as O i , calculate the average deviation between the output value and the label value of each class, that is:

[0031]

[0032] The class with the smallest calculated value of formula (8) is selected as the best class for the subsequent steps.

[0033] Preferably, in step 3, the specific steps are as follows:

[0034] S31: Assume that the input tensor feature of the auxiliary teaching aid is expressed as The output tensor feature representation is Where H and W represent the height and width of the tensor feature, d s ,d t Respectively represent the number of feature channels in the student network and the teacher network, and d s <d t ; d t Divide by d s The resulting quotient is denoted G, and the remainder is denoted d r When d r > 0, the number of convolution groups in the auxiliary teaching aid is G+1; in the first G groups, the convolution kernel is of size H×W×d s The separable convolution of the g-th group is represented by K g, which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as:

[0035]

[0036] In formula (9), {k, l, m}, {i, j, m}, and {k+i-1, l+j-1, m} represent K g , the index of the S tensor feature; in the last set of convolutions in the auxiliary teaching aid, since the number of convolution kernels is not equal to d s The convolution kernel of this group adopts the size of H×W×d r ×d s Point convolution; the convolution kernel of the G+1th group is represented by K G+1 , which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as:

[0037]

[0038] In formula (10), {k, l, m}, {i, j, n, m}, and {k+i-1, l+j-1, m} represent K G+1 , the index of the S tensor feature, concatenate the output features of each group in the vertical direction to get the output features of the student network as:

[0039]

[0040] In formula (11), cat h (·) represents the concatenation operator;

[0041] S32: Add the auxiliary teaching aids constructed in the above step S31 to the backbone network of the terminal single-branch student network, extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i ; x i Input to the backbone network of the terminal single-branch student network to obtain d t The feature of the dimension is expressed as feature The output is obtained through the Euclidean space supervision branch:

[0042]

[0043] In formula (12), Denote the parameter matrix as W s The jth component of

[0044] S33: Based on formula (12), establish the Euclidean space supervised pre-learning function:

[0045]

[0046] Based on formula (13), the gradient descent method is used to optimize the parameters in the terminal single-branch student network model to complete the preview of the student network.

[0047] Preferably, in step 4, the specific steps are as follows:

[0048] S41: For the M student networks in the optimal class d, the neural network layer in the backbone network with auxiliary teaching aids is divided into Q stages, then the image feature output value of the qth stage network layer of the mth student is expressed as At the same time, the neural network layer in the backbone network of the terminal three-branch teacher network model is divided into Q stages, and the image feature output value of the qth stage network layer is expressed as

[0049] S42: Calculate the multi-stage feature deviation formula between the student network and the teacher network, expressed as:

[0050]

[0051] In formula (14), β q represents an adjustable parameter, and the student network with the smallest calculated value of formula (14) is selected as the only student monitor, which is abbreviated as The rest of the student network is regarded as member students, where the mth member student is simply denoted as

[0052] Preferably, in step 5, the specific steps are as follows:

[0053] S51: Extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i , x i The following characteristics are obtained by inputting the backbone network of the terminal three-branch teacher network, the terminal single-branch monitor student network and the terminal single-branch member network respectively:

[0054]

[0055]

[0056]

[0057] The features in formula (15), formula (16), and formula (17) are respectively passed through the Euclidean space supervision branch of the terminal three-branch teacher network, the terminal single-branch monitor student network, and the terminal single-branch member network to obtain the following output values:

[0058]

[0059]

[0060]

[0061] S52: In order to inherit the knowledge learned in the preview process, the following learning function is constructed for the terminal single-branch monitor student network and the terminal single-branch member network:

[0062]

[0063]

[0064] S53: In the real-time classroom learning process, the terminal three-branch teacher network transfers knowledge to the terminal single-branch monitor student network and the terminal single-branch member network by constructing a teaching objective function, which is expressed as:

[0065]

[0066]

[0067] S54: In the real-time classroom learning process, the terminal single-branch monitor student network and the terminal single-branch member network complete the knowledge interaction by constructing a discussion objective function, which is expressed as:

[0068]

[0069]

[0070] S55: In the real-time classroom learning process, the total learning function of the terminal single-branch monitor student network and the terminal single-branch member network is expressed as:

[0071]

[0072]

[0073] In formula (27) and formula (28), γ1 and γ2 are adjustable parameters. The gradient descent method is used in formula (27) and formula (28) to optimize the parameters of the terminal single-branch monitor student network and the terminal single-branch member network respectively to complete classroom learning. Finally, the terminal single-branch monitor student network is used to perform small sample classification task testing.

[0074] Compared with the prior art, the present invention has the following beneficial effects:

[0075] 1. The present invention can improve the small sample image classification performance of a lightweight model through a small sample image classification model compression method, greatly promoting its application in practical occasions such as mobile terminals and embedded devices.

[0076] 2. By constructing a classroom learning algorithm, the present invention can integrate the advantages of offline knowledge distillation and online knowledge distillation algorithms to improve model compression performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0077] Figure 1 is a flow chart of the present invention;

[0078] Figure 2 It is a performance curve diagram of the student network in the classroom learning process of the present invention. DETAILED DESCRIPTION

[0079] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings, so that those skilled in the art can better understand the advantages and features of the present invention, thereby making a clearer definition of the protection scope of the present invention. The embodiments described in the present invention are only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present invention.

[0080] Reference Figure 1 , a small sample image classification model compression method based on classroom learning, the specific steps are as follows:

[0081] Step 1: Construct a terminal three-branch teacher network model, which includes a backbone network, a Euclidean space supervision branch, a spherical space supervision branch, and a Euclidean space self-supervision branch. Extract a batch of images from the base class data set, input the images into the backbone network of the three-branch teacher network to extract features, and then obtain the network output through the Euclidean space supervision branch, the spherical space supervision branch, and the Euclidean space self-supervision branch. Establish the objective function of the joint learning method of Euclidean space supervision, spherical space supervision, and Euclidean self-supervision, use the gradient descent method to optimize the parameters in the terminal three-branch teacher network model, and complete the training of the teacher network. Specifically:

[0082] S11: Construct a terminal three-branch teacher network model, abbreviated as in is the backbone network with parameter θ, The parameter matrix is ​​W t The Euclidean space supervision branch, The parameter matrix is ​​Vt The spherical space supervision branch, The parameter matrix is ​​R t The Euclidean space self-supervised branch;

[0083] S12: Extract a batch of N images from the base class dataset, and any image is represented as x i , the base class label value is represented by y i , rotate it by four angles, and the corresponding rotation label value is represented by R i ; x i Input to the backbone network of the three-branch teacher network to obtain d t The feature of the dimension is expressed as feature Through the Euclidean space supervision branch, the spherical space supervision branch, and the Euclidean space self-supervision branch, the following outputs are obtained respectively:

[0084]

[0085]

[0086]

[0087] In formula (1), Denote the parameter matrix as W t The jth component of , C represents the total number of classification categories of the base class image; in formula (2), Represents the parameter matrix V t The kth component of , ||·|| represents the L2 norm operation; Formula (3), Represents the parameter matrix as R t The rth component of , R represents the total number of rotation categories of the base class image;

[0088] S13: Based on formula (1), formula (2) and formula (3), a Euclidean space supervised learning function, a spherical space supervised learning function and a Euclidean self-supervised learning function are established, which are respectively expressed as:

[0089]

[0090]

[0091]

[0092] In formula (5) represents the set of all images with the same label value as the i-th image. Represents the output value of the spherical space supervision branch of the a-th image;

[0093] S14: Establish the objective function of the joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision, which is expressed as:

[0094]

[0095] In formula (7), α1 and α2 are adjustable parameters. Formula (7) is used to optimize the parameters in the terminal three-branch teacher network model using the gradient descent method to complete the training of the teacher network.

[0096] Step 2: Construct a terminal single-branch student network model, which includes a backbone network and a Euclidean space supervision branch. Assume that there are D classes, each class is composed of M terminal single-branch student networks, extract a batch of images from the new class data set, input them into the terminal single-branch student network model of each class, calculate the average deviation between the output value and the label value of each class, and select the class with the smallest calculated value as the best class for subsequent steps. Specifically:

[0097] S21: Construct a terminal single-branch student network model, abbreviated as in The parameter is θ s The backbone network, The parameter matrix is ​​W s Euclidean space supervision branch; suppose there are D classes, each class is composed of M terminal single-branch student networks, and the d-th class is represented by d = {s1, s2, ... s M};

[0098] S22: Extract a batch of N images from the new class dataset, and any image is represented by I i , and its corresponding label value is expressed as It is input into the terminal single-branch student network model of each class respectively, and the output value of the Mth terminal single-branch student network of the dth class is expressed as O i , calculate the average deviation between the output value and the label value of each class, that is:

[0099]

[0100] The class with the smallest calculated value of formula (8) is selected as the best class for the subsequent steps.

[0101] Step 3: Divide the dimension of the output tensor feature by the dimension of the input tensor feature to obtain the quotient and remainder. When the remainder is greater than zero, the number of groups of convolutions in the auxiliary teaching aid is G+1. In the first G groups, the convolution kernel is a separable convolution to perform a convolution operation on the input tensor feature. In the last group of convolutions in the auxiliary teaching aid, the convolution kernel is a point convolution to perform a convolution operation on the input tensor feature. The output features of each group are spliced ​​together in the vertical direction to obtain the output features of the student network. Add the constructed auxiliary teaching aid to the backbone network of the terminal single-branch student network. Extract a batch of images from the base class dataset, input the images into the backbone network of the terminal single-branch student network to obtain features, and then obtain the output through the Euclidean space supervision branch, establish a Euclidean space supervision pre-learning function, and use the gradient descent method to optimize the parameters in the terminal single-branch student network model to complete the preview of the student network. Specifically:

[0102] S31: Assume that the input tensor feature of the auxiliary teaching aid is expressed as The output tensor feature representation is Where H and W represent the height and width of the tensor feature, d s d t Respectively represent the number of feature channels in the student network and the teacher network, and d s <d t ; will d t Divide by d s The resulting quotient is denoted G, and the remainder is denoted d r ; When d r > 0, the number of convolution groups in the auxiliary teaching aid is G+1; in the first G groups, the convolution kernel is of size H×W×d s The separable convolution of the g-th group is represented by K g , which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as:

[0103]

[0104] In formula (9), {k, l, m}, {i, j, m}, and {k+i-1, l+j-1, m} represent K g , the index of the S tensor feature; in the last set of convolutions in the auxiliary teaching aid, since the number of convolution kernels is not equal to d s The convolution kernel of this group adopts the size of H×W×d r ×d s Point convolution; the convolution kernel of the G+1th group is represented by K G+1 , which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as:

[0105]

[0106] In formula (10), {k, l, m}, {i, j, n, m}, and {k+i-1, l+j-1, m} represent K G+1 , the index of the S tensor feature, concatenate the output features of each group in the vertical direction to get the output features of the student network as:

[0107]

[0108] In formula (11), cat h (·) represents the concatenation operator;

[0109] S32: Add the auxiliary teaching aids constructed in the above step S31 to the backbone network of the terminal single-branch student network, extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i ; x i Input to the backbone network of the terminal single-branch student network to obtain d t The feature of the dimension is expressed as feature The output is obtained through the Euclidean space supervision branch:

[0110]

[0111] In formula (12), Denote the parameter matrix as W s The jth component of

[0112] S33: Based on formula (12), establish the Euclidean space supervised pre-learning function:

[0113]

[0114] Based on formula (13), the gradient descent method is used to optimize the parameters in the terminal single-branch student network model to complete the preview of the student network.

[0115] Step 4: For the student network of the optimal class, divide the neural network layer in the backbone network with auxiliary teaching aids into several stages, and divide the neural network layer in the backbone network of the terminal three-branch teacher network model into the same several stages. Calculate the feature output of each stage of the student network and the teacher network and the multi-stage feature deviation value between the student network and the teacher network, and select the student network with the smallest calculated value as the only student monitor. Specifically:

[0116] S41: For the M student networks in the optimal class d, the neural network layer in the backbone network with auxiliary teaching aids is divided into Q stages, then the image feature output value of the qth stage network layer of the mth student is expressed as At the same time, the neural network layer in the backbone network of the terminal three-branch teacher network model is divided into Q stages, and the image feature output value of the qth stage network layer is expressed as

[0117] S42: Calculate the multi-stage feature deviation formula between the student network and the teacher network, expressed as:

[0118]

[0119] In formula (14), β q represents an adjustable parameter, and the student network with the smallest calculated value of formula (14) is selected as the only student monitor, which is abbreviated as The rest of the student network is regarded as member students, where the mth member student is simply denoted as

[0120] Step 5: Extract a batch of images from the base class data set, input them into the backbone network of the terminal three-branch teacher network, the terminal single-branch monitor student network and the terminal single-branch member network, respectively, and pass the features through the Euclidean space supervision branch of the terminal three-branch teacher network, the terminal single-branch monitor student network and the terminal single-branch member network to obtain the output value. In order to inherit the knowledge learned in the preview process, a learning function is constructed for the terminal single-branch monitor student network and the terminal single-branch member network. In the real-time classroom learning process, the terminal three-branch teacher network transfers knowledge to the terminal single-branch monitor student network and the terminal single-branch member network by constructing a teaching objective function, and at the same time, the terminal single-branch monitor student network and the terminal single-branch member network complete the interaction of knowledge by constructing a discussion objective function. The weighted sum of the learning function, the teaching function and the discussion constitutes the total objective function of the terminal single-branch monitor student network and the terminal single-branch member network, and classroom learning is completed based on the total objective function. When the backbone networks of the student network are lightweight Conv4-64F, Conv4-256F and MobileNet, the students' classroom learning process is as follows: Figure 2 Finally, the terminal single-branch monitor student network is used to test the small sample classification task. The test results obtained on the public small sample image classification dataset are shown in Table 1. Specifically:

[0121] S51: Extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i , x iThe following characteristics are obtained by inputting the backbone network of the terminal three-branch teacher network, the terminal single-branch monitor student network and the terminal single-branch member network respectively:

[0122]

[0123]

[0124]

[0125] The features in formula (15), formula (16), and formula (17) are respectively passed through the Euclidean space supervision branch of the terminal three-branch teacher network, the terminal single-branch monitor student network, and the terminal single-branch member network to obtain the following output values:

[0126]

[0127]

[0128]

[0129] S52: In order to inherit the knowledge learned in the preview process, the following learning function is constructed for the terminal single-branch monitor student network and the terminal single-branch member network:

[0130]

[0131]

[0132] S53: In the real-time classroom learning process, the terminal three-branch teacher network transfers knowledge to the terminal single-branch monitor student network and the terminal single-branch member network by constructing a teaching objective function, which is expressed as:

[0133]

[0134]

[0135] S54: In the real-time classroom learning process, the terminal single-branch monitor student network and the terminal single-branch member network complete the knowledge interaction by constructing a discussion objective function, which is expressed as:

[0136]

[0137]

[0138] S55: In the real-time classroom learning process, the total learning function of the terminal single-branch monitor student network and the terminal single-branch member network is expressed as:

[0139]

[0140]

[0141] In formula (27) and formula (28), γ1 and γ2 are adjustable parameters. The gradient descent method is used in formula (27) and formula (28) to optimize the parameters of the terminal single-branch monitor student network and the terminal single-branch member network respectively to complete classroom learning. Finally, the terminal single-branch monitor student network is used to perform small sample classification task testing.

[0142] Table 1 Classification performance of the lightweight model as the backbone network of the student network in the public small sample image dataset (%)

[0143] miniImageNet CIFAR-FS CUB Conv-64F 74.60±0.62 82.48±0.64 85.96±0.52 Conv-256F 80.12±0.57 87.06±0.59 89.47±0.43 MobileNet 81.56±0.58 87.40±0.61 89.69±0.68

[0144] To sum up, the present invention can improve the small sample image classification performance of lightweight models through the small sample image classification model compression method, greatly promoting its application in practical occasions such as mobile terminals and embedded devices; by constructing a classroom learning algorithm, it can integrate the advantages of offline knowledge distillation and online knowledge distillation algorithms to improve model compression performance.

[0145] The description and practice disclosed in the present invention are easy to think and understand for ordinary technicians in the technical field, and several improvements and modifications can be made without departing from the principles of the present invention. Therefore, modifications or improvements made without departing from the spirit of the present invention should also be regarded as the protection scope of the present invention.

Claims

1. A small sample image classification model compression method based on classroom learning, characterized in that: The specific steps are as follows: Step 1, training of the teacher network: construct a terminal three-branch teacher network model, and use the joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision to pre-train the parameters in the three-branch teacher network model using the base class dataset; Step 2, formation of student network class: construct a terminal single-branch student network to form a terminal single-branch student network class, and use the new class data set to eliminate the backward class; Step 3: Preview of the student network: Construct an auxiliary teaching aid based on group-regroup convolution, and use the base class data set to preview the terminal single-branch student network; Step 4, generation of class monitor: construct a competition mechanism based on multi-stage feature deviation to generate student network class monitor; Step 5, real-time classroom learning: Build a real-time classroom learning mechanism, where the terminal single-branch student network learns from each other and grows together under the guidance of the terminal three-branch teacher network.

2. According to the small sample image classification model compression method based on classroom learning in claim 1, it is characterized in that: In step 1, the specific steps are as follows: S11: Construct a terminal three-branch teacher network model, abbreviated as in is the backbone network with parameter θ, The parameter matrix is ​​W t The Euclidean space supervision branch, The parameter matrix is ​​V t The spherical space supervision branch, The parameter matrix is ​​R t The Euclidean space self-supervised branch; S12: Extract a batch of N images from the base class dataset, and any image is represented as x i , the base class label value is represented by y i , rotate it by four angles, and the corresponding rotation label value is represented by R i ; x i Input to the backbone network of the three-branch teacher network to obtain d t The feature of the dimension is expressed as feature Through the Euclidean space supervision branch, the spherical space supervision branch, and the Euclidean space self-supervision branch, the following outputs are obtained respectively: In formula (1), Denote the parameter matrix as W t The jth component of , C represents the total number of classification categories of the base class image; in formula (2), Represents the parameter matrix V t The kth component of , ||·|| represents the L2 norm operation; Formula (3), Represents the parameter matrix as R t The rth component of , R represents the total number of rotation categories of the base class image; S13: Based on formula (1), formula (2) and formula (3), a Euclidean space supervised learning function, a spherical space supervised learning function and a Euclidean self-supervised learning function are established, which are respectively expressed as: In formula (5) represents the set of all images with the same label value as the i-th image. Represents the output value of the spherical space supervision branch of the a-th image; S14: Establish the objective function of the joint learning method of Euclidean space supervision, spherical space supervision and Euclidean self-supervision, which is expressed as: In formula (7), α1 and α2 are adjustable parameters. Formula (7) is used to optimize the parameters in the terminal three-branch teacher network model using the gradient descent method to complete the training of the teacher network.

3. The small sample image classification model compression method based on classroom learning according to claim 1 is characterized in that: In step 2, the specific steps are as follows: S21: Construct a terminal single-branch student network model, abbreviated as in The parameter is θ s The backbone network, The parameter matrix is ​​W s Euclidean space supervision branch; suppose there are D classes, each class is composed of M terminal single-branch student networks, and the d∈D class is represented by d={s1,s2,...s M }; S22: Extract a batch of N images from the new class dataset, and any image is represented by I i , and its corresponding label value is expressed as It is input into the terminal single-branch student network model of each class respectively, and the output value of the Mth terminal single-branch student network of the dth class is expressed as O i , calculate the average deviation between the output value and the label value of each class, that is: The class with the smallest calculated value of formula (8) is selected as the best class for the subsequent steps.

4. The small sample image classification model compression method based on classroom learning according to claim 1 is characterized in that: In step 3, the specific steps are as follows: S31: Assume that the input tensor feature of the auxiliary teaching aid is expressed as The output tensor feature representation is Where H and W represent the height and width of the tensor feature, d s ,d t Respectively represent the number of feature channels in the student network and the teacher network, and d s <d t ; will d t Divide by d s The resulting quotient is denoted G, and the remainder is denoted d r When d r > 0, the number of convolution groups in the auxiliary teaching aid is G+1; in the first G groups, the convolution kernel is of size H×W×d s The separable convolution of the g-th group is represented by K g , which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as: In formula (9), {k, l, m}, {i, j, m}, and {k+i-1, l+j-1, m} represent K g , the index of the S tensor feature; in the last set of convolutions in the auxiliary teaching aid, since the number of convolution kernels is not equal to d s The convolution kernel of this group adopts the size of H×W×d r ×d s Point convolution; the convolution kernel of the G+1th group is represented by K G+1 , which is applied to each channel of the input tensor feature S to obtain the tensor feature The mth component of is expressed as: In formula (10), {k, l, m}, {i, j, n, m}, and {k+i-1, l+j-1, m} represent K G+1 , the index of the S tensor feature, concatenate the output features of each group in the vertical direction to get the output features of the student network as: In formula (11), cat h (·) represents the concatenation operator; S32: Add the auxiliary teaching aids constructed in the above step S31 to the backbone network of the terminal single-branch student network, extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i ; x i Input to the backbone network of the terminal single-branch student network to obtain d t The feature of the dimension is expressed as feature The output is obtained through the Euclidean space supervision branch: In formula (12), Denote the parameter matrix as Ws 的 The jth component; S33: Based on formula (12), establish the Euclidean space supervised pre-learning function: Based on formula (13), the gradient descent method is used to optimize the parameters in the terminal single-branch student network model to complete the preview of the student network.

5. The small sample image classification model compression method based on classroom learning according to claim 1 is characterized in that: In step 4, the specific steps are as follows: S41: For the M student networks in the optimal class h, the neural network layer in the backbone network with auxiliary teaching aids is divided into Q stages, then the image feature output value of the qth stage network layer of the mth student is expressed as At the same time, the neural network layer in the backbone network of the terminal three-branch teacher network model is divided into Q stages, and the image feature output value of the qth stage network layer is expressed as S42: Calculate the multi-stage feature deviation formula between the student network and the teacher network, expressed as: In formula (14), β q represents an adjustable parameter, and the student network with the smallest calculated value of formula (14) is selected as the only student monitor, which is abbreviated as The rest of the student network is regarded as member students, where the mth member student is simply denoted as 6. The small sample image classification model compression method based on classroom learning according to claim 1 is characterized in that: In step 5, the specific steps are as follows: S51: Extract a batch of N images from the base class data set, and any image is represented as x i , the base class label value is represented by y i , x i The following characteristics are obtained by inputting the backbone network of the terminal three-branch teacher network, the terminal single-branch monitor student network and the terminal single-branch member network respectively: The features in formula (15), formula (16), and formula (17) are respectively passed through the Euclidean space supervision branch of the terminal three-branch teacher network, the terminal single-branch monitor student network, and the terminal single-branch member network to obtain the following output values: S52: In order to inherit the knowledge learned in the preview process, the following learning function is constructed for the terminal single-branch monitor student network and the terminal single-branch member network: S53: In the real-time classroom learning process, the terminal three-branch teacher network transfers knowledge to the terminal single-branch monitor student network and the terminal single-branch member network by constructing a teaching objective function, which is expressed as: S54: In the real-time classroom learning process, the terminal single-branch monitor student network and the terminal single-branch member network complete the knowledge interaction by constructing a discussion objective function, which is expressed as: S55: In the real-time classroom learning process, the total learning function of the terminal single-branch monitor student network and the terminal single-branch member network is expressed as: In formula (27) and formula (28), γ1 and γ2 are adjustable parameters. The gradient descent method is used in formula (27) and formula (28) to optimize the parameters of the terminal single-branch monitor student network and the terminal single-branch member network respectively to complete classroom learning. Finally, the terminal single-branch monitor student network is used to perform small sample classification task testing.

Citation Information

Patent Citations

  • Model compression method based on group relation knowledge distillation

    CN114626504A

  • Small sample image classification method based on supervised and self-supervised combined comparative learning

    CN115810127A