Hyperspectral image classification method based on hybrid metric learning and double-flow representation

By adopting hybrid metric learning and dual-stream representation methods in hyperspectral image classification, combined with BiStream, LCEM and AdaptLoss technology, the problem of high demand for computing resources and difficulty in utilizing three-dimensional characteristics and scarce labeled data in hyperspectral image classification is solved, and the classification effect of high precision, strong generalization ability and low computational complexity is achieved.

CN119649156APending Publication Date: 2025-03-18HUNAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510103679.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

Hyperspectral image classification faces the problems of high demand for computing resources, difficulty in making full use of the three-dimensional characteristics of hyperspectral image cubes, and scarce labeled data.

Method used

Using hyperspectral image classification method based on mixed metric learning and dual-stream representation, the alignment of the feature distribution of the source domain and the target domain is achieved and the small sample classification is performed through technologies such as the dual-branch embedded feature extraction module (BiStream), local central entropy matrix (LCEM) and adaptive domain adaptive loss module (AdaptLoss).

Benefits of technology

It significantly improves the accuracy, generalization ability and computing efficiency of hyperspectral image classification, especially in cross-domain, small sample learning scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649156A_ABST
    Figure CN119649156A_ABST
Patent Text Reader

Abstract

The invention discloses a hyperspectral image classification method based on hybrid metric learning and double-flow representation, which belongs to the technical field of image processing, and comprises the following steps: step A, preprocessing hyperspectral data of a source domain and a target domain, generating spatial spectrum patches, and constructing a support set and a query set through a data enhancement technology, simulating a few-sample learning task; step B, designing a double-branch embedded feature extraction module (BiStream), and extracting efficient classification features from a source domain and a target domain in combination with an attention mechanism and a domain mapping strategy; step C, introducing a local center entropy matrix (LCEM) and an adaptive loss module (AdaptLoss) of an adaptive domain, aligning feature distribution of the source domain and the target domain, and realizing domain adaptation; and step D, using a Mahalanobis distance and an LCEM regularization matrix to complete few-sample classification of a target domain. The method has a good improvement effect on the overall performance in the cross-domain small sample field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and in particular relates to a hyperspectral image classification method based on hybrid metric learning and dual-stream representation. Background Art

[0002] Hyperspectral imaging technology plays an important role in the field of remote sensing. It can capture detailed material characteristics and is suitable for many fields such as environmental monitoring, precision agriculture, urban planning and natural resource exploration. Early hyperspectral classification mainly relied on traditional machine learning methods such as k-nearest neighbor (KNN), Bayesian estimation, multinomial logistic regression, support vector machine (SVM) and random forest (RF), which have limitations in dealing with complex or high-dimensional data. They usually require expertise in specific fields to perform manual feature engineering, which not only increases the difficulty of the work but also easily leads to poor performance. In addition, traditional methods are difficult to fully utilize the spatial correlation between adjacent pixels, which limits their ability to capture complex spatial patterns in hyperspectral images. They are also sensitive to noise and cannot effectively deal with the redundancy problem in hyperspectral data, thus affecting classification accuracy.

[0003] With the introduction of deep learning methods, hyperspectral classification has ushered in new development opportunities. Deep learning models, especially convolutional neural networks (CNNs), are favored because they can automatically learn features from raw data and capture complex nonlinear relationships. However, deep learning methods also face challenges, such as large computing resource requirements, especially when dealing with high-dimensional data sets. Although 1D-CNN and 2D-CNN can extract spectral features and spatial features respectively, they fail to fully utilize the three-dimensional characteristics of hyperspectral image cubes. 3DCNN was proposed to use spectral and spatial information to improve classification results, but it still requires a lot of computing resources.

[0004] Another significant challenge is the scarcity of labeled data. Both traditional machine learning and deep learning methods rely on a large amount of well-labeled data to train the model. However, in practical applications, it is expensive and time-consuming to obtain enough hyperspectral samples for labeling, which makes it difficult for the model to capture the diversity of scenes and lacks generalization ability. To address this problem, methods such as semi-supervised learning, unsupervised learning, and small sample learning have been proposed to try to reduce the dependence on large amounts of labeled data, but each has different limitations. For example, although small sample learning can be generalized to unseen categories based on limited data, it still faces challenges in cross-domain adaptation, especially when there are significant distribution differences between the source domain and the target domain. These factors together constitute the technical challenges faced in the field of hyperspectral imaging classification. Summary of the invention

