Small sample identification method based on neighbor Mixup feature calibration

By employing the nearest neighbor Mixup feature calibration method in small sample recognition, and through interpolation between new category and neighboring base category samples, the problem of low feature discrimination of the new category is solved, thereby improving recognition performance.

CN121904469APending Publication Date: 2026-04-21Huairou Laboratory Xinjiang Research Institute
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Huairou Laboratory Xinjiang Research Institute
Filing Date
2026-01-13
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies suffer from low feature discrimination in small sample recognition due to the difference between the concepts of new and basic categories, and simple fine-tuning methods cannot learn generalizable representations, thus affecting recognition performance.

Method used

A nearest-neighbor Mixup feature calibration method is adopted, which performs local nonmanifold regularization and global target optimization by interpolating between samples of the new category and the neighboring basic category, thus forming a small sample network recognition model.

Benefits of technology

It improves the performance of small sample recognition and achieves higher recognition accuracy by enhancing feature representation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121904469A_ABST
    Figure CN121904469A_ABST
Patent Text Reader

Abstract

The invention discloses a small sample recognition method based on neighbor Mixup feature calibration, and belongs to the technical field of image recognition. Comprising the following steps: pre-training a network identification model by using images of all basic categories; on the basis of the network recognition model, a new classifier is added to a new category of small sample tasks to be recognized, and a small sample network recognition model is formed; performing feature calibration on the small sample network identification model through neighbor Mixup; wherein the adjacent Mixup performs interpolation operation between the new category sample and the adjacent basic category sample; performing global target optimization on the calibrated small sample network identification model; and utilizing the pre-trained network identification model and the optimized small sample network identification model to identify a target category to which the small sample image belongs. The small sample identification accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of image recognition technology, specifically relating to a small sample recognition method and governance method based on nearest neighbor Mixup feature calibration. Background Technology

[0002] The goal of few-shot recognition is to identify new categories using a small number of labeled samples, leveraging transferable knowledge derived from training data (base categories). This technique is widely used in fields such as computer vision and robot navigation.

[0003] Currently, metric-based methods utilize base categories to learn feature encoding networks, which are then fixed to identify new categories. However, due to the conceptual differences between new and base categories, the features generated by the fixed network for new categories have low discriminative power. Furthermore, due to the limited number of new samples, simple fine-tuning methods cannot learn generalizable representations and may even impair transferable knowledge gained during pre-training. Therefore, feature calibration is often employed to enhance new representations.

[0004] Chinese patent application CN114187469A uses the Mixup technique to augment the original data, while Chinese patent application CN119229194A uses the Mixup technique to enhance feature diversity. Chinese patent application CN119992223A employs feature map reconstruction technology to enhance the model, and Chinese patent application CN118115730A performs feature calibration by extracting the relationship between the prototype and query set data.

[0005] All of the above methods improve feature discrimination by modifying the Mixup technique, thereby improving small sample recognition performance. Summary of the Invention

[0006] To address the problem of poor recognition performance in existing technologies when there are few samples, this invention provides a small sample recognition method based on nearest neighbor Mixup feature calibration, which offers another technical solution to improve the recognition performance of small samples.

[0007] This invention provides a few-sample recognition method based on nearest-neighbor Mixup feature calibration, comprising the following steps: Step S1: Pre-train a network recognition model using images from all basic categories. This network recognition model includes a feature encoding network and a cosine similarity-based classifier F. cls ; Step S2: Based on the network recognition model, add a new classifier for the few-shot task of the new category to be recognized, forming a few-shot network recognition model; Step S3: Perform feature calibration on the few-shot network recognition model using nearest neighbor Mixup to obtain the calibrated few-shot network recognition model; wherein, nearest neighbor Mixup specifically involves interpolating between samples of the new class and samples of the neighboring basic class to achieve local nonmanifold regularization on the new class; Step S4: Perform global target optimization on the calibrated few-shot network recognition model to obtain the optimized few-shot network recognition model; Step S5: Use the pre-trained network recognition model and the optimized few-shot network recognition model to identify the few-shot category to which the few-shot image belongs.

