Small sample image classification method based on multi-stage fusion of local and global features

By employing a multi-stage fusion method of local and global features, the problem of feature redundancy and conflict in small sample image classification is solved, achieving more efficient feature extraction and classification accuracy, and is applicable to the fields of computer vision and artificial intelligence.

CN118781396BActive Publication Date: 2026-11-24NANTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410775192.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2026-11-24
Estimated Expiration
2044-06-17

AI Technical Summary

Technical Problem

Existing few-sample image classification models suffer from information redundancy and feature conflicts when combining local and global features, resulting in high computational resource requirements and difficulty in generalization, making it difficult to improve classification performance under few-sample conditions.

Method used

A multi-stage fusion method of local and global features is adopted, which performs parallel fusion in the pre-training stage and serial fusion in the few-sample classification test stage. The feature network is optimized by deep mutual learning and supervised self-supervised joint learning, and a globally invariant feature extractor is constructed.

Benefits of technology

It improves the discriminative power and robustness of the classification model, enhances the accuracy and robustness of small sample image classification, and outperforms existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118781396B_ABST
    Figure CN118781396B_ABST
Patent Text Reader

Abstract

This invention discloses a few-sample image classification method based on multi-stage fusion of local and global features. First, local and global feature networks are constructed and fused during the training phase using deep mutual learning. Then, features are extracted from images in the support sample set and query set using the local and global feature networks and fused sequentially. Finally, a logistic regression classifier is trained using the support sample features to complete the classification decision for the query sample. This invention employs a parallel fusion method of mutual learning to minimize the Kullback-Leibler divergence between the output probability distributions of the two networks. In the few-sample image classification testing phase, a concatenated sequential fusion method is used to map samples to a high-dimensional feature space, increasing the linear separability of the classification task and thus improving the performance of few-sample image classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image classification, and in particular relates to a small sample image classification method based on multi-stage fusion of local and global features. Background Technology

[0002] With the ever-increasing volume of multimedia data, image classification, as a fundamental task in computer vision, plays a crucial role in other tasks such as object detection, person re-identification, and object tracking. In recent years, the performance of image classification models based on deep convolutional neural networks (CNNs) on benchmark databases such as ImageNet has been continuously improved, gradually approaching or even surpassing human recognition levels. However, these remarkable achievements largely depend on optimizing the representation parameters in the model using large-scale labeled data. Manually labeling large amounts of image data is extremely time-consuming and resource-intensive, and sometimes data collection is simply impossible, such as for medical data on rare diseases or images of endangered species. This severely limits the practical application of CNNs in social and production fields. In contrast, the human visual system only needs to observe a few example images to quickly identify an object and generalize it to other unseen observations. Inspired by this powerful learning ability, few-shot classification (FSC) has become a very important cutting-edge research direction in computer vision and artificial intelligence.

[0003] Currently, most few-sample image classification methods rely on convolutional neural network (CNN)-based models, which extract local features from images through local receptive fields. Local features exhibit strong robustness against occlusion, lighting variations, and pose changes, but their effectiveness significantly decreases when faced with global shape or structural changes, easily leading to classification errors. While global features can capture the overall shape and structure of an image and have good discriminative ability in distinguishing different objects, they are susceptible to local noise and require significant computational resources. Under few-sample conditions, models are prone to overfitting and struggle to generalize to new data samples. Existing techniques attempt to leverage the advantages of both local and global features by combining them, but many challenges remain in feature fusion. Simple concatenation or weighting methods may fail to effectively utilize the complementarity of local and global features, leading to information redundancy and feature conflicts, while simultaneously increasing computational resource requirements and training difficulty, limiting model performance improvement. Summary of the Invention

[0004] Objective of this invention: The objective of this invention is to provide a few-sample image classification method based on multi-stage fusion of local and global features. In the few-sample image classification testing stage, a serial fusion method is employed to map samples to a high-dimensional feature space, increasing the linear separability of the classification task and thus improving the performance of few-sample image classification.

[0005] Technical solution: The present invention provides a few-sample image classification method based on multi-stage fusion of local and global features, comprising the following steps:

[0006] Step 1: Randomly split the image dataset I into base class datasets I base Supported sample set I sup and query sample set I quey ;

[0007] Step 2: Construct local feature network M1 and global feature network M2, using base class dataset I. base Pre-train M1 and M2, optimize the parameters in M1 and M2, and fuse M1 and M2;