[0005] In view of the above problems, the present invention provides a hyperspectral image classification method based on hybrid metric learning and dual-stream representation, which has a great effect on improving the overall performance in the cross-domain small sample field.

[0006] To achieve the above object, the technical solution adopted by the present invention is: A hyperspectral image classification method based on hybrid metric learning and dual-stream representation includes the following steps: Step A: Preprocess the hyperspectral data in the source and target domains to generate spatial spectral patches, and construct support sets and query sets through data augmentation techniques to simulate few-shot learning tasks; Step B: Design a dual-branch embedding feature extraction module (BiStream), combining the attention mechanism and domain mapping strategy to extract efficient classification features from the source domain and the target domain; Step C: Introduce the local center entropy matrix (LCEM) and the adaptive domain adaptive loss module (AdaptLoss) to align the feature distribution of the source domain and the target domain to achieve domain adaptation; Step D: Use the Mahalanobis distance and LCEM regularization matrix to complete the few-shot classification of the target domain.

[0007] Technical effect of the above scheme: Through hybrid metric learning and dual-stream representation, combined with domain adaptation technology, the present invention provides an efficient cross-domain few-sample hyperspectral image classification method. This method can achieve feature distribution alignment between the source domain and the target domain, significantly improving the classification accuracy and generalization ability, especially when labeled data is scarce.

[0008] As a further improvement of the above scheme, in step A, the size of the spatial spectrum patch after preprocessing is , where HalfWidth is the half-width parameter, is the number of spectral bands, and data augmentation is performed by flipping and noise injection.

[0009] The technical effect of the above improvements is: diverse spatial spectral patches are generated through data augmentation techniques (such as flipping and noise injection), which enhances the diversity of training data and thus improves the robustness and generalization ability of the model in few-sample learning tasks.

[0010] As a further improvement of the above solution, the dual-branch embedding feature extraction module (BiStream) in step B includes: Main branch: extract spectral spatial features through 3D convolutional layers, and use batch normalization (BN) and ReLU activation functions for nonlinear processing; Second branch: extract lightweight features through channel-by-channel convolution, preserving the spatial and spectral characteristics of the input features; Output fusion: The outputs of the main branch and the secondary branch are connected along the channel dimension, and the original input features are retained through residual connections.

[0011] The technical effect of the above improvements is as follows: The dual-branch embedded feature extraction module (BiStream) can simultaneously extract rich spectral spatial features and lightweight features through parallel processing of the main branch and the secondary branch, which not only retains the detailed information of high-dimensional data, but also reduces the computational complexity and improves the efficiency of feature extraction.

[0012] As a further improvement of the above scheme, the output of the BiStream module is expressed as:

[0013] in, is the feature fusion result of the main branch and the secondary branch. is the weight parameter in the skip connection.

[0014] The technical effects of the above improvements are as follows: the original input features are retained through residual connections, the loss of key spectral spatial information is avoided, the gradient vanishing problem is alleviated, deeper networks can converge more effectively, and the training stability and classification performance of the model are improved.

[0015] As a further improvement of the above scheme, step B also includes a channel attention mechanism, which calculates channel weights through batch normalization scaling factors, recalibrates feature maps, and emphasizes the most informative channels.

[0016] The technical effect of the above improvements is as follows: The channel attention mechanism enhances the model’s understanding of the input data by recalibrating the feature map, emphasizing the most informative channels and suppressing unimportant channels, thereby further improving the classification accuracy.

[0017] As a further improvement of the above scheme, the local center entropy matrix (LCEM) in step C is used to capture the local geometric structure of feature distribution at the class level and task level, and the calculation formula is:

[0018] in, is the sample size, For the feature vectors, is the mean of the eigenvectors, is the entropy-based weight, is a small positive constant, is the identity matrix.