[0008] Preferably, step S01 specifically includes the following steps: Step 101: Train the feature encoding network E and extract features H; Step 102: Train a cosine similarity-based classifier F cls ; ) Where Cos is the cosine similarity function; The learnable classifier weights are for all base categories; It is a learnable scalar parameter; Step 103: Map the raw data into features through a feature encoding network, and then pass it through a classifier F. cls Output the prediction results in the entire base category dataset D. b The difference between the predicted and true values ​​is calculated using the negative marginal cosine softmax loss function, and the parameters of the feature encoding network and classifier are updated in reverse to train the network recognition model.

[0009] Preferably, in step 103, in the dataset D of all basic categories b Using negative marginal cosine softmax loss function L neg The network recognition model is trained according to the following formula:

[0010] Where N is the total dataset of all basic categories D b The number of categories; exp is an exponential function; Let t be the indicator function, and y be the index of the base category and y be the index of the target category. When t = y, The value is 1; m represents the marginal value of the scalar. and These are the learnable classifier weight parameters for the t-th base category and the learnable classifier weight parameters for the target category, respectively.

[0011] Preferably, step S2 includes the following steps: Step 201: Initialize the feature encoding network in the network recognition model using the network parameters pre-trained in step S1; Step 202: Initialize the cosine similarity-based classifier in the network recognition model with the pre-trained network parameters; Step 203: Calculate the class center of the new category based on the features extracted from the network recognition model after initialization in steps S201 and S202; Step 204: Define the class center of the new category as the weight of the new classifier; Step 205: Initialize the new classifier with the new classifier weights, and add the initialized new classifier to the network recognition model to form a few-sample network recognition model.

[0012] Preferably, step S203 specifically includes: Suppose that in the classic few-shot learning task C-way K-shot, T={ , The training set for the nth few-sample task. If |i=1,...,C;k=1,...,K}, then the class center of the i-th new category is... The calculation is as follows: ; in, T represents a complete C-way K-shot small sample task; This is the test set for the nth small sample task; n is the independent C-way K-shot small sample task number; The original data for the k-th sample in the i-th new category in the n-th small sample task of the feature encoding network E; Let k be the data label of the kth sample in the ith new category in the nth few-sample task of the feature encoding network E; C is the number of classes in a small sample task; K is the total number of samples in each new category; These are the parameters of the feature encoding network E.