[0008] Step 3: In the small sample classification test phase, the fused M1 and M2 are used to test the support sample set I. sup and query sample set I quey Image features are extracted and serially fused.

[0009] Step 4: Use the supporting sample features to train a logistic regression classifier to make classification decisions for the query sample.

[0010] Furthermore, step 1 specifically involves: for a given image dataset I, randomly dividing it into base class datasets Ii. base , verification set I val And the new class dataset I novel Used for model training, validation, and few-shot classification testing, where the class label spaces of each subset are disjoint; let I base There are a total of C b There are categories, where the m-th image sample is represented as x. m Its corresponding category label is represented as y m ; in I novel N categories are randomly selected from the image set, and K samples are randomly selected from each category to obtain the support sample set. A batch of samples is then selected from the remaining image set to obtain the query sample set. The few-sample image classification task requires the model to distinguish N categories using K support samples from each category. Let the support sample set represent... Where x k Let y represent the k-th image. k For its corresponding category label, the query set is represented as Where x qThis represents the q-th query sample.

[0011] Furthermore, the local feature network M1 consists of a backbone network f with parameter θ1. θ1 (·), the parameter matrix is base class classifier L b1 (·), the parameter matrix is Rotation predictor L r1 (·) and the parameter matrix are The projector P1(·) is composed of the global feature network M2, which is a backbone network f with parameter θ2. θ2 (·), the parameter matrix is base class classifier L b2 (·), the parameter matrix is Rotation predictor L r2 (·) and the parameter matrix are It consists of a projector P2(·).

[0012] Furthermore, the local feature network M1 and the global feature network M2 use the commonly used ResNet12 as the backbone network. This network model consists of four residual blocks, each containing three convolutional layers with a filter size of 3×3. The first three residual blocks use max pooling, while the last residual block uses average pooling. The number of filters in each residual block is 64, 160, 320, and 640, respectively. During the training phase, SGD is selected as the optimizer, with momentum set to 0.9 and weight decay set to 5×10⁻⁶. -4 For all experiments, the model was trained for 160 epochs with an initial learning rate of 0.025.

[0013] Furthermore, step 2 specifically includes the following steps:

[0014] Step 2.1, in base class dataset I base A batch of images is randomly selected from the data. The m-th image is represented as (x... m ,y m );

[0015] Step 2.2: The image is input into the enhancement module T(·) to construct the rotation prediction and instance discrimination tasks;

[0016] Step 2.3: Input the original image and its enhancement into M1 and M2 to extract features z. l m and z g m ; where the local feature network M1={f θ1 (·), L b1 (·), Lr1(·), P1(·)}, global feature network M2={fθ2 (·), L b2 (·), L r2 (·), P2(·)};

[0017] The predicted base class classification probabilities of M1 and M2 compared with the true base class label values ​​y m The formula for calculating the cross-entropy loss function between them is:

[0018]

[0019] Where y mb y represents the base class label value of the m-th image sample. m The b-th component. The predicted values ​​of rotation prediction probabilities for M1 and M2 compared to the actual rotation label values. m The formula for calculating the cross-entropy loss function between them is:

[0020]

[0021] Among them o mr The rotation label value o represents the m-th image sample. m The r-th component.

[0022] Let the image x m Positive sample images The V-dimensional projection feature obtained after passing through projectors M1 and M2 is represented as follows: and The calculation formula for comparative learning between models M1 and M2 is as follows:

[0023]

[0024] Where τ represents the temperature parameter.

[0025] Step 2.4: Obtain the output values ​​p of M1 and M2. l mb ,p g mb ,p l mr ,p g mr ,u l m ,u g m ;

[0026] Step 2.5: Calculate the joint learning loss function L for supervised and self-supervised learning according to the following formula. l JL L g JL ;

[0027]

[0028]

[0029] Where α1 and α2 are adjustable hyperparameters;

[0030] Step 2.6: Calculate the total loss function of M1 and M2 in the pre-training stage according to the following formula, and use the gradient descent algorithm to optimize the parameters in M1 and M2;

[0031]

[0032]

[0033] In the formula, β is an adjustable hyperparameter.

[0034] Furthermore, step 3 specifically includes the following steps:

[0035] Step 3.1: Utilize the backbone network f with parameter θ1 θ1 (·) and the backbone network f with parameter θ2 θ2 (·) Extract support sample image features z l k and z g k ;