[0019] The technical effects of the above improvements are as follows: The local center entropy matrix (LCEM) can capture the local geometric structure of feature distribution at the class level and task level. By regularizing the precision matrix, the model's ability to model the correlation of samples within a class is enhanced, thereby improving the robustness of classification.

[0020] As a further improvement of the above scheme, the adaptive domain adaptive loss module (AdaptLoss) in step C combines the central moment difference (CMD) loss and the maximum mean difference (MMD) loss, and the calculation formula is:

[0021] in, and is the standardized weight, and are the characteristics of the source domain and the target domain, respectively.

[0022] The technical effects of the above improvements are as follows: The adaptive domain adaptive loss module (AdaptLoss) combines the central moment difference (CMD) loss and the maximum mean difference (MMD) loss, which can effectively align the high-order moments and feature distributions of the source domain and the target domain, and enhance the adaptability of the model in cross-domain tasks.

[0023] As a further improvement of the above scheme, in step D, the few-sample classification of the target domain is achieved by calculating the Mahalanobis distance between the query feature and the class representation, and the calculation formula is:

[0024] in, To query features, For Class The expression, For Class The precision matrix of .

[0025] The technical effect of the above improvements is as follows: by calculating the similarity between query features and class representations through the Mahalanobis distance, the correlation between samples can be measured more accurately, thereby improving the accuracy of few-sample classification.

[0026] As a further improvement of the above solution, in step D, the total loss function of classification is:

[0027] in, is the cross entropy loss, is the adaptive domain adaptive loss, is the weight parameter.

[0028] The technical effect of the above improvements is: by combining cross entropy loss and adaptive domain adaptation loss, the classification performance of the model is optimized, and the weight parameters are Dynamically balancing the contributions of the two losses enables the model to better adapt to the data distribution of the target domain in cross-domain tasks.

[0029] As a further improvement of the above solution, in step D, the few-sample classification process of the target domain includes: Compute the class representation for each class in the target domain , obtained by calculating the mean value of all eigenvectors of this class; Regularize the precision matrix using the Local Center Entropy Matrix (LCEM) , used to calculate the Mahalanobis distance; The query feature is assigned to the class with the minimum Mahalanobis distance to complete the classification task.

[0030] The technical effect of the above improvements: and regularize the precision matrix using the Local Center Entropy Matrix (LCEM) , which can more accurately complete the few-sample classification task in the target domain, especially when labeled data is scarce, significantly improving the accuracy and stability of classification.

[0031] Compared with the prior art, the technical effects produced by the present invention are: The present invention significantly improves the accuracy, generalization ability and computational efficiency of hyperspectral image classification through hybrid metric learning, dual-stream representation and domain adaptation technology, especially in cross-domain few-sample learning scenarios, and has broad application prospects.

[0032] The details are as follows: 1. Higher classification accuracy: The present invention can more accurately capture the spectral and spatial characteristics of hyperspectral images and significantly improve the classification accuracy through hybrid metric learning (combining local correlation entropy matrix and Mahalanobis distance) and dual-stream representation (BiStream module).

[0033] Experimental results on benchmark datasets show that the overall accuracy (OA), average accuracy (AA) and Kappa coefficient of the proposed method are better than the existing ones.

[0034] 2. Stronger cross-domain generalization capabilities: Through the adaptive domain adaptive loss module (AdaptLoss) and the local center entropy matrix (LCEM), the present invention can effectively align the feature distributions of the source domain and the target domain, and enhance the generalization ability of the model in cross-domain tasks.

[0035] Especially when there is a significant distribution difference between the source domain and the target domain, the present invention can still maintain a high classification performance.

[0036] 3. Lower computational complexity: The dual-branch embedding feature extraction module (BiStream) retains the detailed information of high-dimensional data while reducing the computational complexity and improving the efficiency of feature extraction through parallel processing of the main branch and the secondary branch.

[0037] The introduction of residual connection and channel attention mechanism further optimizes the computational efficiency of the model.

[0038] 4. Better few-shot learning performance: The present invention performs well in few-sample learning tasks, especially when labeled data is scarce. It can learn an effective classification model through limited support set samples and achieve high-precision classification on the query set.