[0013] Preferably, step S203 further includes the following steps: Step 2031: Calculate the test set The class center of the middle sample x and the i-th new category Similarity score ; Step 2032: Based on the similarity score, from the test set The top Z samples from each class are selected, denoted as Z. ; Step 2033: Use For the training set Enhance the training set to obtain the enhanced training set. , = U { ; Step 2034: Calculate the class center of the enhanced i-th new category. for:

[0014]

[0015] in, These are intermediate learnable weight parameters; ; Z is a preset threshold for the number of samples; j is the j-th sample of the i-th category in the n-th task.

[0016] Preferably, step S204 specifically includes: Step 2041: Defining the class center of the enhanced new category as the new classifier weight: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

[0017] Preferably, in step S204, the weights of the new classifier are... The following formula is used for calculation: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

[0018] Preferably, step S3 includes the following steps: Step 301: Utilize classifier weights Calculate the similarity between the new category sample and all base category samples, where j refers to the j-th sample of the i-th category in the n-th task. , These represent the learnable weight parameters for the i-th class in the n-th task and the learnable weight parameters for the j-th class in the n-th task, respectively. Step 302: Sort all basic categories according to similarity and determine the top... l Each is a neighboring basic category , l To define the neighboring base categories of the i-th new category as a preset threshold number, we define the neighboring base categories as... : ; in, They are adjacent basic categories Sample data and labels of class o; Class o; Based on the nearest basic category; Step 303: Based on the nearest base class and the new class, use the nearest neighbor Mixup method to interpolate the hidden states and generate feature-level samples. : ; ; ; in The mixing coefficient, ,in This is the training set for the nth few-sample task; The data samples and labels are in the feature-level samples; e and y are intermediate variables; Among them, the loss function for generating feature-level samples for:

[0019] in, It is a cosine similarity-based classifier that uses the class centers of the basic categories. and the class center of the new category Perform parameterization.

[0020] Preferably, in step S5, the few-shot image is identified by using the pre-trained network recognition model and the optimized few-shot network recognition model according to the following formula:

[0021] in and These are the recognition results of the network recognition model and the optimized few-shot network recognition model, respectively. It is the balancing weight coefficient.

[0022] Compared with the prior art, the present invention has the following beneficial effects: This invention innovatively proposes a neighbor mixup approach, which uses class samples as neighboring classes and performs sample interpolation through neighbor mixup. Mixup is used to enhance small samples between the new class and neighboring base class samples to calibrate feature representations, thereby generating an optimized model. This invention provides a novel small sample recognition method. Compared with existing technologies, this invention enhances samples through different means to achieve recognition, providing another technical solution that achieves the same technical effect as existing technologies. Attached Figure Description

[0023] Figure 1 This is a flowchart of a small sample recognition method based on nearest neighbor Mixup feature calibration according to an embodiment of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. The described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] like Figure 1 As shown, this invention provides a few-sample recognition method based on nearest-neighbor Mixup feature calibration, comprising the following steps: Step S1: Pre-train a network recognition model using images from all basic categories. This network recognition model includes a feature encoding network and a cosine similarity-based classifier F. cls ; Step S2: Based on the network recognition model, add a new classifier for the few-shot task of the new category to be recognized, forming a few-shot network recognition model; Step S3: Perform feature calibration on the few-shot network recognition model through nearest neighbor Mixup to obtain the calibrated few-shot network recognition model; wherein, nearest neighbor Mixup specifically involves interpolation between samples of the new class and samples of the neighboring base class, using local constraints beyond the manifold in which the new sample is located, and achieving local non-manifold regularization on the new class; Step S4: Perform global target optimization on the calibrated few-shot network recognition model to obtain the optimized few-shot network recognition model; Step S5: Use the pre-trained network recognition model and the optimized few-shot network recognition model to identify the few-shot category to which the few-shot image belongs.

[0026] In a specific embodiment of the present invention, step S01 specifically includes the following steps: Step 101: Train the feature encoding network E and extract features H; Step 102: Train a cosine similarity-based classifier F cls ; ) Where Cos is the cosine similarity function; The learnable classifier weights are for all base categories; It is a learnable scalar parameter; Step 103: Map the raw data into features through a feature encoding network, and then pass it through a classifier F. cls Output the prediction results in the entire base category dataset D. b The difference between the predicted and true values ​​is calculated using the negative marginal cosine softmax loss function, and the parameters of the feature encoding network and classifier are updated in reverse to train the network recognition model.

[0027] In one specific embodiment of the present invention, in step 103, in the complete basic category dataset D... b Using negative marginal cosine softmax loss function L neg The network recognition model is trained according to the following formula:

[0028] Where N is the total dataset of all basic categories D b The number of categories; exp is an exponential function; Let t be the indicator function, and y be the index of the base category and y be the index of the target category. When t = y, The value is 1; m represents the marginal value of the scalar. and These are the learnable classifier weight parameters for the t-th base category and the learnable classifier weight parameters for the target category, respectively.

[0029] In one specific embodiment of the present invention, step S2 includes the following steps: Step 201: Initialize the feature encoding network in the network recognition model using the network parameters pre-trained in step S1; Step 202: Initialize the cosine similarity-based classifier in the network recognition model with the pre-trained network parameters; Step 203: Calculate the class center of the new category based on the features extracted from the network recognition model after initialization in steps S201 and S202; Step 204: Define the class center of the new category as the weight of the new classifier; Step 205: Initialize the new classifier with the new classifier weights, and add the initialized new classifier to the network recognition model to form a few-sample network recognition model.

[0030] Steps 201 and 202 are preparations for extracting features from the original data, and the calculation of class centers in step S203 is performed at the feature level.