[0036] Step 3.2: Obtain the fusion feature z according to the following formula. k And train the classifier h σ (·);

[0037]

[0038] The cat(·) operator represents the feature concatenation operation.

[0039] Furthermore, step 4 specifically involves: using f θ1 (·) and f θ2 (·) Extract the features z of the query sample image l q and z g q Then, the predicted value y' is output according to the following formula. q =h σ (z q ).

[0040] The present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method of the present invention.

[0041] The present invention also discloses a computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implements the steps of the method of the present invention.

[0042] The present invention also discloses a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the method of the present invention.

[0043] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:

[0044] (1) This invention proposes a few-sample image classification model based on global features and introduces nonlocal networks into the few-sample image classification task for the first time, thus creating a new technical path. By adding a nonlocal computation module to the backbone neural network and using supervised and self-supervised joint learning to pre-train the model, a global feature network model is established, which makes the feature extractor have global invariance properties and improves the discriminativeness of the classification model.

[0045] (2) This invention employs a multi-stage fusion strategy, using different fusion methods in both the pre-training stage for local and global features and the small-sample classification testing stage. In the pre-training stage, parallel fusion enhances the information interaction learning between features, improving the model's understanding and extraction capabilities. In the small-sample classification testing stage, a serial feature fusion method achieves higher-dimensional feature representation, further enhancing classification performance. This innovative fusion strategy enables the classification model to possess both robustness to local changes and discriminative power against global changes, effectively improving classification accuracy and robustness.

[0046] (3) This invention not only proposes a new technical solution, but also conducts detailed experimental verification on multiple small-sample image classification standard test libraries, verifying the effectiveness and practicality of the method, and has strong practical value. Compared with the most advanced methods currently available, this invention achieves superior performance in classification, proving its strong competitiveness and application prospects in practical applications. Attached Figure Description

[0047] Figure 1 This is a general framework diagram of the present invention;

[0048] Figure 2 Visualization of feature maps in a global feature network;

[0049] Figure 3 A schematic diagram of image reconstruction based on features. Detailed Implementation

[0050] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0051] The method of this invention first constructs local and global feature networks, and fuses them during the training phase using deep mutual learning. Then, it uses the local and global feature networks to extract features from images in the support sample set and query set, and performs sequential fusion. Finally, it uses the support sample features to train a logistic regression classifier to complete the classification decision for the query samples. The overall framework of this method is shown in the figure below. Figure 1 As shown.

[0052] Given an image dataset I, it is randomly split into base class datasets Ibase. base , verification set I val And the new class dataset I novel Used for model training, validation, and few-shot classification testing, the class label spaces of each subset are disjoint.

[0053] Let I base There are a total of C b There are categories, where the m-th image sample is represented as x. m Its corresponding category label is represented as y m . in I novel N classes are randomly selected from the image set, and K samples are randomly selected from each class to obtain the support set. A batch of samples is then drawn from the remaining image set to obtain the query set. The few-shot image classification task requires the model to distinguish N classes using K support samples from each class; this is called the N-way K-shot problem. Let the support set represent... Where x k Let y represent the k-th image. k This corresponds to its category label. The query set is represented as... Where x q This represents the q-th query sample.

[0054] The local feature network is denoted as M1, which mainly consists of a backbone network f with parameter θ1. θ1 (·), the parameter matrix is base class classifier L b1 (·), the parameter matrix is Rotation predictor L r1 (·) and the parameter matrix are The projector P1(·) is composed of the global feature network, denoted as M2, which is mainly composed of the backbone network f with parameter θ2. θ2 (·), the parameter matrix is base class classifier L b2 (·), the parameter matrix is Rotation predictor L r2 (·) and the parameter matrix are It consists of a projector P2(·).

[0055] Algorithm input: Base class dataset I base Supports sample set I sup Query sample set I quey , Enhancement module T(·), Local feature network M1={f θ1 (·), L b1 (·), Lr1(·), P1(·)}, global feature network M2={f θ2 (·), L b2 (·), L r2 (·), P2(·)}, temperature coefficient τ, hyperparameters α1, α2, β.

[0056] Phase 1: Feature Fusion in the Pre-training Phase

[0057] Iterative training steps:

[0058] 1.In I base A batch of images is randomly selected from the data. The m-th image is represented as (x... m ,y m );

[0059] 2. The image is input into T(·) to construct rotation prediction and instance discrimination tasks;