[0039] 5. Stronger robustness: Through data enhancement technology and local center entropy matrix (LCEM), the present invention can effectively deal with the noise and redundancy problems in hyperspectral data and enhance the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flowchart of a cross-domain small sample hyperspectral image classification method based on hybrid metric learning and dual-stream representation in an embodiment designed by the present invention.

[0041] Figure 2 Pseudo-color image of the Chikusei dataset.

[0042] Figure 3 Pseudo-color image of the IndianPines dataset.

[0043] Figure 4 The ground truth images of the IndianPines dataset.

[0044] Figure 5 This is the classification diagram of the IndianPines dataset in this method.

[0045] Figure 6 This is a pseudo-color image of the Pavia University dataset.

[0046] Figure 7 are the ground truth images of the PaviaUniversity dataset.

[0047] Figure 8 This is the classification diagram of the Pavia University dataset in this method.

[0048] Fig. 9 Pseudo-color image of the LongKou dataset.

[0049] Fig.10 are the ground truth images of the LongKou dataset.

[0050] Fig.11 This is the classification diagram of the LongKou dataset in this method. DETAILED DESCRIPTION

[0051] In order to enable those skilled in the art to better understand the technical solution, the present invention is described in detail below in conjunction with embodiments. The description in this section is only exemplary and explanatory and should not have any limiting effect on the scope of protection of the present invention.

[0052] The present invention discloses a cross-domain small sample hyperspectral image deep learning method based on hybrid metric learning and dual-stream representation, which is used for small sample classification of hyperspectral images.

[0053] Invention steps: Step A: Data preparation: The hyperspectral data of the source and target domains are preprocessed into a size of (2× +1) × (2× + 1) × B spatial spectral patches. The diversity is improved by data augmentation techniques such as flipping and noise injection, and support sets and query sets are constructed to simulate few-shot learning tasks.

[0054] Step B: Feature Extraction,A novel dual-branch embedding feature extraction module (BiStream) is designed,which combines the attention mechanism with the domain mapping strategy to extract,efficient classification features from both the source and target domains.

[0055] Step C: Domain Alignment,To bridge the gap between the feature distributions of the source and target domains,,the Local Center Entropy Matrix (LCEM) and AdaptLoss are introduced to achieve,effective domain adaptation by aligning the feature distributions.

[0056] Step D: After completing the domain alignment, the target domain few-shot classification is achieved using the Mahalanobis distance and LCEM regularization matrix.

[0057] Furthermore, step A is as follows: the input shape is a 3D tensor , where H and W are the spatial dimensions and B is the number of spectral bands. Both the source and target domains are preprocessed by extracting spatial spectral patches around each labeled pixel, and data augmentation techniques such as flipping and noise injection are used to enhance training diversity. The patch centered at pixel (i, j) is represented as:

[0058] This will create a (2× +1) × (2× + 1)×B spatial-spectral cube dataset, which captures local spatial and spectral information, and the patch size is defined as:

[0059] The source domain dataset is divided into classes, and for each scenario, each class is randomly selected samples to form the support set: represents the number of classes, The number of support samples for each class. And select a single Samples, each class is represented as: , thereby simulating the few-shot learning task, where the model learns from a limited number of labeled samples (the support set) and is evaluated on unseen samples (the query set).

[0060] Furthermore, step B is specifically as follows: a novel embedding feature extraction module, called BiStream module, is designed, which is combined with the attention mechanism and adopts a domain mapping strategy to adapt the features of the source and target domains, so as to achieve effective classification in the case of domain changes. A powerful feature extraction network is formed. In HSIC, since the image has both spatial and spectral dimensions, the Bistream module implements a dual-path feature extraction mechanism with residual connections.

[0061] A dual-branch architecture is adopted to divide the feature extraction process into a main branch and a secondary branch, which work in parallel. Residual connections are added to preserve the original features and enhance the gradient flow of the entire network.

[0062] First, assume that the input tensor Where N is the batch size, C is the number of input channels, and D, H, and W are the spectral and spatial dimensions of the input.