[0031] In a specific embodiment of the present invention, step S203 specifically includes: Suppose that in the classic few-shot learning task C-way K-shot, T={ , The training set for the nth few-sample task. If |i=1,...,C;k=1,...,K}, then the class center of the i-th new category is... The calculation is as follows: ; in, T represents a complete C-way K-shot small sample task; This is the test set for the nth small sample task; n is the independent C-way K-shot small sample task number; The original data for the k-th sample in the i-th new category in the n-th small sample task of the feature encoding network E; Let k be the data label of the kth sample in the ith new category in the nth few-sample task of the feature encoding network E; C is the number of classes in a small sample task; K is the total number of samples in each new category; These are the parameters of the feature encoding network E.

[0032] E is the feature encoding network, and different networks can be used in specific operations. In a specific embodiment of the present invention, ResNet12 is used.

[0033] In one specific embodiment of the present invention, step S203 further includes the following steps: Step 2031: Calculate the test set The class center of the middle sample x and the i-th new category Similarity score ; Step 2032: Based on the similarity score, from the test set The top Z samples from each class are selected, denoted as Z. ; Step 2033: Use For the training set Enhance the training set to obtain the enhanced training set. , = U { ; Step 2034: Calculate the class center of the enhanced i-th new category. for:

[0034]

[0035] in, These are intermediate learnable weight parameters; ; Z is a preset threshold for the number of samples; j is the j-th sample of the i-th category in the n-th task.

[0036] In a specific embodiment of the present invention, step S204 specifically comprises: Step 2041: Defining the class center of the enhanced new category as the new classifier weight: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

[0037] In a specific embodiment of the present invention, in step S204, the new classifier weights... The following formula is used for calculation: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

[0038] In a specific embodiment of the present invention, step S3 includes the following steps: Step 301: Utilize classifier weights Calculate the similarity between the new category sample and all base category samples, where j refers to the j-th sample of the i-th category in the n-th task. , These represent the learnable weight parameters for the i-th class in the n-th task and the learnable weight parameters for the j-th class in the n-th task, respectively. Step 302: Sort all basic categories according to similarity and determine the top... l Each is a neighboring basic category , l To define the neighboring base categories of the i-th new category as a preset threshold number, we define the neighboring base categories as... : ; in, They are adjacent basic categories Sample data and labels of class o; Class o; Based on the nearest basic category; Step 303: Based on the nearest base class and the new class, use the nearest neighbor Mixup method to interpolate the hidden states and generate feature-level samples. : ; ; ; in , is the mixing coefficient. ,in This is the training set for the nth few-sample task; The data samples and labels are in the feature-level samples; e and y are intermediate variables; Among them, the loss function for generating feature-level samples for:

[0039] in, It is a cosine similarity-based classifier that uses the class centers of the basic categories. and the class center of the new category Perform parameterization.

[0040] In a specific embodiment of the present invention, step S5 involves using the pre-trained network recognition model and the optimized few-shot network recognition model to identify the few-shot category p to which the few-shot image belongs using the following formula:

[0041] in and These are the recognition results of the network recognition model and the optimized few-shot network recognition model, respectively. It is the balancing weight coefficient.

[0042] Example 1 This invention provides a few-sample recognition method based on nearest-neighbor Mixup feature calibration, comprising the following steps: Step S1: Pre-train a network recognition model using images from all basic categories. This network recognition model includes a feature encoding network and a cosine similarity-based classifier F. cls ; Step S2: Based on the network recognition model, add a new classifier for the few-shot task of the new category to be recognized, forming a few-shot network recognition model; Step S3: Perform feature calibration on the few-shot network recognition model using nearest neighbor Mixup to obtain the calibrated few-shot network recognition model; wherein, nearest neighbor Mixup specifically involves interpolating between samples of the new class and samples of the neighboring basic class to achieve local nonmanifold regularization on the new class; Step S4: Perform global target optimization on the calibrated few-shot network recognition model to obtain the optimized few-shot network recognition model; Step S5: Use the pre-trained network recognition model and the optimized few-shot network recognition model to identify the few-shot category to which the few-shot image belongs.

[0043] In this embodiment, step S01 specifically includes the following steps: Step 101: Train the feature encoding network E and extract features H; Step 102: Train a cosine similarity-based classifier F cls ; ) Where Cos is the cosine similarity function; The learnable classifier weights are for all base categories; It is a learnable scalar parameter; Step 103: Map the raw data into features through a feature encoding network, and then pass it through a classifier F. cls Output the prediction results in the entire base category dataset D. b The difference between the predicted and true values ​​is calculated using the negative marginal cosine softmax loss function, and the parameters of the feature encoding network and classifier are updated in reverse to train the network recognition model.

