Small sample image classification system and method
By combining the multi-resolution self-distillation network with global attention and adaptive fusion modules, the problem of image redundant background interference in small sample image classification is solved, the accuracy and generalization ability of the model are improved, and the model is realized under limited computing resources. Efficient image classification.
Patent Information
- Application Number
- CN202210719747.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-06-23
AI Technical Summary
In small-sample image classification tasks, the spatially redundant background interference of images makes it difficult to identify target features. It is difficult for existing technologies to effectively improve the accuracy and generalization ability of the model, especially on platforms with limited computing resources.
Using a combination of multi-resolution modules, global attention modules, adaptive fusion modules and self-distillation modules, through the multi-resolution self-distillation network, we learn feature embeddings at different resolutions, capture global interactive features, and use adaptive fusion strategies and The attention mechanism reduces information loss and improves the generalization ability of the model.
It effectively solves the image spatial redundancy problem in small sample learning, improves the accuracy and speed of image classification, and achieves the most advanced small sample image classification performance on Mini-ImageNet and Tiered-ImageNet through multi-resolution self-distillation network.
Smart Images

Figure CN115100470B
Abstract
Description
Technical Field
[0001] The invention relates to a small sample image classification system and a method thereof. Background Art
[0002] At present, deep neural networks (DNNs) have achieved very good results in image classification, object detection, and semantic segmentation. The general method to improve the accuracy of neural networks is to increase the depth and width of the network, but this often brings the disadvantage that the increased accuracy is not equal to the amount of calculation. In order to enable the network to run on a platform with limited computing resources, the goal that needs to be optimized is to improve the accuracy of the network model as much as possible on the basis of meeting resource constraints. Knowledge distillation is a commonly used method in network model compression. Unlike traditional knowledge distillation methods, self-knowledge distillation (SKD) does not require pre-training a teacher network to provide effective gain information to the student model, but instead performs knowledge distillation on a single model with the same architecture to reduce the cost of training a complex teacher network and improve the accuracy of the network to the greatest extent; however, deep learning models will inevitably have overfitting problems when learning. Humans can quickly learn a certain type of thing from a small number of samples and have strong generalization capabilities. Inspired by this, the concept of Few-shot Learning (FSL) came into being. Few-shot learning aims to allow deep learning models to use the commonality between training tasks to quickly generalize the learned prior knowledge to new tasks with only a small number of labeled samples, greatly reducing the cost and difficulty of obtaining sample data, and alleviating the common overfitting problem in deep learning; therefore, how to give full play to the potential of few-shot learning in image classification tasks is gradually becoming a research hotspot in the industry. In the few-shot learning task, there are strict requirements for the reliability of image classification results, and similar redundant backgrounds in the image will significantly interfere with the recognition of target features. When faced with input images with very complex backgrounds and a large amount of redundant information, the region of interest (ROI) can attract the attention of computer vision, and the redundant information of the image can be ignored by processing the region of interest in the extracted image. The metric learning-based method has achieved good results in the few-shot classification task. The image uses the top-level features for metric learning during the classification process. From the perspective of feature extraction, the top-level sample features have low resolution, and the detailed information such as the channel information and spatial information of the image is basically lost, resulting in poor accuracy in the few-shot image classification task. Spatial attention mechanisms and channel attention mechanisms are used to reduce the loss of detail information during classification, enabling the model to achieve higher accuracy; however, due to information reduction and dimensionality separation, these attention mechanisms only utilize visual representations from a limited receptive field. In this process, the interaction of global spatial channels is lost, thereby weakening the global representation information of the image. Summary of the invention
[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a small sample image classification system and method thereof.
[0004] The purpose of the present invention is achieved through the following technical solutions:
[0005] The small sample image classification system is characterized by: including a multi-resolution module, a global attention module, an adaptive fusion module, and a self-distillation module;
[0006] Multi-resolution module, learns feature embeddings of images of different resolutions and generates deep local descriptors for input images. It learns feature embeddings of images of different resolutions. The distribution of each query image and each support class can be represented at the level of deep local descriptors.
[0007] The global attention module amplifies the cross-dimensional receptive field and captures important interactive features in the global dimension;
[0008] Adaptive fusion module, the weight vector obtained by joint learning adaptively fuses local and global relations, and uses a non-parametric nearest neighbor classifier as a dynamic classifier;
[0009] The self-distillation module uses the deep network classifier as a teacher network to distill the shallow network that shares the weights of the second-layer convolutional module.
[0010] Furthermore, in the above-mentioned small sample image classification system, the multi-resolution module adopts a multi-scale architecture and a dense connection method to construct a multi-resolution network. To generate a new feature map with high resolution as input, a Regular-conv layer is constructed, which consists of a bottleneck layer and a regular convolution layer, each of which contains a batch normalization layer, a ReLU layer and a convolution layer; the Regular-conv layer is first used to upsample the image features in a bilinear interpolation manner during the convolution process, and then the obtained feature maps are fused through dense connections; the stride of the regular convolution in the Regular-conv layer is set to 2, a stride-conv layer is constructed, and it is embedded in a fusion block with downsampling, and then the obtained sample data of different resolutions is input into the network, and a deep local descriptor is generated for the input image, so that the distribution of each query image and each support class can be represented at the level of the deep local descriptor.
[0011] Furthermore, in the above-mentioned small sample image classification system, the global attention module adopts the sequential channel-space attention mechanism in CBAM, and redesigns the channel attention submodule and the spatial attention submodule; in the channel attention submodule, a three-dimensional arrangement is used to retain the three-dimensional information, and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency; in the spatial attention submodule, two convolutional layers are used for spatial information fusion; at the same time, pooling is deleted to further retain feature mapping, and group convolution with channel shuffling is used to prevent parameter increase.
[0012] Furthermore, in the above-mentioned small sample image classification system, the adaptive fusion module is based on a multi-resolution self-distillation network, and defines a joint asymmetric distribution measure between the query distribution and the support class distribution through the Conv Block. At the same time, taking into account the asymmetric local and global relationships, the KL divergence measure is used to calculate the global level relationship and the I2C measure is used to generate the local level relationship, and a fusion strategy is designed to adaptively fuse the local relationship and the global relationship together; a learnable two-dimensional weight vector is used to achieve fusion, and because the KL divergence represents dissimilarity rather than similarity, the negative value of the divergence is used to obtain similarity.
[0013] Furthermore, in the above-mentioned small sample image classification system, in which the self-distillation module, most prediction tasks in the deep learning network use the softmax layer to assign probability distribution to a large number of labels; according to the original structure of the target convolutional neural network, a shallow neural network is separated from the original network as a student network, and the deep network is regarded as a teacher network during training. The attention mechanism is integrated into the self-distillation learning, and a feedback connection from the deep layer to the shallow layer is constructed. By sharing the attention weights of different levels, the attention feature maps extracted from the networks at different levels are sent to the classifier to obtain the probability distribution of high-dimensional and low-dimensional predictions respectively, and then the deep network is distilled to the shallow neural network according to the predicted probability distribution.
[0014] The small sample image classification method of the present invention comprises the following steps:
[0015] First, a shallow sub-network is separated from the original network to recognize the low-resolution representation of the image, while maintaining the original network's ability to recognize high-resolution image features;
[0016] Then, a global attention mechanism is added to the multi-resolution network to reduce information loss and amplify the global interaction representation;
[0017] Next, the self-distillation learning method is used on the separated shallow sub-network to compress the deeper knowledge in the network into the shallow sub-network to improve the generalization ability of the shallow network;
[0018] Finally, the coarse-grained features in the low-resolution network are reused and fused into the high-resolution network to improve the model's ability to extract image representations.
[0019] Furthermore, the above-mentioned small sample image classification method based on multi-resolution self-distillation network uses a multi-resolution module to generate new feature maps with different resolutions as input; a global attention module to amplify the cross-dimensional receptive area and capture important interactive features of the global dimension; an adaptive fusion module to adaptively fuse local relationships and global relationships; and a self-distillation module to promote interactive learning between continuous layers, so that the model can extract common features of the image from the global features and improve the generalization ability of the model.
[0020] Furthermore, the above-mentioned small sample image classification method, the multi-resolution module, learns the feature embedding of images of different resolutions, sends the spatial low-resolution feature map to the shallow network to avoid the high compression cost caused by the convolution operation, and sends the spatial high-resolution image to the deep network to obtain the high-level mapping of the image; the shallow sub-network uses the low-resolution image features obtained by its corresponding basic feature map, and combines the high-resolution features of the second layer convolution module in the deep network to perform the classification task;
[0021] Global attention module, design a global attention mechanism, enlarge the cross-dimensional acceptance area, capture important interactive features of the global dimension, adopt the sequential channel-space attention mechanism in CBAM, and redesign the submodule; given the input feature map F1∈R C×H×W , the intermediate state F2 and output F3 are defined as:
[0022]
[0023]
[0024] Among them, M c and M s They are channel attention map and spatial attention map respectively. Represents element-wise multiplication;
[0025] In the channel attention submodule, a three-dimensional arrangement is used to retain the three-dimensional information and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency. To focus on spatial information, two convolutional layers are used in the spatial attention submodule for spatial information fusion. Since maximum pooling reduces information and produces negative contributions, pooling is removed to further retain feature mapping. Group convolution with channel shuffling is used to prevent the increase of parameters.
[0026] When performing group convolution, sparse connections between channels are used to make each convolution operation only act on the required feature maps, which is beneficial to reducing the parameters and calculation amount of the model and avoiding the large amount of time consumed by frequent memory interaction; in order to ensure the information exchange between feature maps of different groups after group convolution, the channel shuffling method is used to recombine the feature maps after group convolution. The specific method of channel shuffling is as follows: assuming that the input layer is divided into k groups and the total number of channels is k×n, the dimensions are first split into two dimensions (k, n), and then the two dimensions are transposed into (n, k), and finally reshaped into one dimension to achieve uniform channel shuffling; for the feature maps from the previous layer, the channel shuffling method is used to divide the feature maps of the previous layer into multiple different subgroups, and then the subgroup features are input into the groups of the next layer;
[0027] Adaptive fusion module, through Conv Block, defines the joint asymmetric distribution measure between query distribution and support class distribution, and takes into account asymmetric local and global relations. KL divergence measure is used to calculate global level relations and I2C measure is used to generate local level relations. Fusion strategy is designed to adaptively fuse local and global relations. A learnable two-dimensional weight vector w = [w1, w2] is used to achieve fusion. Since KL divergence represents dissimilarity rather than similarity, the negative value of divergence is used to obtain similarity. The final fused similarity D between query set Q and class S is defined as follows:
[0028] D(Q,S)=-W1·D KL (Q||S)+W2·D I2C (Q,S) (3)
[0029] For a 5-way 1-shot task and a specific query set Q, the output of the I2C branch or the KL branch is a 5-dimensional similarity vector; the two vectors are concatenated together to obtain a 10-dimensional vector; then, a 1D convolution layer with a kernel size of 1×1 and a dilation value of 5 is applied; a weighted 5-dimensional similarity vector is obtained by learning the 2D weights w; a batch normalization layer is added before the 1D convolution layer to balance the scale of the two similarities; a non-parametric nearest neighbor classifier is used to obtain the final classification result; at the same time, the cross entropy loss is also used to learn the entire network;
[0030] Self-distillation module. In deep learning networks, most prediction tasks use the softmax layer to assign probability distributions to a large number of labels. In order to fully utilize the similarity between categories, the parameter T is used to change the probability distribution to make it smoother for better distillation.
[0031]
[0032] Among them, for each input category x, the model generates a corresponding logit vector z(x). By increasing the parameter T, the mapping curve of the softmax layer is smoothed, the probability mapping is concentrated, and the probability distribution p is obtained;
[0033] This can be done by scaling the softmax output P of the teacher network T (X) and P of the student network S (X), using the loss function L for the student network KD Perform training, where H is the cross entropy loss, α is the hyperparameter, and T is the mapping parameter;
[0034]
[0035] According to the depth and original structure of the target convolutional neural network, a shallow neural network is separated from it; during training, the deep network is regarded as a teacher network, and the attention feature map extracted from the deep network is used to perform hierarchical attention distillation on the encoded rich image information in the network, so that the network can perform representation learning from the multi-resolution perspective of the image, and integrate the attention mechanism into self-distillation learning. By sharing the attention weights of different levels, the attention feature maps extracted from networks at different levels are sent to the classifier to obtain the probability distribution of high-dimensional and low-dimensional predictions respectively, and then the deep network is distilled to the shallow neural network according to the predicted probability distribution.
[0036] Compared with the prior art, the present invention has significant advantages and beneficial effects, which are specifically embodied in the following aspects:
[0037] ① The multi-resolution module, global attention module, adaptive fusion module and self-distillation module of the system of the present invention are jointly trained from scratch in an end-to-end manner, effectively solving the spatial redundancy problem of input samples in small sample learning;
[0038] ② The multi-resolution self-distillation network solves the problem of image spatial redundancy in small sample learning tasks. The multi-resolution learning method is used in the convolutional neural network to expand the input information of the image. The global attention mechanism is integrated into the self-distillation method, and the sequential channel-spatial attention mechanism module is used to retain information and amplify global cross-dimensional interactions, which can not only speed up image processing, but also improve the accuracy of model classification.
[0039] ③ Multi-resolution self-distillation network (MRSDN) for small sample image classification, starting from the perspective of multi-resolution, uses shallow sub-networks to process the coarse-grained features of the image; at the same time, uses a high-resolution network to learn more refined features for image classification; among them, global attention is used from the perspective of spatial and channel characteristics, and an adaptive fusion strategy is used to fuse the global and local relationships, and the spatial and channel information between images is extracted in a targeted manner, which enriches the network's ability to extract image features, and realizes efficient knowledge transfer within the model by using the self-distillation method.
[0040] ④MRSDN achieves state-of-the-art small-sample image classification performance on two common datasets, Mini-ImageNet and Tiered-ImageNet. Through detailed ablation studies, MRSDN also shows the benefits of fusion networks and multi-task training settings. It is possible to consider building multiple sets of student branches with different resolution representations to extract key features of the image, and try to change the number of modules sharing weights in the network to improve the accuracy of small-sample image classification.
[0041] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the specific embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0043] Figure 1 : Functional module diagram of the system of the present invention;
[0044] Figure 2 : Architecture flow chart of the system of the present invention;
[0045] Figure 3 : Schematic diagram of the principle of multi-resolution module;
[0046] Figure 4 : Schematic diagram of the principle of the global attention module;
[0047] Figure 5 : Schematic diagram of the principles of channel and spatial attention;
[0048] Figure 6 : Schematic diagram of the principle of adaptive fusion module. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0050] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, directional terms and order terms are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0051] The present invention proposes a multi-resolution self-distillation network (MRSDN) to solve the problem of image spatial redundancy in small sample learning tasks. Compared with the existing work of focusing on computational redundancy in network structures, the method of the present invention is a method of using multi-resolution learning in a convolutional neural network to expand the input information of the image. In order to improve the performance of the overall network, the global attention mechanism (GAM) is integrated into the self-distillation method, and the sequential channel-spatial attention mechanism module is used to retain information and amplify global cross-dimensional interactions, which can not only speed up the image processing speed, but also improve the correctness of model classification. Specifically, MRSDN is composed of networks with different input resolutions, in which the low-resolution network shares the second-layer convolution module with the high-resolution network. The low-resolution samples are classified by a shallow sub-network, and its feature map has the lowest spatial resolution; at the same time, the high-resolution network is used to identify the high-frequency information contained in the image as a supplement to the recognition sample, and finally the high-resolution network is distilled to the low-resolution network, the low-resolution network is continuously optimized, and the coarse-grained features in the low-resolution network are reused and fused into the high-resolution network to improve the model's ability to extract image representations. A large number of experiments were carried out on the multi-resolution self-distillation network on multiple benchmark test sets in the field of small sample learning. The experimental results outperformed the existing algorithms and verified their effectiveness.
[0052] like Figure 1As shown, the small sample image classification system includes a multi-resolution module 1, a global attention module 2, an adaptive fusion module 3 and a self-distillation module 4;
[0053] Multi-resolution module 1, learns feature embeddings of images of different resolutions and generates deep local descriptors for input images. It learns feature embeddings of images of different resolutions. The distribution of each query image and each support class can be represented at the level of deep local descriptors.
[0054] Global attention module 2, which enlarges the cross-dimensional receptive field and captures important interactive features of the global dimension;
[0055] Adaptive fusion module 3, the weight vector obtained by joint learning adaptively fuses the local relationship and the global relationship together, and uses a non-parametric nearest neighbor classifier as a dynamic classifier;
[0056] In the self-distillation module 4, the deep network classifier is used as a teacher network to distill the shallow network that shares the weights of the second-layer convolutional module. This promotes interactive learning between consecutive layers, enables the model to extract common features of the image from global features, and improves the generalization ability of the model.
[0057] The multi-resolution module 1 generates new feature maps with different resolutions as input; the global attention module 2 enlarges the cross-dimensional receptive area and captures important interactive features of the global dimension; the adaptive fusion module 3 adaptively fuses local and global relationships together; the self-distillation module 4 promotes interactive learning between consecutive layers, so that the model can extract common features of the image from the global features and improve the generalization ability of the model.
[0058] like Figure 2 As shown, the small sample image classification method includes the following steps:
[0059] First, a shallow sub-network is separated from the original network to recognize the low-resolution representation of the image, while maintaining the original network's ability to recognize high-resolution image features;
[0060] Then, a global attention mechanism is added to the multi-resolution network to reduce information loss and amplify the global interaction representation;
[0061] Next, the self-distillation learning method is used on the separated shallow sub-network to compress the deeper knowledge in the network into the shallow sub-network to improve the generalization ability of the shallow network;
[0062] Finally, the coarse-grained features in the low-resolution network are reused and fused into the high-resolution network to improve the model's ability to extract image representations.
[0063] like Figure 3As shown in the figure, the multi-resolution module 1 learns the feature embedding of images of different resolutions. The spatial low-resolution feature map is sent to the shallow network to avoid the high compression cost caused by the convolution operation, and the spatial high-resolution image is sent to the deep network to obtain the high-level mapping of the image; the shallow sub-network uses the low-resolution image features obtained by its corresponding basic feature map, and combines the high-resolution features of the second-layer convolution module in the deep network to perform the classification task; the multi-resolution module construction method is as follows: a multi-resolution network is constructed using a multi-scale architecture and a dense connection method. In order to generate a new feature map with high resolution as input, a Regular-conv layer is constructed, which consists of a bottleneck layer and a regular convolution layers, each of which contains a batch normalization layer, a ReLU layer and a convolution layer; first, the Regular-conv layer is used to upsample the image features in a bilinear interpolation manner during the convolution process, and then the obtained feature maps are fused through dense connections; then the stride of the regular convolution in the Regular-conv layer is set to 2, a stride-conv layer is constructed, and it is embedded in a fusion block with downsampling, and then the obtained sample data of different resolutions are input into the network, and a deep local descriptor is generated for the input image, so that each query image and the distribution of each support class can be represented at the level of the deep local descriptor.
[0064] Multi-resolution module 1, learns feature embedding of images with different resolutions, sends low-resolution spatial feature maps to the shallow network to avoid the high compression cost caused by convolution operations, and sends high-resolution spatial images to the deep network to obtain high-level mapping of the image; the shallow sub-network uses the low-resolution image features obtained by its corresponding basic feature map, and combines them with the high-resolution features of the second convolution module in the deep network to perform classification tasks;
[0065] like Figure 4 As shown in the figure, the global attention module 2 adopts the sequential channel-space attention mechanism in CBAM, and redesigns the channel attention submodule and the spatial attention submodule; in the channel attention submodule, a three-dimensional arrangement is used to retain the three-dimensional information, and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency; in the spatial attention submodule, two convolutional layers are used to fuse spatial information; at the same time, pooling is deleted to further retain the feature mapping, and group convolution with channel shuffling is used to prevent the increase of parameters;
[0066] Global Attention Module 2, designs a global attention mechanism, enlarges the cross-dimensional acceptance area, captures important interactive features of the global dimension, adopts the sequential channel-space attention mechanism in CBAM, and redesigns the submodules; given the input feature map F1∈RC×H×W , the intermediate state F2 and output F3 are defined as:
[0067]
[0068]
[0069] Among them, M c and M s They are channel attention map and spatial attention map respectively. Represents element-wise multiplication;
[0070] like Figure 5 As shown in the figure, a three-dimensional arrangement is used in the channel attention submodule to retain the three-dimensional information, and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency; two convolutional layers are used in the spatial attention submodule to fuse spatial information; at the same time, pooling is deleted to further retain the feature mapping, and group convolution with channel shuffling is used to prevent the increase of parameters. When performing grouped convolution, sparse connections between channels are used to make each convolution operation only act on the required feature maps, which is beneficial to reducing the parameters and calculation amount of the model and avoiding the large amount of time consumed by frequent memory interaction; in order to ensure the information exchange between feature maps of different groups after group convolution, the channel shuffling method is used to recombine the feature maps after group convolution. The specific method of channel shuffling is as follows: assuming that the input layer is divided into k groups and the total number of channels is k×n, the dimensions are first split into two dimensions (k, n), and then the two dimensions are transposed into (n, k), and finally reshaped into one dimension to achieve uniform channel shuffling; for the feature maps from the previous layer, the channel shuffling method is used to divide the feature maps of the previous layer into multiple different subgroups, and then the subgroup features are input into the group of the next layer; give full play to the advantages of group convolution to ensure that the input of the next group convolution comes from different groups, so that information can flow between different groups and enrich information interaction of different dimensions;
[0071] like Figure 6 As shown, the adaptive fusion module 3 is based on a multi-resolution self-distillation network, and defines a joint asymmetric distribution measure between the query distribution and the support class distribution through the Conv Block. Taking into account the asymmetric local and global relationships, the KL divergence measure is used to calculate the global level relationship and the I2C measure is used to generate the local level relationship, and a fusion strategy is designed to adaptively fuse the local relationship and the global relationship together. A learnable two-dimensional weight vector is used to achieve fusion. Since the KL divergence represents dissimilarity rather than similarity, the negative value of the divergence is used to obtain similarity.
[0072] Adaptive fusion module 3 defines the joint asymmetric distribution measure between the query distribution and the support class distribution through Conv Block, and takes into account the asymmetric local and global relations. The KL divergence measure is used to calculate the global level relationship and the I2C measure is used to generate the local level relationship. The fusion strategy is designed to adaptively fuse the local relationship and the global relationship together; a learnable two-dimensional weight vector w = [w1, w2] is used to achieve fusion; since the KL divergence represents dissimilarity rather than similarity, the negative value of the divergence is used to obtain similarity. The final fused similarity D between the query set Q and the class S is defined as follows:
[0073] D(Q,S)=-W1·D KL (Q||S)+W2·D I2C (Q,S) (3)
[0074] For a 5-way 1-shot task and a specific query set Q, the output of the I2C branch or the KL branch is a 5-dimensional similarity vector; the two vectors are concatenated together to obtain a 10-dimensional vector; then, a 1D convolution layer with a kernel size of 1×1 and a dilation value of 5 is applied; a weighted 5-dimensional similarity vector is obtained by learning the 2D weights w; a batch normalization layer is added before the 1D convolution layer to balance the scale of the two similarities; a non-parametric nearest neighbor classifier is used to obtain the final classification result; at the same time, the cross entropy loss is also used to learn the entire network;
[0075] Self-distillation module 4: Most prediction tasks in deep learning networks use the softmax layer to assign probability distributions to a large number of labels. According to the original structure of the target convolutional neural network, a shallow neural network is separated from the original network as a student network. During training, the deep network is regarded as a teacher network. The attention mechanism is integrated into the self-distillation learning to build a feedback connection from the deep layer to the shallow layer. By sharing the attention weights of different levels, the attention feature maps extracted from the networks at different levels are sent to the classifier to obtain the probability distributions of high-dimensional and low-dimensional predictions respectively. Then, the shallow neural network is distilled from the deep network according to the predicted probability distribution.
[0076] Self-distillation module 4. In deep learning networks, most prediction tasks use the softmax layer to assign probability distributions to a large number of labels. In order to make full use of the similarity between categories, the parameter T is used to change the probability distribution to make it smoother for better distillation.
[0077]
[0078] Among them, for each input category x, the model generates a corresponding logit vector z(x). By increasing the parameter T, the mapping curve of the softmax layer is smoothed, so the probability mapping will become concentrated, and finally the probability distribution p is obtained;
[0079] This can be done by scaling the softmax output P of the teacher network T (X) and P of the student network S (X), using the loss function L for the student network KD Perform training, where H is the cross entropy loss, α is the hyperparameter, and T is the mapping parameter;
[0080]
[0081] According to the depth and original structure of the target convolutional neural network, a shallow neural network is separated from it; during training, the deep network is regarded as a teacher network, and the attention feature map extracted from the deep network is used to perform hierarchical attention distillation on the encoded rich image information in the network, so that the network can perform representation learning from the multi-resolution perspective of the image, and integrate the attention mechanism into self-distillation learning. By sharing the attention weights of different levels, the attention feature maps extracted from networks at different levels are sent to the classifier to obtain the probability distribution of high-dimensional and low-dimensional predictions respectively, and then the deep network is distilled to the shallow neural network according to the predicted probability distribution.
[0082] The multi-resolution module learns feature embeddings of images of different resolutions and generates rich deep local descriptors for the input image; then, each query image and the distribution of each support class can be represented at the level of deep local descriptors; the global attention module amplifies significant cross-dimensional receptive regions and captures important interactive features of the global dimension; the weight vector jointly learned by the adaptive fusion module adaptively fuses local and global relations, and then a non-parametric nearest neighbor classifier is used as a dynamic classifier; for the self-distillation module, the deep network classifier is used as a teacher network to distill the shallow network that shares the weights of the second-layer convolutional module. The four modules are jointly trained from scratch in an end-to-end manner, effectively solving the spatial redundancy problem of input samples in small-sample learning.
[0083] In summary, the present invention is based on a small sample image classification system and method based on a multi-resolution self-distillation network. The multi-resolution self-distillation network (MRSDN) for small sample image classification uses a shallow sub-network to process the coarse-grained features of the image from the perspective of multi-resolution; at the same time, a high-resolution network is used to learn more refined features for image classification; wherein, global attention is used from the perspective of spatial and channel characteristics, and an adaptive fusion strategy is used to fuse the global and local relationships, and the spatial and channel information between images is extracted in a targeted manner, enriching the network's ability to extract image features, and finally realizing efficient knowledge transfer within the model by using the self-distillation method. MRSDN achieves state-of-the-art small sample image classification performance on two general datasets, Mini-ImageNet and Tiered-ImageNet. Through detailed ablation studies, MRSDN also shows the benefits of fusion networks and multi-task training settings. It is possible to consider constructing multiple groups of student branches represented by different resolutions to extract the key features of the image, and try to change the number of modules sharing weights in the network to improve the accuracy of small sample image classification.
[0084] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention. It should be noted that similar numbers and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0085] The above is only a specific implementation of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
[0086] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A small sample image classification system, characterized by: It includes a multi-resolution module (1), a global attention module (2), an adaptive fusion module (3) and a self-distillation module (4); Multi-resolution module (1) learns feature embeddings of images of different resolutions and generates deep local descriptors for input images. The feature embeddings of images of different resolutions are learned, and the distribution of each query image and each support class can be represented at the level of deep local descriptors. The global attention module (2) enlarges the cross-dimensional receptive field and captures important interaction features in the global dimension; Adaptive fusion module (3), the weight vector obtained by joint learning adaptively fuses local relations and global relations together, and adopts non-parametric nearest neighbor classifier as dynamic classifier; The self-distillation module (4) uses the deep network classifier as a teacher network to distill the shallow network that shares the weights of the second-layer convolutional module; The global attention module (2) adopts the sequential channel-space attention mechanism in CBAM and redesigns the channel attention submodule and the space attention submodule; in the channel attention submodule, a three-dimensional arrangement is used to retain the three-dimensional information, and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency relationship; Two convolutional layers are used in the spatial attention submodule to fuse spatial information. At the same time, pooling is deleted to further preserve feature mapping, and group convolution with channel shuffling is used to prevent parameter increase. The self-distillation module (4) uses a softmax layer to assign probability distributions to a large number of labels in most prediction tasks in a deep learning network; according to the original structure of the target convolutional neural network, a shallow neural network is separated from the original network as a student network. During training, the deep network is regarded as a teacher network. The attention mechanism is integrated into the self-distillation learning to construct a feedback connection from the deep layer to the shallow layer. By sharing the attention weights of different levels, the attention feature maps extracted from the networks at different levels are sent to the classifier to obtain the probability distributions of high-dimensional and low-dimensional predictions respectively, and then the deep network is distilled to the shallow neural network according to the predicted probability distribution.
2. The small sample image classification system according to claim 1, characterized in that: The multi-resolution module (1) adopts a multi-scale architecture and a dense connection method to build a multi-resolution network. To generate a new feature map with high resolution as input, a Regular-conv layer is constructed, which consists of a bottleneck layer and a regular convolution layer. Each layer contains a batch normalization layer, a ReLU layer and a convolution layer. The Regular-conv layer is first used to upsample the image features in a bilinear interpolation manner during the convolution process, and then the obtained feature maps are fused through dense connections. The stride of the regular convolution in the Regular-conv layer is set to 2, and a stride-conv layer is constructed, which is embedded in a fusion block with downsampling. The obtained sample data of different resolutions is then input into the network, and a deep local descriptor is generated for the input image, so that the distribution of each query image and each support class can be represented at the level of the deep local descriptor.
3. The small sample image classification system according to claim 1, characterized in that: The adaptive fusion module (3) is based on a multi-resolution self-distillation network. The Conv Block defines a joint asymmetric distribution measure between the query distribution and the support class distribution. Taking into account the asymmetric local and global relationships, the KL divergence measure is used to calculate the global level relationship and the I2C measure is used to generate the local level relationship. A fusion strategy is designed to adaptively fuse the local relationship and the global relationship. A learnable two-dimensional weight vector is used to achieve fusion. Since the KL divergence represents dissimilarity rather than similarity, the negative value of the divergence is used to obtain similarity.
4. A method for classifying small sample images using the system of claim 1, characterized in that: The following steps are involved: First, a shallow sub-network is separated from the original network to recognize the low-resolution representation of the image, while maintaining the original network's ability to recognize high-resolution image features; Then, a global attention mechanism is added to the multi-resolution network to reduce information loss and amplify the global interaction representation; Next, the self-distillation learning method is used on the separated shallow sub-network to compress the deeper knowledge in the network into the shallow sub-network to improve the generalization ability of the shallow network; Finally, the coarse-grained features in the low-resolution network are reused and fused into the high-resolution network to improve the model's ability to extract image representations.
5. The small sample image classification method according to claim 4, characterized in that: The multi-resolution module (1) generates new feature maps with different resolutions as input; the global attention module (2) enlarges the cross-dimensional receptive region and captures important interactive features of the global dimension; The adaptive fusion module (3) adaptively fuses the local relationship and the global relationship together; the self-distillation module (4) promotes interactive learning between consecutive layers, so that the model can extract the common features of the image from the global features and improve the generalization ability of the model.
6. The small sample image classification method according to claim 4, characterized in that: The multi-resolution module (1) learns feature embedding of images of different resolutions. The spatial low-resolution feature map is sent to the shallow network to avoid the high compression cost caused by the convolution operation, and the spatial high-resolution image is sent to the deep network to obtain the high-level mapping of the image. The shallow sub-network uses the low-resolution image features obtained by its corresponding basic feature map, and combines it with the high-resolution features of the second convolution module in the deep network to perform the classification task. Global attention module (2), design a global attention mechanism, enlarge the cross-dimensional acceptance area, capture important interactive features of the global dimension, adopt the sequential channel-space attention mechanism in CBAM, and redesign the submodules; given the input feature map F1∈R C×H×W , the intermediate state F2 and output F3 are defined as: Among them, M c and M s They are channel attention map and spatial attention map respectively. Represents element-wise multiplication; In the channel attention submodule, a three-dimensional arrangement is used to retain the three-dimensional information and a two-layer multi-layer perceptron is used to amplify the cross-dimensional channel-space dependency. To focus on spatial information, two convolutional layers are used in the spatial attention submodule for spatial information fusion. Since maximum pooling reduces information and produces negative contributions, pooling is removed to further retain feature mapping. Group convolution with channel shuffling is used to prevent the increase of parameters. When performing group convolution, sparse connections between channels are used to make each convolution operation only act on the required feature maps, which is beneficial to reducing the parameters and calculation amount of the model and avoiding the large amount of time consumed by frequent memory interaction; in order to ensure the information exchange between feature maps of different groups after group convolution, the channel shuffling method is used to recombine the feature maps after group convolution. The specific method of channel shuffling is as follows: assuming that the input layer is divided into k groups and the total number of channels is k×n, the dimensions are first split into two dimensions (k, n), and then the two dimensions are transposed into (n, k), and finally reshaped into one dimension to achieve uniform channel shuffling; for the feature maps from the previous layer, the channel shuffling method is used to divide the feature maps of the previous layer into multiple different subgroups, and then the subgroup features are input into the groups of the next layer; The adaptive fusion module (3) defines the joint asymmetric distribution measure between the query distribution and the support class distribution through the Conv Block, and takes into account the asymmetric local and global relations. The KL divergence measure is used to calculate the global level relationship and the I2C measure is used to generate the local level relationship. A fusion strategy is designed to adaptively fuse the local relationship and the global relationship together. A learnable two-dimensional weight vector w = [w1, w2] is used to achieve fusion. Since the KL divergence represents dissimilarity rather than similarity, the negative value of the divergence is used to obtain similarity. The final fused similarity D between the query set Q and the class S is defined as follows: D(Q,S)=-W1·D KL (Q||S)+W2·D I2C (Q,S) (3) For a 5-way 1-shot task and a specific query set Q, the output of the I2C branch or the KL branch is a 5-dimensional similarity vector; the two vectors are concatenated together to obtain a 10-dimensional vector; then, a 1D convolution layer with a kernel size of 1×1 and a dilation value of 5 is applied; a weighted 5-dimensional similarity vector is obtained by learning the 2D weights w; a batch normalization layer is added before the 1D convolution layer to balance the scale of the two similarities; a non-parametric nearest neighbor classifier is used to obtain the final classification result; at the same time, the cross entropy loss is also used to learn the entire network; Self-distillation module (4): In deep learning networks, most prediction tasks use a softmax layer to assign probability distributions to a large number of labels. In order to make full use of the similarity between categories, the parameter T is used to change the probability distribution to make it smoother for better distillation. Among them, for each input category x, the model generates a corresponding logit vector z(x). By increasing the parameter T, the mapping curve of the softmax layer is smoothed, the probability mapping is concentrated, and the probability distribution p is obtained; This can be done by scaling the softmax output P of the teacher network T (X) and P of the student network S (X), using the loss function L for the student network KD Perform training, where H is the cross entropy loss, α is the hyperparameter, and T is the mapping parameter; According to the depth and original structure of the target convolutional neural network, a shallow neural network is separated from it; during training, the deep network is regarded as a teacher network, and the attention feature map extracted from the deep network is used to perform hierarchical attention distillation on the encoded rich image information in the network, so that the network can perform representation learning from the multi-resolution perspective of the image, and integrate the attention mechanism into self-distillation learning. By sharing the attention weights of different levels, the attention feature maps extracted from networks at different levels are sent to the classifier to obtain the probability distribution of high-dimensional and low-dimensional predictions respectively, and then the deep network is distilled to the shallow neural network according to the predicted probability distribution.