[0063] 1) Bistream module: a) Main branch: In the main branch, the input tensor X is processed by a 3D convolutional layer to extract rich spectral spatial features. A kernel of size k × k × k and stride S is used to learn high-dimensional representations. Padding is applied to ensure that the output size is consistent with the kernel size. The input passes through the convolutional layer of the main branch, and the output at this time is:

[0064] in, , and are the spectral and spatial dimensions of the input, respectively, is the convolution kernel size, is the filling size, is the stride. In order to enhance convergence and generalization, batch normalization (BN) is used to standardize the output of the convolution operation to ensure faster convergence and better generalization. Finally, the ReLU activation function is applied to introduce nonlinearity. This process can be expressed as:

[0065] is the weight of the primary convolution, , represents the output feature map of the main branch. Therefore, the main branch extracts the primary spectral spatial features, which can be expressed as:

[0066] represents the convolution kernel of the main branch, Represents a bias value for each output channel to adjust the value range of the output feature map.

[0067] b): Secondary branch Secondary branches receive output from the main branch As input, channel-by-channel convolution is used to extract lightweight features, so that each input channel has its own convolution kernel, and these convolution kernels only act on their respective channels, thereby reducing the computational cost while retaining the spatial and spectral characteristics of the input features. The output of the secondary branch can be expressed as:

[0068] represents the channel-by-channel convolution kernel of the secondary branch, is the bias value of each output channel. And this process can be expressed as:

[0069] in , represents the depth convolution kernel, , represents the output feature map after the secondary branch processing. Among them, is the number of output channels of the secondary branch.

[0070] c): Output fusion and residual connection Output of the master branch and the output of the secondary branch Concatenate along the channel dimension to form a combined feature representation:

[0071] At the same time, a residual connection is added to the Bistream module. The residual connection bypasses the two branches and directly propagates the original input X after channel alignment through a 1×1×1 convolution. The final output of the BiStream module is represented as , as shown below:

[0072] in , represents the weight parameter in the jump connection. Through the residual connection, the original input features are retained to avoid the loss of key spectral spatial information. It also alleviates the gradient vanishing problem, allowing deeper networks to converge more effectively. By combining the extracted features with the original input, the network achieves a balance between feature richness and computational efficiency.

[0073] 2): Attention Mechanism Integration After the BiStream module, a channel attention mechanism is applied to recalibrate the feature maps and emphasize the most informative channels. This process is done by calculating channel weights using batch normalization scaling factors. Batch normalization can be expressed as:

[0074] in and are the mean and standard deviation, , are trainable scaling and translation parameters. This allows the model to learn how to appropriately scale up or down the normalized output, and whether translation is required. An independent scaling and translation capability is provided for each channel.

[0075] For channel weight calculation, the scaling parameters after batch normalization are used To calculate the channel weight. Specifically, for the The weight of the channel , which is calculated as follows:

[0076] in, For the The scaling factor for each channel, is the total number of channels.

[0077] This allows channels that carry more useful information to receive more attention, which helps improve the expressiveness of the model.

[0078] Then, the recalibrated feature map is obtained by applying a sigmoid activation:

[0079] Generate a dynamic channel weight mask, These channel weights are converted to values ​​ranging from (0, 1). The output of the Sigmoid function can be viewed as the degree of activation or importance score of each channel. Values ​​close to 1 mean that the channel is considered important, while values ​​close to 0 mean that the channel is less important, thereby further emphasizing more informative channels and suppressing unimportant channels, increasing its depth of understanding of the input data.

[0080] The final output , where L is the flattened feature vector after passing through the BiStream module.

[0081] Further, step C is specifically as follows: 1) Local Center Entropy Matrix (LCEM) for Domain Representation LCEM is used to capture the local geometric structure of feature distribution at both class and task levels.

[0082] In the domain alignment part, LCEM is applied to both source domain features and target domain features. For feature set X, LCEM is calculated as:

[0083] Where N is the number of samples, For the feature vectors. is the mean of the eigenvectors, is the entropy-based weight, is a small positive constant, is the identity matrix.

