A small sample target recognition method and system based on a spatial metric prototype network
By constructing category space prototypes and augmented space prototypes, the problems of overfitting and insufficient robustness in target recognition of small samples in remote sensing images are solved, achieving high accuracy and stable target recognition, and adapting to the application needs of complex remote sensing scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI AEROSPACE COMP TECH INST
- Filing Date
- 2026-03-24
- Publication Date
- 2026-07-14
AI Technical Summary
Remote sensing image target recognition is prone to overfitting under small sample conditions, and its generalization ability and robustness to new categories are insufficient, making it difficult to achieve high accuracy and stability in complex remote sensing scenarios.
A few-sample target recognition method based on spatial metric prototype network is adopted. By constructing a category spatial prototype and combining orientation weighting and projection reconstruction to generate a category-enhanced spatial prototype, the query features are projected and the projection error is calculated. Task-based meta-learning is used to iteratively optimize the model parameters and enhance the inter-class discrimination ability.
Maintaining high accuracy and stability under limited annotation conditions, it can quickly adapt to new types of tasks, improve the practicality and deployment efficiency of remote sensing intelligent interpretation, and meet the needs of reconnaissance, surveillance and emergency missions.
Smart Images

Figure CN122391904A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of small sample target recognition technology in remote sensing images, and in particular to a small sample target recognition method and system based on a spatial metric prototype network. Background Technology
[0002] Remote sensing imagery is widely used in reconnaissance and surveillance of ground equipment targets, situational assessment, and emergency response missions due to its advantages such as wide coverage and high acquisition efficiency. With the improvement of imaging resolution and data acquisition capabilities, the texture, outline, and contextual relationships of targets in remote sensing images are clearer, which can be used to distinguish targets with similar appearances to a certain extent.
[0003] However, remote sensing target recognition often faces the contradiction of scarce samples and variable data distribution in practical tasks. On the one hand, due to factors such as acquisition costs, annotation difficulties, and low target occurrence frequency, it is difficult to obtain large-scale, balanced, and high-quality labeled data. On the other hand, changes in the viewpoint and scale of targets in remote sensing images, occlusion shadows, sensor differences, imaging noise, and complex backgrounds increase intra-class differences and weaken inter-class differences, making existing models more prone to overfitting under small sample conditions and exhibiting unstable generalization performance for new regions, new imaging, or new class conditions. Even with the introduction of a few-sample recognition approach centered on similarity measurement, class confusion often occurs in complex remote sensing scenarios due to insufficient robustness of class representation, sensitivity of the measurement to noise and background, and insufficient utilization of intra-class structural information, making it difficult to simultaneously achieve both accuracy and robustness. Summary of the Invention
[0004] The purpose of this invention is to address the aforementioned technical problems in applications involving small-sample remote sensing targets. It proposes a method and system for small-sample target recognition based on a spatial metric prototype network. Even with limited labeled samples, this method maintains high target recognition accuracy and stability. Furthermore, it enables effective identification and reliable discrimination of new target categories under conditions of rapid category changes and complex imaging conditions. This improves the practicality and deployment efficiency of intelligent remote sensing interpretation, meeting the application requirements of reconnaissance, surveillance, and emergency response missions for small sample sizes, high generalization, and high robustness. The objective of this invention can be achieved through the following technical solutions: This invention provides a few-sample target recognition method based on a spatial metric prototype network, comprising: Step S1: Receive the remote sensing image dataset to be processed, and divide the remote sensing image dataset into training set, validation set and test set according to the category dimension; wherein, the remote sensing image dataset contains target samples of multiple categories; Step S2: Based on the training set categories, task-based meta-learning is used in the few-shot target recognition model to repeatedly sample from the training set to construct multiple few-shot classification tasks. Each few-shot classification task includes a support set and a query set. Each few-shot classification task is input into the feature extraction network to generate corresponding feature vectors. Feature vectors are then translated and scaled to obtain normalized feature vectors. Singular value decomposition is performed on the normalized support class feature vectors to obtain planar class space prototypes. Orientation weighting and projection reconstruction are performed on the class space prototypes to generate class augmentation space prototypes. The normalized query feature vectors are projected onto each class augmentation space prototype to calculate the projection error, and the projection error is used as a metric function for training the few-shot target recognition model. Step S3: During the training phase of the few-shot target recognition model, the class samples that did not participate in the training task are predicted using the validation set, and the trainable weights and adjustable hyperparameters inside the network are adjusted according to the prediction results; after training is completed, the new class samples are predicted using the test set, and the classification accuracy of the few-shot target recognition model on the new class samples is evaluated according to the degree of matching between the predicted class and the real class label. Step S4: Input the query image to be identified into the small sample target recognition model after the classification accuracy reaches the preset threshold, and output the target category of the query image.
[0005] Furthermore, the validation set and training set adopt the same task construction method as the training set in the training phase. The task construction method is task-based meta-learning, which iteratively updates the model parameters on a small sample classification task with multiple samplings, on a task-by-task basis.
[0006] Further, in step S2, based on the training set categories, in the few-shot target recognition model, task-based meta-learning is used to repeatedly sample from the training set to construct multiple few-shot classification tasks, including; Step S21: Randomly select N categories from the training set to form a category subset for the training task; randomly extract K samples from each category in the category subset to form a support set; randomly select one category from the category subset and extract Q samples from the category to form a query set; combine the generated support set and query set to form a complete small sample classification task. Step S22: Repeat step S21 to construct a small sample classification task set, and iteratively update the model parameters according to the task during the training phase to achieve task meta-learning.
[0007] Further, in step S2, the feature extraction network adopts a ResNet18 network and removes the fully connected classification layer at the end to extract convolutional features from the remote sensing image. The feature extraction network includes an input convolutional layer, four residual module groups, and a global average pooling layer. Each residual module group contains two residual blocks, and each residual block consists of two 3×3 convolutional layers. The residual block input is added element-wise to the output of the second 3×3 convolutional layer through an identity shortcut connection to obtain the feature map of the residual block output. The final output feature map of the residual module group is processed by the global average pooling layer to obtain the feature vector.
[0008] Further, in step S2, the feature vector is subjected to feature translation and scaling to obtain a normalized feature vector, including: Using the feature channels as indexes, calculate the median of the feature vectors of the query set and support set samples in each channel, and then shift the feature values of each channel based on the median to make the median of each channel zero. Calculate the average Euclidean distance from the decentralized feature vector to the zero center, and scale the feature vector by the average Euclidean distance. Apply a preset feature size constraint to the scaled feature vector to obtain the normalized support set category feature vector and query category feature vector, which are used for the calculation of the category space prototype and the category augmentation space prototype. The feature vectors of the query set and support set samples are decentralized using the median indexed by the feature channels. The feature vectors are then scaled using the average Euclidean distance from the decentralized feature vectors to the origin. After setting feature size constraints, normalized feature vectors are obtained, which include support class feature vectors and query feature vectors.
[0009] Further, in step S2, singular value decomposition is performed on the normalized support class feature vectors to obtain the class space prototype of the planar structure, including: Perform singular value decomposition on the support class feature vectors to generate a left singular matrix, a right singular matrix, and a singular value matrix; The singular values are arranged in descending order based on the diagonal elements of the singular value matrix, and the corresponding first R columns of left singular vectors are selected. The first R columns of left singular vectors represent the main directions of the category in the feature space. These vectors are combined to form the category space prototype, where the diagonal elements are the corresponding singular values.
[0010] Further, in step S2, direction-weighted and projection reconstruction is performed on the category space prototype to generate a category-enhanced space prototype, including: The singular values of the class space prototype are converted into weights using the softmax function, and the feature vectors of the class space prototype are weighted and summed according to the weights to generate a class prototype subspace, which serves as the main directional contribution of the class. A projection operator is constructed using the first R eigenvectors of the right singular matrix to project the support class eigenvectors onto the class space prototype, thus obtaining the class covariance matrix. The category covariance matrix is projected onto the category prototype subspace to obtain the corresponding category projection covariance matrix and eigenvalue decomposition is performed. Based on the eigenvalues arranged in descending order, the eigenvectors corresponding to the first r eigenvalues are selected and restored in the category space prototype to generate the category augmentation space prototype.
[0011] Further, in step S2, the normalized query feature vector is projected onto the prototype of each category augmentation space to calculate the projection error, and the projection error is used as a metric function for training the few-sample target recognition model, including: The query feature vectors are projected onto the prototypes of each category augmentation space to obtain the projected feature vectors in each category subspace. The difference between the query feature vector and the projected feature vectors of each category is calculated to obtain the projection error vector. The corresponding L2 norm is calculated as the projection error of each category. The category with the largest -L2 norm is selected as the category to which the query sample belongs. The projection error of all query samples is used as a metric function and input into the few-sample target recognition model to train the model parameters.
[0012] Furthermore, step S2 also includes calculating the inner product matrix between class space prototypes and accumulating the sum of squared inner products of all class space prototypes to obtain an orthogonal loss, which is used to constrain the mutual orthogonality of class space prototypes.
[0013] Based on the same inventive concept, this invention provides a few-sample target recognition system based on a spatial metric prototype network, employing the aforementioned few-sample target recognition method based on a spatial metric prototype network, including: The data partitioning module receives the remote sensing image dataset to be processed and divides it into training, validation, and test sets according to the category dimension; the remote sensing image dataset contains target samples of multiple categories. The model generation module is used to construct multiple small-sample classification tasks from the training set based on the training set categories using task-oriented meta-learning. Each small-sample classification task includes a support set and a query set. Each small-sample classification task is input into the feature extraction network to generate corresponding feature vectors. The feature vectors are then translated and scaled to obtain normalized feature vectors. Singular value decomposition is performed on the normalized support class feature vectors to obtain planar class space prototypes. The class space prototypes are then reconstructed by orientation weighting and projection to generate class augmentation space prototypes. The normalized query feature vectors are projected onto each class augmentation space prototype to calculate the projection error, which is used as a metric function for training the small-sample target recognition model. During the training phase of the small-sample target recognition model, the model predicts class samples that did not participate in the training tasks using the validation set, and adjusts the trainable weights and adjustable hyperparameters within the network based on the prediction results. After training, the model predicts new class samples using the test set, and evaluates the classification accuracy of the small-sample target model on new class samples based on the matching degree between the predicted class and the true class label. The target recognition module is used to input the query image to be recognized into a small sample target recognition model that outputs the target category of the query image after the classification accuracy reaches a preset threshold.
[0014] Compared with the prior art, the present invention has at least one of the following technical advantages: This invention constructs a high-dimensional category space prototype that represents the main directions of a category in the feature space. Based on this, it generates a category-enhanced space prototype using direction weighting and projection reconstruction. This enables the projection and error measurement of query samples into each category subspace, thereby fully exploring the discriminative representation of highly similar samples at the inter-class decision boundary under limited sample conditions. Simultaneously, orthogonal loss constrains the mutual orthogonality of the category space prototypes, enhancing inter-class discrimination capabilities. Furthermore, this application enables small-sample target recognition models to quickly adapt to new category tasks in remote sensing images with complex background interference and feature distributions, achieving high accuracy and robustness in target recognition. This improves the practicality and deployment efficiency of remote sensing intelligent interpretation, meeting the application requirements of reconnaissance, surveillance, situation analysis, and emergency response missions for small sample sizes and high generalization. Attached Figure Description
[0015] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a flowchart illustrating the steps of the small sample target recognition method based on a spatial metric prototype network according to the present invention. Figure 2 This is a schematic diagram of the task-based meta-learning task partitioning method in an embodiment of the present invention; Figure 3 This is a diagram of the feature extraction network structure in an embodiment of the present invention; Figure 4 This is a schematic diagram of the small sample target recognition model in an embodiment of the present invention; Figure 5 The following describes the actual recognition performance of the small-sample target recognition method in this embodiment of the invention on different remote sensing target datasets. Figure 5 Image (a) in the image shows the identification results of the ship dataset. Figure 5 (b) in the image shows the recognition results of the MAR20 aircraft dataset; Figure 6 To illustrate the embedding space visualization comparison of the small-sample target recognition method of this invention on a ship dataset, wherein, Figure 6 (a) in the figure represents the t-SNE test results of the benchmark network ProtoNet; Figure 6 (b) shows the t-SNE test results of the small sample target recognition model of the present invention. Detailed Implementation
[0016] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the disclosure to those skilled in the art. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0017] First Embodiment In the field of target recognition in remote sensing images with few samples, existing methods are prone to overfitting under small sample conditions due to high annotation costs, limited sample numbers, and factors such as the target's viewpoint, scale, occlusion, and complex background. Furthermore, they lack sufficient generalization ability and robustness for new categories. Although existing technologies utilize deep feature extraction networks and prototype networks for few-sample classification, they still have limitations in terms of robustness of category representation and inter-class discriminative ability.
[0018] To address the aforementioned issues, this application proposes a few-shot target recognition method based on a spatial metric prototype network. This method constructs a category spatial prototype and generates a category-enhanced spatial prototype by combining orientation weighting and projection reconstruction. Projection and projection error calculations are performed on query features to train the few-shot recognition model. Simultaneously, orthogonal loss constrains the mutual orthogonality of the category spatial prototypes, enhancing inter-class discriminability. Task-based meta-learning iteratively optimizes model parameters, enabling the few-shot recognition model to maintain high accuracy and stability under limited annotation conditions, quickly adapt to new category tasks, and exhibit strong robustness to complex backgrounds and noise interference, meeting the application requirements of remote sensing image reconnaissance, situational assessment, and emergency response. Specific implementation details are as follows: like Figure 1 As shown, this invention provides a few-sample target recognition method based on a spatial metric prototype network, including: Step S1: Receive the remote sensing image dataset to be processed, and divide the remote sensing image dataset into training set, validation set and test set according to the category dimension; wherein, the remote sensing image dataset contains target samples of multiple categories; Step S2: Based on the training set categories, task-based meta-learning is used in the few-shot target recognition model to repeatedly sample from the training set to construct multiple few-shot classification tasks. Each few-shot classification task includes a support set and a query set. Each few-shot classification task is input into the feature extraction network to generate corresponding feature vectors. Feature vectors are then translated and scaled to obtain normalized feature vectors. Singular value decomposition is performed on the normalized support class feature vectors to obtain planar class space prototypes. Orientation weighting and projection reconstruction are performed on the class space prototypes to generate class augmentation space prototypes. The normalized query feature vectors are projected onto each class augmentation space prototype to calculate the projection error, and the projection error is used as a metric function for training the few-shot target recognition model. Step S3: During the training phase of the few-shot target recognition model, the class samples that did not participate in the training task are predicted using the validation set, and the trainable weights and adjustable hyperparameters inside the network are adjusted according to the prediction results; after training is completed, the new class samples are predicted using the test set, and the classification accuracy of the few-shot target recognition model on the new class samples is evaluated according to the degree of matching between the predicted class and the real class label. Step S4: Input the query image to be identified into the small sample target recognition model after the classification accuracy reaches the preset threshold, and output the target category of the query image.
[0019] It should be noted that the small sample target recognition model in this application is implemented using a spatial metric prototype network. By constructing a category space prototype and an enhanced space prototype, the projection error of the query sample is calculated, thereby achieving high-precision target recognition under the condition of limited labeled samples.
[0020] Furthermore, the validation set and training set adopt the same task construction method as the training set in the training phase. The task construction method is task-based meta-learning, which iteratively updates the model parameters on a small sample classification task with multiple samplings, on a task-by-task basis.
[0021] Specifically, such as Figure 2 As shown, this task-based meta-learning task partitioning method mainly divides the dataset into training set, validation set, and test set according to the category dimension. The category sets contained in the three sets do not overlap. During training, task-based sampling is used to repeatedly construct small-sample classification tasks. For each task, N categories are randomly selected from the meta-training categories to form an N-way, and K labeled samples are extracted from each category to form a support set. Then, several samples are extracted from the same group of N categories to form a query set. Within each task, the model uses the classifier formed by the support set to predict the query set and calculate the task loss. The model parameters are iteratively updated on a large number of sampling tasks with the task loss as the optimization objective. The validation set is used to select hyperparameters and perform early stopping in the same task construction manner. Finally, the model's recognition performance on unseen categories is evaluated on the test set in the same N-way K-shot task format.
[0022] Furthermore, in step S2, based on the training set categories, task-based meta-learning is used in the few-shot target recognition model to repeatedly sample from the training set to construct multiple few-shot classification tasks, including; Step S21: Randomly select N categories from the training set to form a category subset for the training task; randomly extract K samples from each category in the category subset to form a support set; randomly select one category from the category subset and extract Q samples from the category to form a query set; combine the generated support set and query set to form a complete small sample classification task. Step S22: Repeat step S21 to construct a small sample classification task set, and iteratively update the model parameters according to the task during the training phase to achieve task meta-learning.
[0023] Further, in step S2, the feature extraction network adopts a ResNet18 network and removes the fully connected classification layer at the end to extract convolutional features from the remote sensing image. The feature extraction network includes an input convolutional layer, four residual module groups, and a global average pooling layer. Each residual module group contains two residual blocks, and each residual block consists of two 3×3 convolutional layers. The residual block input is added element-wise to the output of the second 3×3 convolutional layer through an identity shortcut connection to obtain the feature map of the residual block output. The final output feature map of the residual module group is processed by the global average pooling layer to obtain the feature vector.
[0024] Specifically, such as Figure 3As shown, the feature extraction network structure is mainly a ResNet18 network with the fully connected classification layer at the end removed. The network structure from front to back is as follows: A 7×7 convolutional layer is used at the input for initial feature extraction, followed by batch normalization (BN) and ReLU activation. After downsampling via a 3×3 max pooling layer, the image enters four residual module groups: conv2_x, conv3_x, conv4_x, and conv5_x. The number of output channels for the four residual module groups are 64, 128, 256, and 512 respectively, and each stage contains two residual blocks. Eight residual blocks are constructed. Each residual block consists of two 3×3 convolutional layers. The first convolutional layer is followed by Batch Normalization (BN) and ReLU, and the second convolutional layer is followed by BN. The block input is element-wise added to the main branch output through a residual shortcut branch, and then ReLU is applied to obtain the block output. Downsampling is achieved in the first residual block of conv3_x, conv4_x, and conv5_x by setting the stride of the first 3×3 convolutional layer of the main branch to 2. At the same time, 1×1 convolutions are used for dimension matching in the shortcut branch. Finally, a global average pooling layer is applied after conv5_x to converge the spatial dimensions into a fixed-length feature vector.
[0025] Further, in step S2, the feature vector is subjected to feature translation and scaling to obtain a normalized feature vector, including: Using the feature channels as indexes, calculate the median of the feature vectors of the query set and support set samples in each channel, and then shift the feature values of each channel based on the median to make the median of each channel zero. Calculate the average Euclidean distance from the decentralized feature vector to the zero center, and scale the feature vector by the average Euclidean distance. Apply a preset feature size constraint to the scaled feature vector to obtain the normalized support set category feature vector and query category feature vector, which are used for the calculation of the category space prototype and the category augmentation space prototype. The feature vectors of the query set and support set samples are decentralized using the median indexed by the feature channels. The feature vectors are then scaled using the average Euclidean distance from the decentralized feature vectors to the origin. After setting feature size constraints, normalized feature vectors are obtained, which include support class feature vectors and query feature vectors.
[0026] Further, in step S2, singular value decomposition is performed on the normalized support class feature vectors to obtain the class space prototype of the planar structure, including: Perform singular value decomposition on the support class feature vectors to generate a left singular matrix, a right singular matrix, and a singular value matrix; The singular values are arranged in descending order based on the diagonal elements of the singular value matrix, and the corresponding first R columns of left singular vectors are selected. The first R columns of left singular vectors represent the main directions of the category in the feature space. These vectors are combined to form the category space prototype, where the diagonal elements are the corresponding singular values.
[0027] Further, in step S2, direction-weighted and projection reconstruction is performed on the category space prototype to generate a category-enhanced space prototype, including: The singular values of the class space prototype are converted into weights using the softmax function, and the feature vectors of the class space prototype are weighted and summed according to the weights to generate a class prototype subspace, which serves as the main directional contribution of the class. A projection operator is constructed using the first R eigenvectors of the right singular matrix to project the support class eigenvectors onto the class space prototype, thus obtaining the class covariance matrix. The category covariance matrix is projected onto the category prototype subspace to obtain the corresponding category projection covariance matrix and eigenvalue decomposition is performed. Based on the eigenvalues arranged in descending order, the eigenvectors corresponding to the first r eigenvalues are selected and restored in the category space prototype to generate the category augmentation space prototype.
[0028] Further, in step S2, the normalized query feature vector is projected onto the prototype of each category augmentation space to calculate the projection error, and the projection error is used as a metric function for training the few-sample target recognition model, including: The query feature vectors are projected onto the prototypes of each category augmentation space to obtain the projected feature vectors in each category subspace. The difference between the query feature vector and the projected feature vectors of each category is calculated to obtain the projection error vector. The corresponding L2 norm is calculated as the projection error of each category. The category with the largest -L2 norm is selected as the category to which the query sample belongs. The projection error of all query samples is used as a metric function and input into the few-sample target recognition model to train the model parameters.
[0029] Furthermore, step S2 also includes calculating the inner product matrix between class space prototypes and accumulating the sum of squared inner products of all class space prototypes to obtain an orthogonal loss, which is used to constrain the mutual orthogonality of class space prototypes.
[0030] Specifically, such as Figure 4 As shown, the feature channel C of the feature vector is used as the index pair. The samples are sorted, and the median value is selected to output a C-dimensional vector. Each element in this vector is the median of all samples in the corresponding feature channel, serving as a center estimate of the class. ; For the j-th feature vector of the i-th sample Perform element-wise centralization transformation: ; Centralized category feature vectors ,Will The reciprocal of the average Euclidean distance to the origin in the feature space. As a global scaling factor that reflects the average energy level of all features within a class, normalized categorical feature vectors are obtained after setting feature size constraints. : ; ; Normalized categorical feature vectors Perform singular value decomposition: ; in, It is the left singular matrix representing the orthogonal basis of sample directions. It is a singular value matrix representing the importance of different directions. It is the right singular matrix representing an orthogonal basis of the feature space directions. The first r left singular vectors are taken as the corresponding class prototypes. .
[0031] Use the softmax function to analyze singular values. Perform smooth normalization to obtain the weight in that direction. : ; Using weights in each direction to model the category space prototype Obtain the category prototype subspace by weighting. By adjusting the subspace in all directions, the prototype is highlighted in key directions, thereby obtaining a more discriminative directional distribution in the category space prototype: ; Establish a category covariance matrix at the category level to describe the sample distribution structure: ; in, This represents the first r eigenvectors of the right singular matrix of category i. This is a projection operator used to capture the spatial cooperability of intra-class samples along the main energy direction.
[0032] Class covariance matrix The class projection covariance matrix is obtained by projecting onto the class prototype subspace. : ; Projection covariance matrix of categories Eigenvalue decomposition is performed; the larger the eigenvalue, the higher the energy of the class feature distribution in that direction. The top K eigenvectors are then selected to form a direction matrix. As the main direction of low-dimensional features of category i.
[0033] Finally, the direction matrix In category space prototype Structural reduction is performed to obtain a category-enhanced space prototype. This non-linear spatial stretching of the inter-class ambiguity region causes some class features that originally overlapped in the high-dimensional space to be separated again: ; For category i, the query set samples are projected into a set of original query features through an embedding function. Normalized query feature vectors are obtained by using feature normalization. This is then mapped to the augmented space prototypes of each category, embedding the query samples into a coordinate system geometrically consistent with the target category, and obtaining the query projection features. : ; Query projection features represent the correlation of samples along the main intra-class direction while suppressing the energy distribution along secondary perturbation dimensions, thus exhibiting good noise robustness and structural cohesion. However, these features only reflect the relative directional information of the class structure and lack global geometric relationships in the original feature domain. Therefore, an inverse query projection feature transformation is needed to map them back to the original space. ; To evaluate the geometric consistency of the query samples with various spatial prototypes, a method based on the original query features is used. and projection features Similarity measurement is performed based on the error: ; in, For the original query feature of the i-th class and k-th dimension, For the projected features of the i-th class and k-th dimension, For the final similarity score, when When the value is large, the query set samples can be better reconstructed by the category space prototype.
[0034] For any two distinct categories j and k, first, calculate their category space prototypes. The inner product matrix describes the degree of overlap between the subspace directions of category j and k. The orthogonal loss is obtained by accumulating the sum of squared inner products of all category space prototypes. ; Furthermore, Figure 5 (a) shows the recognition results based on the ship dataset, which mainly includes: the results of the methods under the two task configurations of 5way-5shot and 5way-5shot on the ship dataset are compared with other advanced few-shot learning methods. The spatial metric prototype network improves the recognition accuracy by 26.98% and 24.49% respectively compared with the model with the highest accuracy. Figure 5 (b) shows the recognition results based on the MAR20 aircraft dataset, which mainly includes: comparing the results of the methods under the two task configurations of 5way-5shot and 5way-5shot on the ship dataset with other advanced few-shot learning methods, and spatially measuring the recognition accuracy of the prototype network, which improved by 2.70% and 8.92% respectively compared with the model with the highest accuracy.
[0035] Further, see Figure 6 (a) shows the test results of the benchmark network ProtoNet on the ship dataset. The t-SNE visualization analysis results mainly show the distribution of the five categories in the embedding space of the test set. It shows that the sample points of the same category are difficult to cluster in a relatively compact area. The intra-class distribution span is large. Under the condition of small sample size, the category representation learned by the benchmark network ProtoNet is more sensitive to factors such as pose change, scale difference, imaging noise and background interference, resulting in insufficient intra-class consistency. Sample points of different categories overlap or interweave in multiple regions. There is a lack of clear intervals and stable boundaries between category clusters, making it difficult to form obvious inter-class boundary structures. Figure 6 (b) shows the test results of the spatial metric prototype network on the ship dataset. The t-SNE visualization analysis results show that the spatial metric prototype network is a small sample target recognition model. The main features include: the distribution of the five categories in the embedding space of the test set shows that the distribution of sample points of each category of the spatial metric prototype network is more compact and the number of outliers is reduced, which reflects smaller intra-class variance and better intra-class consistency. The feature cluster spacing between different categories is clearer and the overlapping area is significantly reduced, which shows larger inter-class distance and clearer discrimination boundary. Under small sample conditions, it has learned more stable and more discriminative feature representations, which improves the ability to distinguish similar targets and the robustness to background interference and imaging changes.
[0036] Second Embodiment Based on the same inventive concept, this invention provides a few-sample target recognition system based on a spatial metric prototype network, employing the aforementioned few-sample target recognition method based on a spatial metric prototype network, including: The data partitioning module receives the remote sensing image dataset to be processed and divides it into training, validation, and test sets according to the category dimension; the remote sensing image dataset contains target samples of multiple categories. The model generation module is used to construct multiple small-sample classification tasks from the training set based on the training set categories using task-oriented meta-learning. Each small-sample classification task includes a support set and a query set. Each small-sample classification task is input into the feature extraction network to generate corresponding feature vectors. The feature vectors are then translated and scaled to obtain normalized feature vectors. Singular value decomposition is performed on the normalized support class feature vectors to obtain planar class space prototypes. The class space prototypes are then reconstructed by orientation weighting and projection to generate class augmentation space prototypes. The normalized query feature vectors are projected onto each class augmentation space prototype to calculate the projection error, which is used as a metric function for training the small-sample target recognition model. During the training phase of the small-sample target recognition model, the model predicts class samples that did not participate in the training tasks using the validation set, and adjusts the trainable weights and adjustable hyperparameters within the network based on the prediction results. After training, the model predicts new class samples using the test set, and evaluates the classification accuracy of the small-sample target model on new class samples based on the matching degree between the predicted class and the true class label. The target recognition module is used to input the query image to be recognized into a small sample target recognition model that outputs the target category of the query image after the classification accuracy reaches a preset threshold.
[0037] Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make possible changes and modifications to the technical solutions of the present invention by utilizing the methods and techniques disclosed above without departing from the spirit and scope of the present invention. Therefore, any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall fall within the protection scope of the technical solutions of the present invention.
Claims
1. A few-sample target recognition method based on a spatial metric prototype network, characterized in that, include, Step S1: Receive the remote sensing image dataset to be processed, and divide the remote sensing image dataset into a training set, a validation set, and a test set according to the category dimension; wherein, the remote sensing image dataset contains target samples of multiple categories; Step S2: Based on the training set categories, task-based meta-learning is used in the few-shot target recognition model to repeatedly sample from the training set to construct multiple few-shot classification tasks. Each few-shot classification task includes a support set and a query set. Each few-shot classification task is input into a feature extraction network to generate a corresponding feature vector. The feature vector is then subjected to feature translation and scaling to obtain a normalized feature vector. Singular value decomposition is performed on the normalized support class feature vector to obtain a planar class space prototype. The class space prototype is then subjected to orientation weighting and projection reconstruction to generate a class augmentation space prototype. The normalized query feature vector is projected onto each of the class augmentation space prototypes to calculate the projection error. The projection error is then used as a metric function for training the few-shot target recognition model. Step S3: During the training phase of the few-shot target recognition model, the validation set is used to predict category samples that did not participate in the training task, and the trainable weights and adjustable hyperparameters within the network are adjusted according to the prediction results; after training is completed, the test set is used to predict new category samples, and the classification accuracy of the few-shot target recognition model on the new category samples is evaluated according to the degree of matching between the predicted category and the real category label. Step S4: Input the query image to be identified into the small sample target recognition model after the classification accuracy reaches a preset threshold, and output the target category of the query image.
2. The few-sample target recognition method based on spatial metric prototype networks according to claim 1, characterized in that, The validation set and the training set adopt the same task construction method as the training set in the training phase. The task construction method is the task-based meta-learning, which iteratively updates the model parameters on the small sample classification task with multiple samplings, on a task-by-task basis.
3. The few-sample target recognition method based on spatial metric prototype networks according to claim 1, characterized in that, In step S2, based on the training set categories, task-based meta-learning is used in the few-shot target recognition model to repeatedly sample from the training set to construct multiple few-shot classification tasks, including: Step S21: Randomly select N categories from the training set to form a category subset for the training task; randomly extract K samples from each category in the category subset to form the support set; randomly select one category from the category subset and extract Q samples from the category to form the query set; combine the generated support set and the query set to form a complete small sample classification task. Step S22; Repeat step S21 to construct a set of few-sample classification tasks, and iteratively update the model parameters according to the task during the training phase to achieve task meta-learning.
4. The few-sample target recognition method based on spatial metric prototype networks according to claim 1, characterized in that, In step S2, the feature extraction network uses a ResNet18 network with the fully connected classification layer at the end removed to extract convolutional features from the remote sensing image. The feature extraction network sequentially includes an input convolutional layer, four residual module groups, and a global average pooling layer. Each residual module group contains two residual blocks, and each residual block consists of two 3×3 convolutional layers. The input of the residual block is added element-wise to the output of the second 3×3 convolutional layer through an identity shortcut connection to obtain the feature map output by the residual block. The final output feature map of the residual module group is passed through the global average pooling layer to obtain the feature vector.
5. The few-sample target recognition method based on spatial metric prototype networks according to claim 1, characterized in that... In step S2, the feature vector is subjected to feature translation and scaling to obtain a normalized feature vector, including: Using the feature channels as indexes, the median of the feature vectors of the query set and the support set samples is calculated for each channel. Then, the feature values of each channel are shifted based on the median to make the median of each channel zero. Calculate the average Euclidean distance from the decentralized feature vector to the zero center, and scale the feature vector by the average Euclidean distance. Apply a preset feature size constraint to the scaled feature vector to obtain the normalized support set category feature vector and the query category feature vector, which are used for the calculation of the category space prototype and the category enhancement space prototype. The feature vectors of the query set and support set samples are decentralized using the median indexed by the feature channels. The feature vectors are then scaled using the average Euclidean distance from the decentralized feature vectors to the origin. After setting feature size constraints, the normalized feature vectors are obtained. The normalized feature vectors include the support category feature vectors and the query feature vectors.
6. The few-sample target recognition method based on spatial metric prototype networks according to claim 1, characterized in that... In step S2, singular value decomposition is performed on the normalized support class feature vectors to obtain the class space prototype of the planar structure, including: Perform the singular value decomposition on the support category feature vector to generate a left singular matrix, a right singular matrix, and a singular value matrix; The singular values are arranged in descending order according to the diagonal elements of the singular value matrix, and the corresponding first R columns of left singular vectors are selected. The first R columns of left singular vectors are the main directions of the category in the feature space. They are combined to form the category space prototype, where the diagonal elements are the corresponding singular values.
7. The few-sample target recognition method based on spatial metric prototype networks according to claim 6, characterized in that... In step S2, directional weighting and projection reconstruction are performed on the category space prototype to generate a category-enhanced space prototype, including: The singular values of the class space prototype are converted into weights using the softmax function, and the feature vectors of the class space prototype are weighted and summed according to the weights to generate a class prototype subspace, which serves as the main directional contribution of the class. A projection operator is constructed using the first R eigenvectors of the right singular matrix to project the support class eigenvectors onto the class space prototype, thereby obtaining the class covariance matrix. The category covariance matrix is projected onto the category prototype subspace to obtain the corresponding category projection covariance matrix, and eigenvalue decomposition is performed. Based on the eigenvalues arranged in descending order, the eigenvectors corresponding to the first r eigenvalues are selected and restored in the category space prototype to generate the category enhancement space prototype.
8. The few-sample target recognition method based on spatial metric prototype networks according to claim 7, characterized in that... In step S2, the normalized query feature vector is projected onto each of the category augmentation space prototypes to calculate the projection error, and the projection error is used as a metric function for training the few-sample target recognition model, including: The query feature vectors are projected onto the prototypes of each category enhancement space to obtain the projected feature vectors in each category subspace. The difference between the query feature vector and the projected feature vectors of each category is calculated to obtain the projection error vector. The corresponding L2 norm is calculated as the projection error of each category. The category with the largest -L2 norm is selected as the category to which the query sample belongs. The projection errors of all query samples are used as a metric function and input into the small sample target recognition model to train the model parameters.
9. The few-sample target recognition method based on spatial metric prototype networks according to claim 8, characterized in that... Step S2 further includes calculating the inner product matrix between the category space prototypes and accumulating the sum of squares of the inner products of all the category space prototypes to obtain an orthogonal loss, which is used to constrain the mutual orthogonality of the category space prototypes.
10. A few-sample target recognition system based on a spatial metric prototype network, employing the few-sample target recognition method based on a spatial metric prototype network as described in any one of claims 1 to 9, characterized in that, include: The data partitioning module is used to receive the remote sensing image dataset to be processed and partition the remote sensing image dataset into a training set, a validation set, and a test set according to the category dimension; wherein, the remote sensing image dataset contains target samples of multiple categories; The model generation module is used to construct multiple small-sample classification tasks from the training set based on the training set categories using task-based meta-learning in a small-sample target recognition model. Each small-sample classification task includes a support set and a query set. Each small-sample classification task is input into a feature extraction network to generate a corresponding feature vector. The feature vector is then translated and scaled to obtain a normalized feature vector. Singular value decomposition is performed on the normalized support class feature vector to obtain a planar class space prototype. The class space prototype is then weighted by direction and reconstructed by projection to generate a class augmentation space prototype. The normalized query feature vector is projected onto each of the class augmentation space prototypes to calculate the projection error. The projection error is used as a metric function for training the small-sample target recognition model. During the training phase of the small-sample target recognition model, the validation set is used to predict class samples that did not participate in the training tasks, and the trainable weights and adjustable hyperparameters within the network are adjusted based on the prediction results. After training, the test set is used to predict new class samples, and the classification accuracy of the small-sample target model on the new class samples is evaluated based on the degree of matching between the predicted class and the true class label. The target recognition module is used to input the query image to be recognized into the small sample target recognition model after the classification accuracy reaches a preset threshold, and output the target category of the query image.