[0060] 3. Input the original image and its enhancement into M1 and M2 to extract features z. l m and z g m ;

[0061] 4. Obtain the output values ​​p of M1 and M2. l mb ,p g mb ,p l mr ,p g mr ,u l m ,u g m ;

[0062] 5. Calculate the joint learning loss function L for supervised and self-supervised learning according to the following formula. l JL L g JL ;

[0063]

[0064] Where α1 and α2 are adjustable hyperparameters.

[0065] 6. Calculate the total loss function of M1 and M2 in the pre-training stage according to the following formula, and use the gradient descent algorithm to optimize the parameters in M1 and M2;

[0066]

[0067] In the formula, β is an adjustable hyperparameter.

[0068] Phase 2: Feature Fusion in Small Sample Classification Testing

[0069] Iterative training steps

[0070] 1. Using f θ1 (·) and f θ2 (·) Extract support sample image features z l k and z g k ;

[0071] 2. The fusion feature z is obtained according to the following formula. k And train the classifier h σ (·);

[0072]

[0073] The cat(·) operator represents the feature concatenation operation.

[0074] After step 1 and step 2 iterative training are completed, f is used θ1 (·) and f θ2 (·) Extract the features z of the query sample image l q and z g q Then, the predicted value y' is output according to the following formula. q =h σ (z q )

[0075] Both the local and global feature networks use the commonly used ResNet12 as the backbone. The network model consists of four residual blocks, each containing three convolutional layers with 3×3 filters per layer. The first three residual blocks use max pooling, while the last residual block uses average pooling. The number of filters in each residual block is 64, 160, 320, and 640, respectively. During training, SGD is chosen as the optimizer, with momentum set to 0.9 and weight decay set to 5×10⁻⁶. -4For all experiments, the model was trained for 160 epochs with an initial learning rate of 0.025. After 70 epochs, the learning rate was adjusted to one-tenth of its original value every 30 epochs. The temperature coefficient τ in contrastive learning was set to 0.1. During the testing phase, 5-way 1-shot and 5-way 5-shot test tasks were performed on each dataset. For this purpose, 2000 episodes were randomly selected from the test dataset. In each episode, 15 images from each class were randomly selected as query images for testing. The algorithm's classification performance was evaluated as the average accuracy across all episodes, with the standard deviation of the accuracy at the 95% confidence interval provided in Table 1.

[0076] Table 1. Accuracy (%) and standard deviation of the local and global feature fusion algorithm at different stages on the 5-way 1-shot and 5-way 5-shot test tasks.

[0077]

[0078]

[0079] In the table, Local and Global represent unfused local and global features, respectively; L_train and G_train represent single-stage fusion methods during the pre-training phase of local and global features, respectively; G+L_test represents single-stage fusion methods during the testing phase of local and global features; and G+L_{train+test} represents multi-stage fusion methods for local and global features. The results show that the proposed method achieves high accuracy on multiple datasets.

[0080] Furthermore, the multi-stage fusion method for global and local features proposed in this invention employs a transfer learning paradigm. Therefore, it is compared with classic methods that also use this paradigm as baseline methods, and the test results on the miniImageNet dataset are shown in Table 2:

[0081] Table 2 shows the comparison results between our method and the baseline method on the miniImageNet dataset.

[0082]

[0083] The method of the present invention has also achieved the best results.

[0084] Attached are some feature visualizations

[0085] To verify the effectiveness of the global network, the feature map of layer 4 in the network was visualized. The visualization result is as follows: Figure 2As shown. Furthermore, to further verify the complementarity of the local and global networks, this invention will visually demonstrate what features their respective backbone networks retain. To this end, the features extracted from the backbone network are converted into RGB images, and the reconstruction results are shown below. Figure 3 As shown.

Claims