[0084] Compute by computing the adaptive Gaussian kernel , represents the entropy-based weight, is the identity matrix, is a small positive constant. The class LCEM is calculated for a single class, while the task LCEM is calculated for the entire dataset. The regularized accuracy matrix is ​​then obtained by combining these two components:

[0085] here, is a regularization parameter used to balance the contribution of class-specific and task-level LCEM. This regularized accuracy matrix is ​​then used for the Mahalanobis distance calculation, which will be analyzed in detail in step D.

[0086] 2) AdaptLoss for Domain Adaptation It combines the Central Moment Difference (CMD) loss and the Maximum Mean Difference (MMD) loss. These two components complement each other by aligning the high-order moments and kernel-based feature distributions between the source and target domains. The CMD loss aligns the high-order moments of the source and target feature distributions. It is defined as:

[0087] X are the source and target features, is the mean vector of the source and target features, and K is the number of central moments to be aligned.

[0088] The MMD loss measures the distance between the source distribution and the target distribution using a kernel-based method. Specifically, for MMD:

[0089] is a Gaussian kernel function, which is used to calculate the similarity between samples. Represents the source domain samples and another independent and identically distributed sample expectations, It means that the target domain sample and another independent and identically distributed sample expectations, Represents the expectation between source and target domain samples.

[0090] The combined AdaptLoss dynamically balances the CMD and MMD functions to adapt to the relative size of the domain difference:

[0091] in, and are the characteristics of the source domain and the target domain respectively, and is the standardized weight.

[0092] here, and is a normalized weight calculated based on the relative contribution of the two losses.

[0093] The domain alignment process alternates between minimizing AdaptLoss and performing few-shot classification. In each episode, the features extracted from the source domain (support and query features) are concatenated and aligned with the features extracted from the target domain using AdaptLoss.

[0094] Further, step D is as follows: For the target domain, class representation and precision matrix are calculated. Each class is represented by the average value of its feature vector, and the precision matrix is ​​regularized using the LCEM described above.

[0095] For each class c in the target domain, its class representation It is obtained by calculating the mean of all feature vectors of this class. The formula is as follows:

[0096] For Class The number of samples in Belong to class No. The feature vector of the samples.

[0097] The Mahalanobis distance is used to measure the similarity between query features and class representations. Given a query feature q, the Mahalanobis distance to class c is:

[0098] For Class The precision matrix is ​​used to measure the correlation between samples within a class. For Class is the average value of the feature vectors of all supporting samples of this class.

[0099] Assign the query feature to the class with the minimum Mahalanobis distance. The classification logic is calculated as follows:

[0100] For few-shot learning on the target domain, the model alternates between source and target domain tasks during training. The cross entropy loss for classification is: The total loss of classification is thus: in, is the cross entropy loss, is the adaptive domain adaptive loss, is the weight parameter.

[0101] Experimental setup: (1) Dataset Introduction Four different hyperspectral datasets are used, including the Indian Pines dataset, the Pavia University dataset, the Long Kou dataset, and the Chikusei dataset. The Chikusei dataset is used as the source domain dataset, and the other three datasets are used as target domain datasets.

[0102] The Chikusei dataset was acquired by the Hyperspec-VNIR-CIRIS hyperspectral imaging spectrometer in urban and rural areas of Chikusei City, Ibaraki Prefecture, Japan. The spatial resolution of the data is 2.5 meters, and the covered scene size is 2517×2335 pixels. The original data contains 512 spectral bands, and 128 bands were selected after processing, with a wavelength range from 363 nanometers to 1018 nanometers. The dataset covers 19 types of land objects, including urban buildings, roads, farmland, vegetation, etc. It is a complex and high-dimensional multi-category hyperspectral dataset.

[0103] The Indian Pines dataset was collected by the AVIRIS (Airborne Visible / Infrared Imaging Spectrometer) sensor at the Indian Pines Experimental Field in northwest Indiana, USA. The spatial resolution of the data is 20 meters and the coverage area is 145×145 pixels. In terms of the spectral range, the dataset covers 400 nanometers to 2500 nanometers, and 200 valid bands are retained after noise reduction. There are 16 types of ground objects in the dataset, including farmland, woods, grassland, etc. There are a total of 10,249 annotated pixels.