[0044] In this embodiment, in step 103, in the complete basic category dataset D... b Using negative marginal cosine softmax loss function L neg The network recognition model is trained according to the following formula:

[0045] Where N is the total dataset of all basic categories D b The number of categories; exp is an exponential function; Let t be the indicator function, and y be the index of the base category and y be the index of the target category. When t = y, The value is 1; m represents the marginal value of the scalar. and These are the learnable classifier weight parameters for the t-th base category and the learnable classifier weight parameters for the target category, respectively.

[0046] The predicted value is the predicted label for the target category, while the true value is the actual label for the target category.

[0047] During the training phase of the network model, the target category refers to the validation set; during the actual recognition phase (inference phase), the target category refers to the new category.

[0048] In this embodiment, step S2 includes the following steps: Step 201: Initialize the feature encoding network in the network recognition model using the network parameters pre-trained in step S1; Step 202: Initialize the cosine similarity-based classifier in the network recognition model with the pre-trained network parameters; Step 203: Calculate the class center of the new category based on the features extracted from the network recognition model after initialization in steps S201 and S202; Step 204: Define the class center of the new category as the weight of the new classifier; Step 205: Initialize the new classifier with the new classifier weights, and add the initialized new classifier to the network recognition model to form a few-sample network recognition model.

[0049] In this embodiment, step S203 specifically includes: Suppose that in the classic few-shot learning task C-way K-shot, T={ , The training set for the nth few-sample task. If |i=1,...,C;k=1,...,K}, then the class center of the i-th new category is... The calculation is as follows: ; in, T represents a complete C-way K-shot small sample task; This is the test set for the nth small sample task; n is the independent C-way K-shot small sample task number; The original data for the k-th sample in the i-th new category in the n-th small sample task of the feature encoding network E; Let k be the data label of the kth sample in the ith new category in the nth few-sample task of the feature encoding network E; C is the number of classes in a small sample task; K is the total number of samples in each new category; These are the parameters of the feature encoding network E.