1. A few-sample image classification method based on multi-stage fusion of local and global features, characterized in that, Includes the following steps: Step 1: Randomly split the image dataset I into base class datasets I base Supported sample set I sup and query sample set I quey Step 1 specifically involves: for a given image dataset I, randomly dividing it into base class datasets Ii. base , verification set I val And the new class dataset I novel Used for model training, validation, and few-shot classification testing, where the class label spaces of each subset are disjoint; let I base There are a total of C b There are categories, where the m-th image sample is represented as x. m Its corresponding category label is represented as y m ; in I novel N categories are randomly selected from the image set, and K samples are randomly selected from each category to obtain the support sample set. A batch of samples is then selected from the remaining image set to obtain the query sample set. The few-sample image classification task requires the model to distinguish N categories using K support samples from each category. Let the support sample set represent... , where x k Let y represent the k-th image. k For its corresponding category label, the query set is represented as , where x q This represents the q-th query sample. Step 2: Construct local feature network M1 and global feature network M2, using base class dataset I. base Pre-train M1 and M2, optimize the parameters in M1 and M2, and fuse M1 and M2; Step 2 specifically includes the following steps: Step 2.1, in base class dataset I base A batch of images is randomly selected from the data. The m-th image is represented as (x... m , y m ); Step 2.2: The image is input into the enhancement module T(·) to construct the rotation prediction and instance discrimination tasks; Step 2.3: Input the original image and its enhancement into M1 and M2 to extract features z. l m and z g m ; Wherein, the local feature network M1={f θ1 (·), L b1 (·), Lr1(·), P1(·)}, Global Feature Network M2={f θ2 (·), L b2 (·), L r2 (·), P2(·)}; The predicted base class classification probabilities of M1 and M2 compared with the true base class label values ​​y m The formula for calculating the cross-entropy loss function between them is: ; Where y mb y represents the base class label value of the m-th image sample. m The b-th component; the predicted values ​​of rotation prediction probabilities for M1 and M2 compared to the actual rotation label values. m The formula for calculating the cross-entropy loss function between them is: ; Among them o mr The rotation label value o represents the m-th image sample. m The r-th component; Let the image x m Positive sample images The V-dimensional projection feature obtained after passing through projectors M1 and M2 is represented as follows: and The calculation formula for comparative learning between models M1 and M2 is as follows: ; in Indicates temperature parameter; Step 2.4: Obtain the output values ​​p of M1 and M2. l mb , p g mb , p l mr , p g mr , u l m , u g m ; Step 2.5: Calculate the joint learning loss function L for supervised and self-supervised learning according to the following formula. l JL L g JL ; ; in , These are adjustable hyperparameters; Step 2.6: Calculate the total loss function of M1 and M2 in the pre-training stage according to the following formula, and use the gradient descent algorithm to optimize the parameters in M1 and M2; ; In the formula, β is an adjustable hyperparameter; Step 3: In the small sample classification test phase, the fused M1 and M2 are used to test the support sample set I. sup and query sample set I quey Image features are extracted and serially fused. Step 4: Use the supporting sample features to train a logistic regression classifier to make classification decisions for the query sample.

2. The few-sample image classification method based on multi-stage fusion of local and global features according to claim 1, characterized in that, The local feature network M1 consists of a backbone network with parameter θ1. The parameter matrix is base class classifier The parameter matrix is Rotation predictor And the parameter matrix is Projector Composition; the global feature network is represented as M2, consisting of a backbone network with parameter θ2. The parameter matrix is base class classifier The parameter matrix is Rotation predictor And the parameter matrix is Projector composition.

3. The few-sample image classification method based on multi-stage fusion of local and global features according to claim 2, characterized in that, The local feature network M1 and the global feature network M2 use the commonly used ResNet12 as the backbone network. This network model consists of four residual blocks, each containing three convolutional layers with a filter size of 3×3. The first three residual blocks use max pooling, while the last residual block uses average pooling. The number of filters in each residual block is 64, 160, 320, and 640, respectively. During training, SGD is chosen as the optimizer, with momentum set to 0.9 and weight decay set to 5×10⁻⁶. -4 For all experiments, the model was trained for 160 epochs with an initial learning rate of 0.

025.

4. The few-sample image classification method based on multi-stage fusion of local and global features according to claim 1, characterized in that, Step 3 specifically includes the following steps: Step 3.1: Utilize the backbone network f with parameter θ1 θ1 (·) and the backbone network f with parameter θ2 θ2 (·) Extract supporting sample image features z l k and z g k ; Step 3.2: Obtain the fusion feature z according to the following formula. k And train the classifier h σ (·); ; in This indicates a feature splicing operation.

5. The few-sample image classification method based on multi-stage fusion of local and global features according to claim 1, characterized in that, Step 4 specifically involves: using f θ1 (·) and f θ2 (·) Extract the features z of the query sample image l q and z g q Then, the values ​​are merged, and finally, the predicted values ​​are output according to the following formula. .

6. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method of claim 1.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method of claim 1.

8. A computer program product, comprising a computer program, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method of claim 1.