[0104] The Pavia University dataset is a hyperspectral dataset acquired by the ROSIS (Reflective Optics System Imaging Spectrometer) sensor. The dataset has a spatial resolution of 1.3 meters, covers an area of ​​610×340 pixels, has a spectral range from 430 nanometers to 840 nanometers, and contains 103 spectral bands. The Pavia University dataset covers 9 types of land objects, such as roads, buildings, vegetation, and soil, and mainly reflects the characteristics of the urban environment. This dataset is widely used in urban land cover classification tasks due to its high resolution and diversity of land object distribution.

[0105] The LongKou dataset is a hyperspectral remote sensing dataset of agricultural scenes, acquired in Longkou City, Hubei Province, China. The data was collected using a DJI Matrice 600Pro (DJI M600 Pro) drone platform equipped with an 8mm focal length Headwall Nano-Hyperspec hyperspectral imaging sensor. The study area for collection is a typical agricultural scene, containing six major crops: corn, cotton, sesame, broad-leaved soybean, narrow-leaved soybean, and rice. The drone flew at an altitude of 500 meters and the generated image size was 550×400 pixels. The spectral range of this dataset is 400 nanometers to 1000 nanometers, with a total of 270 spectral bands. The spatial resolution of the hyperspectral image is about 0.463 meters. The LongKou dataset is an ideal dataset for studying hyperspectral image classification, target detection, and agricultural remote sensing applications due to its high resolution, wide spectral range, and rich crop categories.

[0106] Experimental results: The performance of all classification methods is evaluated by overall accuracy (OA), average accuracy (AA), and Kappa coefficient. For the source domain, 200 samples of each class are randomly selected as the training set, while for the target domain, the number of labeled samples of each class in the target domain is set to 5. In order to fully train the network, the number of training iterations on the Pavia University and Indian Pines datasets is set to 10000, and the number of training iterations on the LongKou dataset is set to 2000, and the learning rate is set to 0.001.

[0107] It turns out that: On the Indian Pines dataset, the experimental results are: Overall Accuracy (OA): 78.68 +- 0.75; Average Accuracy (AA): 86.56 +- 0.56; Kappa coefficient: 75.8592 +- 0.8011; The accuracy of each category is as follows: Class 0: 100.00+-0.00; Class 1: 65.58 +-3.76; Class 2: 69.98 +-6.60; Class 3: 99.40 +- 0.97; Class 4: 88.81 +-1.01; Class 5: 88.52+-6.22; Class 6: 100.00+-0.00; Class 7: 86.47 +-5.55; Class8: 100.00+-0.00; Class 9: 68.81 +-1.19; Class10: 76.52 +-3.75; Class11: 70.48 +- 3.56; Class 12: 100.00+-0.00; Class13: 92.05 +- 2.16; Class 14: 79.82+-5.69; Class 15: 98.52 +-3.09; On the Pavia University dataset, the experimental results are: Overall Accuracy (OA): 87.10 +- 1.24; Average Accuracy (AA): 85.01 +- 1.06; Kappa coefficient: 82.6938 +- 1.6463; The accuracy of each category is: Class 0: 85.00 +- 4.95; Class 1: 96.54 +- 0.97; Class 2: 59.35 +- 6.75; Class 3: 88.83 +- 1.77; Class 4: 97.82 +- 1.00; Class 5: 62.73 +- 4.73; Class 6: 93.80 +- 3.05; Class 7: 81.08 +- 7.23; Class 8: 99.98 +- 0.04; On the LongKou dataset, the experimental results are: Overall Accuracy (OA): 98.00462 +- 0.17426; Average Accuracy (AA): 95.10777 +- 0.24365; Kappa coefficient: 97.17846 +- 0.24512; The accuracy of each category is as follows: Class 0: 99.79 +- 0.17; Class 1: 93.95 +- 1.15; Class 2: 94.86 +- 1.56; Class 3: 89.29 +- 1.56; Class 4: 97.48 +- 1.60; Class 5: 97.76 +- 1.36; Class 6: 84.71 +- 0.37; Class 7: 99.07 +- 0.36; Class 8: 99.07 +- 0.53.