[0050] In this embodiment, step S203 further includes the following steps: Step 2031: Calculate the test set The class center of the middle sample x and the i-th new category Similarity score ; Step 2032: Based on the similarity score, from the test set The top Z samples from each class are selected, denoted as Z. ; Step 2033: Use For the training set Enhance the training set to obtain the enhanced training set. , = U { ; Step 2034: Calculate the class center of the enhanced i-th new category. for:

[0051]

[0052] in, These are intermediate learnable weight parameters; ; Z is a preset threshold for the number of samples; j is the j-th sample of the i-th category in the n-th task.

[0053] In this embodiment, step S204 specifically includes: Step 2041: Defining the class center of the enhanced new category as the new classifier weight: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

[0054] In this embodiment, step S3 includes the following steps: Step 301: Utilize classifier weights Calculate the similarity between the new category sample and all base category samples, where j refers to the j-th sample of the i-th category in the n-th task. , These represent the learnable weight parameters for the i-th class in the n-th task and the learnable weight parameters for the j-th class in the n-th task, respectively. Step 302: Sort all basic categories according to similarity and determine the top... l Each is a neighboring basic category , l To define the neighboring base categories of the i-th new category as a preset threshold number, we define the neighboring base categories as... : ; in, They are adjacent basic categories Sample data and labels of class o; Class o; Based on the nearest basic category; Step 303: Based on the nearest base class and the new class, use the nearest neighbor Mixup method to interpolate the hidden states and generate feature-level samples. : ; ; ; in , is the mixing coefficient. ,in This is the training set for the nth few-sample task; The data samples and labels are in the feature-level samples; e and y are intermediate variables; Among them, the loss function for generating feature-level samples for:

[0055] in, It is a cosine similarity-based classifier that uses the class centers of the basic categories. and the class center of the new category Perform parameterization.

[0056] In this embodiment, step S5 involves using the pre-trained network recognition model and the optimized few-shot network recognition model to identify the few-shot category p to which the few-shot image belongs using the following formula:

[0057] in and These are the recognition results of the network recognition model and the optimized few-shot network recognition model, respectively. It is the balancing weight coefficient.

[0058] Example 2 Unlike Example 1, this example is performed on the CIFAR-FS and FC100 training sets, as detailed below: (1) ResNet12

[13] is used as the feature encoding network. ResNet12 consists of 4 residual blocks, each block contains 3 convolutional layers, each convolutional layer has a kernel size of 3×3, and a 2×2 max pooling layer. The number of filters is set to (64, 160, 320, 640).

[0059] (2) During the pre-training phase, an SGD optimizer with momentum of 0.9 and batch size of 1024 was used. The learning rate started at 0.1 with a decay factor of 0.1. On the CIFAR-FS and FC100 training sets, training was conducted for 140 epochs, with the learning rate starting to decay at the 120th epoch and the weight decay rate being 0.0005.

[0060] (3) In the calibration phase of step S3, a batch of images is extracted from the base classes. If the number of neighboring base class samples in the batch is not less than 3, then all samples and the generated neighboring samples are processed by global objective optimization with α = 0.1 and λ = 0.05. The first 10 samples (i.e., Z = 10) are used to obtain improved class sample data. A stochastic gradient descent optimizer with momentum of 0.9 is also used and trained for 1 epoch with a batch size of 256. The learning rate is fixed at 0.01 on the CIFAR-FS and FC100 training sets.

[0061] (4) Evaluation metrics: Results are reported as the average accuracy ± 95% confidence interval for the sampled tasks. Each task contains C = 5 classes, with K ∈ {1, 5, 10} examples for each class in the support set and 15 examples in the test set.

[0062] This invention is compared with the following two methods for setting classifier weights: Inductive baseline methods, denoted as IN-baseline, use To initialize a new classifier.

[0063] Transduction (transfer) baseline methods, denoted as TR-baseline, are... The value is used as the initial value to initialize the new classifier.

[0064] Table 1. Mean accuracy (%) ± 95% confidence interval (%) on CIFAR-FS and FC100 training sets using both inductive and transductive methods.

[0065] The difference between this invention and TR-baseline is that a new neighbor-mixup-enhanced feature classifier is added on top of the basic classifier. This invention is a basic classifier + a new classifier.

[0066] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A few-sample recognition method based on nearest-neighbor Mixup feature calibration, characterized in that, Includes the following steps: Step S1: Pre-train a network recognition model using images from all basic categories. This network recognition model includes a feature encoding network and a cosine similarity-based classifier F. cls ; Step S2: Based on the network recognition model, add a new classifier for the few-shot task of the new category to be recognized, forming a few-shot network recognition model; Step S3: Perform feature calibration on the few-shot network recognition model using nearest neighbor Mixup to obtain the calibrated few-shot network recognition model; wherein, nearest neighbor Mixup specifically involves interpolating between samples of the new class and samples of the neighboring basic class to achieve local nonmanifold regularization on the new class; Step S4: Perform global target optimization on the calibrated few-shot network recognition model to obtain the optimized few-shot network recognition model; Step S5: Use the pre-trained network recognition model and the optimized few-shot network recognition model to identify the target category of the few-shot image to be recognized.

2. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 1, characterized in that, Step S01 specifically includes the following steps: Step 101: Train the feature encoding network E and extract features H; Step 102: Train a cosine similarity-based classifier F cls ; ) Where Cos is the cosine similarity function; The learnable classifier weights are for all base categories; It is a learnable scalar parameter; Step 103: Map the raw data into features through a feature encoding network, and then pass it through a classifier F. cls Output the prediction result of the target category in the dataset D of all base categories. b The difference between the predicted and true values ​​of the target category is calculated using the negative marginal cosine softmax loss function. This is then used to update the parameters of the feature encoding network and the classifier, thereby training the network recognition model.

3. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 2, characterized in that, In step 103, in the dataset D of all basic categories b Using negative marginal cosine softmax loss function L neg The network recognition model is trained according to the following formula: Where N is the total dataset of all basic categories D b The number of categories; exp is an exponential function; Let t be the indicator function, and y be the index of the base category and y be the index of the target category. When t = y, The value is 1; m represents the marginal value of the scalar. and These are the learnable classifier weight parameters for the t-th base category and the learnable classifier weight parameters for the target category, respectively.

4. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 2, characterized in that, Step S2 includes the following steps: Step 201: Initialize the feature encoding network in the network recognition model using the network parameters pre-trained in step S1; Step 202: Initialize the cosine similarity-based classifier in the network recognition model with the pre-trained network parameters; Step 203: Calculate the class center of the new category based on the features extracted from the network recognition model after initialization in steps S201 and S202; Step 204: Define the class center of the new category as the weight of the new classifier; Step 205: Initialize the new classifier with the new classifier weights, and add the initialized new classifier to the network recognition model to form a few-sample network recognition model.

5. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 4, characterized in that, Step S203 specifically includes: Suppose that in the classic few-shot learning task C-way K-shot, T={ , The training set for the nth few-sample task If |i=1,...,C;k=1,...,K}, then the class center of the i-th new category is... The calculation is as follows: ; in, T represents a complete C-way K-shot small sample task; This is the test set for the nth small sample task; n is the independent C-way K-shot small sample task number; The original data for the k-th sample in the i-th new category in the n-th small sample task of the feature encoding network E; Let k be the data label of the kth sample in the ith new category in the nth few-sample task of the feature encoding network E; C is the number of classes in a small sample task; K is the total number of samples in each new category; These are the parameters of the feature encoding network E.

6. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 5, characterized in that, Step S203 also includes the following steps: Step 2031: Calculate the test set The class center of the middle sample x and the i-th new category Similarity score ; Step 2032: Based on the similarity score, from the test set The top Z samples from each class are selected, denoted as Z. ; Step 2033: Use For the training set Enhance the training set to obtain the enhanced training set. , = U { ; Step 2034: Calculate the class center of the enhanced i-th new category. for: in, These are intermediate learnable weight parameters; ; Z is a preset threshold for the number of samples; j is the j-th sample of the i-th category in the n-th task.

7. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 6, characterized in that, Step S204 specifically includes: Step 2041: Defining the class center of the enhanced new category as the new classifier weight: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

8. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 5, characterized in that, In step S204, the weights of the new classifier The following formula is used for calculation: ; in, The learnable weight parameters are for the classifier of class i in the nth few-sample task.

9. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 2, characterized in that, Step S3 includes the following steps: Step 301: Utilize classifier weights Calculate the similarity between the new category sample and all base category samples, where j refers to the j-th sample of the i-th category in the n-th task. , These represent the learnable weight parameters for the i-th class in the n-th task and the learnable weight parameters for the j-th class in the n-th task, respectively. Step 302: Sort all basic categories according to similarity and determine the top... l Each is a neighboring basic category , l To define the neighboring base categories of the i-th new category as a preset threshold number, we define the neighboring base categories as... : ; in, They are adjacent basic categories Sample data and labels of class o; Class o; Based on the nearest basic category; Step 303: Based on the nearest base class and the new class, use the nearest neighbor Mixup method to interpolate the hidden states and generate feature-level samples. : ; ; ; in , is the mixing coefficient. ,in This is the training set for the nth few-sample task; The data samples and labels in the feature-level samples; e and y are intermediate variables; Among them, the loss function for generating feature-level samples for: in, It is a classifier based on cosine similarity, using the class centers of the basic categories. and the class center of the new category Perform parameterization.

10. The few-sample recognition method based on nearest-neighbor Mixup feature calibration according to claim 1, characterized in that, Step S5: Using the pre-trained network recognition model and the optimized few-shot network recognition model, identify the few-shot category p to which the few-shot image belongs using the following formula: in and These are the recognition results of the network recognition model and the optimized few-shot network recognition model, respectively. It is the balancing weight coefficient.

Citation Information

Patent Citations

  • Hyperspectral image classification method based on M-Hybrid SN-Attention

    CN114187469A

  • Small sample point cloud semantic segmentation method, network, storage medium and processor

    CN118115730A

  • Garbage identification and classification method

    CN119229194A

  • Small sample plankton image enhancement recognition method and small sample plankton image model building method

    CN119992223A