[0108] It should be noted that, in this article, the terms: include, contain and any other variants are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. Specific examples are used in this article to illustrate the principle and implementation of the technical solution of the present invention. The above examples are only used to help understand the method of the present invention and its core idea. The above is only a preferred implementation of the present invention. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements, modifications or changes can be made, and the above technical features can also be combined in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the concept and technical solution of the present invention to other occasions without improvement, should be regarded as the protection scope of the present invention.

Claims

1. A domain-adaptive few-sample hyperspectral image classification method based on hybrid metric learning and two-stream representation, characterized in that: The following steps are involved: Step A: Preprocess the hyperspectral data in the source and target domains to generate spatial spectral patches, and construct support sets and query sets through data augmentation techniques to simulate few-shot learning tasks; Step B: Design a dual-branch embedding feature extraction module (BiStream), combining the attention mechanism and domain mapping strategy to extract efficient classification features from the source domain and the target domain; Step C: Introduce the local center entropy matrix (LCEM) and the adaptive domain adaptive loss module (AdaptLoss) to align the feature distribution of the source domain and the target domain to achieve domain adaptation; Step D: Use the Mahalanobis distance and LCEM regularization matrix to complete the few-shot classification of the target domain.

2. The method according to claim 1, characterized in that In step A, the size of the spatial spectral patch after preprocessing is (2×HalfWidth+1)×(2×HalfWidth+1)×B, where HalfWidth is the half-width parameter, B is the number of spectral bands, and data enhancement is performed by flipping and noise injection.

3. The method according to claim 1, characterized in that The dual-branch embedding feature extraction module (BiStream) in step B includes: Main branch: extract spectral spatial features through 3D convolutional layers, and use batch normalization (BN) and ReLU activation functions for nonlinear processing; Second branch: extract lightweight features through channel-by-channel convolution, preserving the spatial and spectral characteristics of the input features; Output fusion: The outputs of the main branch and the secondary branch are connected along the channel dimension, and the original input features are retained through residual connections.

4. The method according to claim 3, characterized in that The output of the BiStream module is represented as: Among them, Y is the feature fusion result of the main branch and the secondary branch, F skip is the weight parameter in the skip connection.

5. The method according to claim 1, characterized in that The step B also includes a channel attention mechanism, which calculates channel weights through batch normalization scaling factors, recalibrates feature maps, and emphasizes the most informative channels.

6. The method according to claim 1, characterized in that The local center entropy matrix (LCEM) in step C is used to capture the local geometric structure of feature distribution at the class level and task level, and the calculation formula is: Where N is the number of samples, x i is the i-th eigenvector, μ is the mean of the eigenvector, w i are entropy-based weights, ò is a small positive constant, and I is the identity matrix.

7. The method according to claim 1, characterized in that The adaptive domain adaptive loss module (AdaptLoss) in step C combines the central moment difference (CMD) loss and the maximum mean difference (MMD) loss, and the calculation formula is: AdaptLoss(X s ,X t )=α·MMD(X s ,X t )+β·CMD(X s ,X t ) Among them, α and β are standardized weights, X s and X t are the characteristics of the source domain and the target domain, respectively.

8. The method according to claim 1, characterized in that In step D, the few-sample classification of the target domain is achieved by calculating the Mahalanobis distance between the query feature and the class representation, and the calculation formula is: Among them, q is the query feature, μ c is the representation of class c, is the precision matrix of class c.

9. The method according to claim 1, characterized in that: In step D, the total loss function of classification is: L total =L CE (logits,labels)+L CE (logits2,labels)+λL adapt Among them, L CE is the cross entropy loss, L adapt is the adaptive domain adaptation loss, and λ is the weight parameter.

10. The method according to claim 1, characterized in that In step D, the few-sample classification process of the target domain includes: Compute the class representation μ for each class in the target domain c , obtained by calculating the mean value of all eigenvectors of this class; Regularize the precision matrix using the Local Center Entropy Matrix (LCEM) Used to calculate Mahalanobis distance; The query feature is assigned to the class with the minimum Mahalanobis distance to complete the classification task.