A cross-domain image classification method and device

By employing a lightweight dual-branch network and a progressive optimization framework, and utilizing multi-dimensional reliability assessment and collaborative prototype matching strategies, the problems of training instability and semantic distortion in cross-domain image classification are solved. This achieves high-precision, lightweight cross-domain image classification, which is suitable for practical applications such as crop monitoring and port ship identification.

CN122067030BActive Publication Date: 2026-06-26HARBIN ENGINEERING UNIVERSITY SANYA NANHAI INNOVATION & DEVELOPMENT BASE +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HARBIN ENGINEERING UNIVERSITY SANYA NANHAI INNOVATION & DEVELOPMENT BASE
Filing Date
2026-04-20
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing cross-domain image classification methods struggle to achieve robust model transfer in scenarios with scarce labeled data and limited computational resources, and are also prone to training instability and semantic distortion.

Method used

A lightweight dual-branch network and a progressive optimization framework are adopted. Pseudo-labeled samples are screened through multi-dimensional reliability assessment. Combined with a collaborative prototype matching strategy, a class-balanced target domain training set is constructed. Domain invariance enhancement training is performed to gradually supplement pseudo-labeled samples, thereby achieving cross-domain image classification.

Benefits of technology

It improves classification accuracy and robustness, avoids the drawbacks of complex adversarial training, reduces annotation costs and computational resource requirements, and is suitable for edge application scenarios with limited computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122067030B_ABST
    Figure CN122067030B_ABST
Patent Text Reader

Abstract

The application provides a cross-domain image classification method and device, and belongs to the technical field of computer vision and image processing; first, a light-weight dual-branch network is constructed, global spectral context is extracted through a multi-granularity spectral attention and a grouping Token mechanism, and multi-scale spatial features are extracted through a depth separable convolution and a local-global pyramid module; second, a multi-dimensional evaluation mechanism of fusing classification confidence, feature similarity, prediction uncertainty and a class balance factor is used to safely extract high-quality pseudo-label samples from a target domain; on the basis of domain-invariant feature enhancement training, a collaborative prototype strategy is used to progressively complete samples for classes not covered in the target domain, so that a training set is constructed; and finally, a strong robustness target domain classification model is obtained based on the training set. The application significantly reduces labeling cost and computing cost, and can be effectively applied to cross-scene classification tasks such as crop disease monitoring, port ship identification and sea area scene analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and image processing technology, specifically, it relates to a cross-domain image classification method and apparatus. Background Technology

[0002] Image classification is one of the core tasks in computer vision, aiming to assign semantic category labels to objects of interest in images. In practical applications such as precision agriculture, marine monitoring, and land planning, the challenge of cross-domain or cross-scene classification is frequently encountered: a classification model trained on one scene (the source domain) needs to be directly applied to another different, unlabeled scene (the target domain). This difference may stem from variations in imaging sensors, lighting conditions, seasons, geographical location, or even differences in the appearance of the target itself, resulting in significant differences in data distribution between the source and target domains—a phenomenon known as domain shift. Domain shift causes models that perform well in the source domain to degrade drastically in the target domain, severely hindering the practical deployment of classification models.

[0003] To alleviate the domain offset problem, existing research mainly follows two technical paths: unsupervised domain adaptation and domain generalization.

[0004] Unsupervised domain adaptation methods attempt to reduce inter-domain differences by aligning feature spaces using unlabeled data from the target domain during model training. Among these, adversarial training-based methods, which introduce a game between the domain discriminator and the feature extractor to encourage the generation of domain-invariant feature representations, have become the mainstream paradigm. However, these methods have significant limitations: First, the complex adversarial alignment process often involves global, implicit perturbations to the feature distribution, which can easily blur or even destroy the intra-class compactness and inter-class separability of features while smoothing out inter-domain differences, leading to semantic distortion and negative transfer. Second, adversarial training itself requires fine-tuning to maintain training stability and typically relies on deep network architectures and sufficient source domain labeled data to ensure convergence, which contradicts the original intention of cross-domain tasks to reduce labeling costs.

[0005] Domain generalization methods take a different approach, training with only one or more source domain data to learn a highly generalized model that doesn't rely on any target domain information. Common strategies include style perturbation of the source domain data, feature randomization, or synthesizing diverse extended domain data through generative models. The fundamental limitation of these methods is that their performance heavily depends on the strong assumption that "the source domain data fully covers possible domain shifts in the real world." In practical applications, especially when labeled data is scarce, this assumption is difficult to satisfy. Furthermore, data-generated strategies inevitably introduce the risk of semantic inconsistencies, which can also impair the model's learning of essential discriminative features.

[0006] Existing domain adaptation and domain generalization methods have failed to perfectly solve the challenge of safely and efficiently extracting pure semantically invariant features from target domain data under constraints of small sample annotation and lightweight models. The former faces risks of training instability and semantic distortion due to complex adversarial mechanisms; the latter struggles to overcome the limitations of source domain data due to the isolation of target domain information. Therefore, exploring a new cross-domain classification paradigm that can integrate the advantages of both—intelligently utilizing target domain data as a guide like domain adaptation, focusing on mining essential invariants like domain generalization, and possessing both parameter efficiency and training stability—has significant theoretical and practical value. This lightweight and robust cross-domain classification technology is particularly urgently needed in application scenarios such as port security, marine monitoring, and cross-regional crop assessment, where real-time performance, equipment computing power, and annotation costs are strictly limited.

[0007] In summary, existing cross-domain image classification methods can be mainly divided into two categories: unsupervised domain adaptation and domain generalization. The former relies on complex adversarial alignment, which easily leads to semantic distortion and unstable training; the latter, due to the complete isolation of target domain information, has its generalization ability limited by the completeness of the source domain data distribution. In addition, existing methods mostly use complex deep networks, which have high requirements for labeled data and computing resources, making them difficult to deploy in practical scenarios with scarce labels and limited computing power (such as farmland monitoring and border and coastal defense patrols). Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention proposes a cross-domain image classification method and apparatus. This method enables robust migration from the source domain (already labeled scenes) to the target domain (new unlabeled scenes) under conditions of scarce labeled data and limited computational resources. It can be widely applied to various image classification tasks involving domain shifts, such as monitoring crop growth status in different regions, identifying ship targets in different ports or sea areas, and classifying remotely sensed ground features from different time periods or sensors.

[0009] This invention is achieved through the following technical solution: a cross-domain image classification method.

[0010] The method specifically includes the following steps:

[0011] S1: Obtain the source domain labeled dataset and the target domain unlabeled dataset;

[0012] S2: Based on a small number of samples from the source domain labeled dataset, train an initial feature extraction network and classifier to obtain an initial classification model;

[0013] S3: Use the initial classification model to predict the target domain unlabeled dataset, and based on multi-dimensional reliability assessment, select the first batch of high-confidence pseudo-label samples from the target domain unlabeled data to form the initial target domain sample set;

[0014] S4: Combine the source domain labeled dataset with the initial target domain sample set, perform domain invariance enhancement training on the feature extraction network, and supplement pseudo-label samples for the uncovered categories in the target domain based on the collaborative prototype matching strategy to construct a complete target domain training set with balanced categories.

[0015] S5: Based on the complete target domain training set, the final target domain classification model is trained and used to classify target domain images.

[0016] Furthermore, in S3, the multi-dimensional reliability assessment specifically includes:

[0017] Four reliability metrics are calculated for each target domain sample: classification confidence, feature similarity to the source domain class prototype, prediction uncertainty, and class balance factor based on the distribution of source domain samples.

[0018] The four reliability indicators are weighted and summed to obtain the comprehensive reliability score;

[0019] Based on the comprehensive reliability score, a progressive threshold strategy is used to select the first batch of high-confidence pseudo-label samples.

[0020] Furthermore, in S3,

[0021] After selecting the first batch of high-confidence pseudo-label samples, cluster-based sample purification and expansion are performed, specifically as follows:

[0022] Cluster analysis is performed on the selected pseudo-label samples of each category; clusters with label consistency below a preset threshold are removed to purify the pseudo-label sample set; and neighboring samples are expanded using the center of a highly consistent cluster as the anchor point.

[0023] Furthermore, in S4, the collaborative prototype matching strategy is specifically as follows:

[0024] Calculate the source domain prototype of each category in the feature space, and the target domain prototype of each category of the pseudo-labeled samples obtained in the current target domain.

[0025] For uncovered empty categories in the target domain, perform a three-stage sequential completion process:

[0026] Phase 1: Calculate the similarity between the remaining samples in the target domain and the corresponding prototype in the source domain, and select the target domain samples whose similarity to the prototype in the source domain exceeds the first threshold.

[0027] Second stage: For categories not completed in the first stage, select target domain samples that the model predicts as belonging to that category and whose confidence level exceeds the second threshold;

[0028] The third stage: For categories that are still not complete in the first two stages, select several target domain samples that are closest to the corresponding source domain prototype Euclidean.

[0029] A cross-domain image classification device;

[0030] The image classification device includes a data acquisition module, an initial model training module, a sample extraction module, a feature enhancement and completion module, and a final model training and classification module;

[0031] The data acquisition module is used to acquire the source domain labeled dataset and the target domain unlabeled dataset;

[0032] The initial model training module trains an initial feature extraction network and a classifier based on a small number of samples from the source domain labeled dataset to obtain an initial classification model.

[0033] The sample extraction module uses the initial classification model to predict the target domain unlabeled dataset, and based on multi-dimensional reliability assessment, selects the first batch of high-confidence pseudo-label samples from the target domain unlabeled data to form the initial target domain sample set.

[0034] The feature enhancement and completion module merges the source domain labeled dataset with the initial target domain sample set, performs domain invariance enhancement training on the feature extraction network, and supplements pseudo-label samples for the uncovered categories in the target domain based on the collaborative prototype matching strategy, thereby constructing a class-balanced complete target domain training set.

[0035] The final model training and classification module trains the final target domain classification model based on the complete target domain training set, which is used to classify target domain images.

[0036] Furthermore, in the initial model training module,

[0037] The initial feature extraction network is a lightweight dual-branch network, including a spectral feature extraction branch, a spatial feature extraction branch, and a feature fusion module:

[0038] The spectral feature extraction branch is constructed by connecting a multi-granularity spectral attention module and a lightweight spectral Transformer with a grouped token learning mechanism, and is used to capture and optimize the global spectral context features of image pixels.

[0039] The spatial feature extraction branch is composed of a local-global pyramid module based on depthwise separable convolution, used to extract multi-scale spatial features of the image;

[0040] The feature fusion module is used to fuse global spectral context features and multi-scale spatial features.

[0041] Furthermore, the lightweight spectral Transformer employs a grouped token learning mechanism to reduce computational complexity, including:

[0042] The input spectral feature sequence is divided into multiple token groups; within each token group, the Top-K key tokens are selected by importance score; self-attention is only calculated between key tokens within each group to reduce computational complexity.

[0043] The local-global pyramid module comprises three branches in parallel to capture multi-scale spatial information, namely:

[0044] Local detail branch: Use a depthwise convolution branch with a small kernel to capture local details;

[0045] Large-scale context branch: Use branches with dilated convolutions to expand the receptive field to capture large-scale context;

[0046] Global context branching integrates global context information through pooling and upsampling branches;

[0047] Finally, the outputs of the three branches are merged.

[0048] A computer device system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method.

[0049] A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.

[0050] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the method described above.

[0051] Compared with existing technologies, the cross-domain image classification method and apparatus provided by this invention have the following significant advantages:

[0052] 1. High classification accuracy and robustness: Through a progressive optimization framework, high-quality samples are gradually selected and expanded within the target domain. Combined with a collaborative prototyping strategy to ensure class balance, the final trained model can learn semantically invariant features more purely and achieves higher classification accuracy (OA, AA, Kappa) and better stability on various cross-domain tasks.

[0053] 2. Avoids the drawbacks of complex adversarial training: This method does not rely on complex adversarial alignment modules that are prone to causing training instability and semantic distortion. Instead, it utilizes target domain information through explicit, interpretable multi-dimensional evaluation and prototype matching, resulting in a more stable training process and more reliable results.

[0054] 3. Lightweight and efficient: It adopts a lightweight dual-branch network design. The core modules are all based on efficient operators such as depthwise separable convolution and group attention. The number of parameters and computation is significantly lower than that of traditional deep models, which allows the method to start quickly with only a very small number of source domain annotations. This greatly reduces the annotation cost and deployment threshold, making it suitable for edge application scenarios with limited computing resources.

[0055] 4. Outstanding versatility and practical value: This invention proposes a universal cross-domain classification paradigm, not limited to specific sensors or data types. Successful verification through examples in cross-scene classification of hyperspectral images (such as farmland, urban areas, and coastal zones) demonstrates that this method can be effectively extended to various practical applications such as cross-regional monitoring of crop diseases, cross-port identification of ships in ports, and cross-temporal analysis of marine scenes, showing broad prospects for industrial application. Attached Figure Description

[0056] Figure 1 This is a schematic diagram of the overall process of the cross-domain image classification method provided in an embodiment of the present invention.

[0057] Figure 2 This is a schematic diagram of the lightweight dual-branch feature extraction network in an embodiment of the present invention. Detailed Implementation

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

[0059] Unless otherwise specified, the experimental methods used in the following examples are conventional methods. Unless otherwise specified, the materials, reagents, methods, and instruments used are all conventional materials, reagents, methods, and instruments in the art, and can be obtained commercially by those skilled in the art.

[0060] Example 1: As Figure 1 , 2 As shown, this embodiment provides a cross-domain image classification method, which includes the following steps:

[0061] Step S1: Obtain the source domain labeled dataset and the target domain unlabeled dataset.

[0062] In practical applications, the source domain and target domain are typically two scenes with similar semantic categories but different distributions. For example, in crop monitoring, the source domain might be a hyperspectral image of an experimental field, and the target domain might be an image of farmland in another region; in port ship identification, the source domain might be a visible light or SAR image of a port, and the target domain might be an image of another port. To verify the effectiveness of the method of this invention, this embodiment selects three classic hyperspectral image cross-scene datasets as specific application examples: the Houston dataset, the Pavia dataset, and the Hyrank dataset. Each dataset contains two different scenes (considered as the source domain and target domain) and shares some land cover categories.

[0063] Step S2: Train the initial lightweight two-branch feature extraction network and classifier: Based on the source domain labeled dataset, train an initial lightweight two-branch feature extraction network and classifier to obtain the initial classification model.

[0064] The training process is as follows: An initial classification model is trained based on the source domain labeled dataset. First, for each labeled pixel in the source domain, a three-dimensional hyperspectral data cube is constructed using its surrounding predefined spatial neighborhood (11*11) and full-band information as training samples, and enhancement strategies such as random flipping and amplitude scaling are employed. The samples are then batch-inputted into a lightweight dual-branch feature extraction network. This dual-branch structure captures spatial-spectral features from different receptive fields to balance fine spectral differences and spatial context information. During training, the cross-entropy loss function is used to supervise the error between the prediction and the true label, and the Adam optimizer is used to update the weights. Forward propagation extracts features layer by layer through cascaded lightweight convolutional modules, and the final output is a softmax classifier that outputs the class probability after global average pooling. Backpropagation minimizes the loss through gradient backpropagation. After a predefined number of iterations, the model parameters are saved when the validation set accuracy is stable or the loss converges, resulting in an initial classification model with basic cross-scene perception capabilities.

[0065] This step forms the basis for subsequent progressive optimization. The structure of the lightweight dual-branch feature extraction network is as follows: Figure 2 As shown, it consists of a spectral feature extraction branch, a spatial feature extraction branch, and a feature fusion module.

[0066] The spectral feature extraction branch sequentially passes through a multi-granularity spectral attention module and a lightweight spectral Transformer module. The MGSA module extracts local spectral features through parallel deep convolutions at different scales and combines them with channel attention to obtain global features, thus capturing multi-granularity spectral context information. The SLT module employs a grouped token learning mechanism, grouping spectral sequence tokens and calculating attention only between key tokens within the group. This significantly reduces the quadratic computational complexity of the standard Transformer (reducing the computational complexity from being correlated with the square of the sequence length to being linearly correlated), thereby efficiently modeling long-range spectral dependencies.

[0067] Spatial Feature Extraction Branch: Spatial features are extracted through the Local-Global Pyramid (LGPM) module. The LGPM module has three parallel branches: a local detail branch (3x3 depthwise convolution), a large-scale context branch (3x3 depthwise convolution with dilation), and a global context branch (global average pooling + depthwise convolution + upsampling) to capture multi-scale spatial information from local to global.

[0068] Feature fusion module: Aligns and fuses the features extracted from the two branches in the channel dimension to generate joint spectral-spatial features.

[0069] The above network is connected to a Softmax classifier and trained using source domain labeled data (e.g., a small number of samples randomly selected for each class) to obtain the initial classification model.

[0070] Step S3: Screening the first batch of high-confidence pseudo-label samples based on a multi-dimensional reliability assessment mechanism: Using the initial classification model to predict the target domain unlabeled dataset, and based on the multi-dimensional reliability assessment mechanism, screening the first batch of high-confidence pseudo-label samples to form the initial target domain sample set.

[0071] Based on multi-dimensional reliability assessment, the selection of samples is carried out by comprehensively calculating the classification confidence, feature similarity with the source domain category prototype, prediction uncertainty, and category balance factor based on the distribution of source domain samples, and then selecting samples according to the weighted comprehensive score.

[0072] This step aims to securely mine the first batch of reliable samples from the target domain. The multi-dimensional reliability assessment mechanism calculates a reliability score for each target domain sample from four complementary dimensions:

[0073] Classification confidence: The maximum softmax probability predicted by the model.

[0074] Feature similarity: The cosine similarity between a sample feature and the corresponding class prototype in the source domain (the mean of all sample features of that class in the source domain).

[0075] Prediction uncertainty: Information entropy based on the prediction probability distribution.

[0076] Category balance factor: Inverse class frequency weight, which encourages the discovery of minority class samples.

[0077] The four indicators mentioned above are normalized and weighted to obtain a comprehensive score. A high threshold is set, and samples with comprehensive scores higher than this threshold are selected and assigned pseudo-labels. For further purification, K-means clustering is performed on the pseudo-labeled samples of each category, eliminating clusters with low label consistency within each cluster. The centers of highly consistent clusters are then used to search for nearest neighbors among the unlabeled samples in the target domain to expand the dataset, thereby obtaining a higher-quality initial target domain sample set.

[0078] Step S4: Domain Invariance Enhancement Training and Cooperative Prototype Matching Completion: Merge the source domain labeled dataset with the initial target domain sample set, perform domain invariance enhancement training on the lightweight dual-branch feature extraction network, and supplement pseudo-label samples for the uncovered categories in the target domain based on the cooperative prototype matching strategy to construct a complete target domain training set with balanced categories.

[0079] like Figure 1 This step includes two core operations: feature enhancement and category completion.

[0080] Domain invariance enhancement training: The initial target domain sample set output by the multi-dimensional reliability evaluation step is merged with the source domain training samples and then input into a lightweight dual-branch network; using this lightweight dual-branch network as the main feature extraction body, domain invariance enhancement training is performed, and the domain invariance enhancement classification model is output after training is completed.

[0081] The merged data is used to train the feature extraction network, and a lightweight domain discriminator is introduced for adversarial training (implemented via a gradient inversion layer). The goal of the feature extractor is to generate features that confuse the domain discriminator, thereby facilitating the learning of domain-invariant features.

[0082] Collaborative prototype matching strategy: The remaining samples of the target domain, which are output synchronously through the multi-dimensional reliability assessment, are input into the domain invariance enhancement classification model; after model feature extraction, the collaborative prototype matching strategy completes the progressive sample completion of the empty categories not covered by the target domain, and finally outputs a class-balanced target domain training set.

[0083] After adversarial training, the domain invariance of the feature extractor is enhanced. At this point, for the "empty categories" in the target domain that are not yet covered by any pseudo-labels, a progressive completion strategy is executed:

[0084] (1) Prototype similarity matching: Calculate the cosine similarity between the features of the remaining samples in the target domain and the prototypes of each category in the source domain, and select samples with similarity exceeding the threshold for each empty category.

[0085] (2) High confidence prediction screening: For the empty categories that were not filled in the first stage, select the samples that were predicted as such by the initial classification model and whose confidence exceeded the threshold.

[0086] (3) Nearest neighbor conservative retrieval: For the “most difficult” category that is still not completed in the first two stages, directly calculate the Euclidean distance between the sample and the prototype of the source domain, and select the N samples with the smallest distance for each such empty category (N can be 1~3).

[0087] This strategy ensures that each semantic category obtains a certain number of pseudo-label samples in the target domain, forming a complete target domain training set with balanced categories.

[0088] Step S5: Train the final target domain classification model and perform classification: Based on the complete target domain training set, train the final target domain classification model to classify target domain images.

[0089] Using the complete target domain training set constructed in step S4, the feature extraction network and classifier are retrained. In this step, due to the high quality and balanced classes of the training set, and the good domain invariance of the features, a final classification model with strong generalization performance and high robustness in the target domain can be trained. Applying this model to the target domain test set achieves high-precision cross-domain image classification.

[0090] Example 2

[0091] To verify the effectiveness of the method of this invention, this embodiment provides specific experiments and analyses on three hyperspectral cross-scene datasets. This embodiment uses the classification model from Embodiment 1 above, along with other advanced models such as S2PST, MCUDA, LLURnet, ADNet, and S2AMSnet, to construct a cross-domain task on three hyperspectral datasets: Houston (2013 and 2018), Pavia (University and Center), and Hyrank (Dioni and Loukia). The source domain uses only a very small number of labeled samples (e.g., 5%) to train the initial model. The input image patch size is 11×11 pixels. The batch size is set to 32, the Adam optimizer is used, and the initial learning rate is set to 0.001. The initial lightweight dual-branch feature extraction network and classifier are trained for 30 epochs using randomly labeled samples from the source domain (SD), and finally trained for 15 epochs using all high-quality pseudo-labeled samples from the target domain (TD) to obtain the final classification model. Model training is performed on a computer equipped with an NVIDIA GPU. The classification performance of each method was measured using three of the most widely used quantitative metrics: overall accuracy (OA), average accuracy (AA), and Kappa coefficient (K). Ten independent experiments were conducted, and the average value was taken. The experimental results on the three datasets are shown in Tables 1-3.

[0092] Table 1. Comparison of classification accuracy and parameters on the Houston dataset (Houston 13→18)

[0093]

[0094] Table 2 Comparison of classification accuracy and parameters on the Pavia dataset (Pavia University→Center)

[0095]

[0096] Table 3 Comparison of classification accuracy and parameters on the Hyrank dataset (Dioni→Loukia)

[0097]

[0098] Experimental results show that the method of this invention significantly outperforms the comparative methods in terms of OA, AA, and Kappa coefficients across all cross-domain tasks, with a significant average improvement. This verifies the superiority of the progressive optimization framework and lightweight network design of this invention.

[0099] Example 3

[0100] This embodiment provides a cross-domain image classification device, which includes:

[0101] Acquisition module: Used to acquire the source domain labeled dataset and the target domain unlabeled dataset.

[0102] Initial model training module: used to build and train the lightweight dual-branch feature extraction network as described in Example 1 to obtain the initial classification model.

[0103] Sample extraction module: Used to predict the target domain unlabeled dataset using the initial classification model, and based on a multi-dimensional reliability assessment mechanism, to select the first batch of high-confidence pseudo-label samples to form the initial target domain sample set.

[0104] Feature enhancement and completion module: It is used to merge the source domain labeled dataset with the initial target domain sample set, perform domain invariance enhancement training, and supplement pseudo-label samples for the uncovered categories in the target domain based on the collaborative prototype matching strategy, so as to construct a class-balanced complete target domain training set.

[0105] Final model training and classification module: used to train the final target domain classification model based on the complete target domain training set, and to classify the target domain image through the target classification model.

[0106] Optionally, the device further includes a testing module for testing the classification performance of the target classification model using a target domain test set.

[0107] As can be seen from the above, the cross-domain image classification device provided in this embodiment extracts features through a lightweight dual-branch network and employs a progressive optimization strategy to gradually mine high-quality samples within the target domain. Simultaneously, it utilizes a collaborative prototype matching strategy to ensure class balance, thereby achieving efficient and robust cross-domain image classification. This device can be applied to various practical scenarios such as cross-regional monitoring of crops, cross-port identification of ships in ports, and cross-temporal analysis of marine scenes.

[0108] A computer device system includes a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above-described method.

[0109] A computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implement the steps of the above-described method.

[0110] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the method described above.

[0111] The memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the methods described in this invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0112] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired means such as coaxial cable, optical fiber, digital subscriber line, DSL, or wireless means such as infrared, wireless, microwave, etc. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium such as a floppy disk, hard disk, magnetic tape; an optical medium such as a high-density digital video disc, DVD; or a semiconductor medium such as a solid-state disk, SSD, etc.

[0113] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0114] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as execution by a hardware decoding processor, or as execution by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0115] The present invention provides a detailed description of a cross-domain image classification method and apparatus, and elucidates the principles and implementation methods of the invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A cross-domain image classification method, characterized in that: The method specifically includes the following steps: S1: Obtain the source domain labeled dataset and the target domain unlabeled dataset; S2: Based on a small number of samples from the source domain labeled dataset, train an initial feature extraction network and classifier to obtain an initial classification model; The initial feature extraction network is a lightweight dual-branch network, including a spectral feature extraction branch, a spatial feature extraction branch, and a feature fusion module: The spectral feature extraction branch is constructed by connecting a multi-granularity spectral attention module and a lightweight spectral Transformer with a grouped token learning mechanism, and is used to capture and optimize the global spectral context features of image pixels. The spatial feature extraction branch is composed of a local-global pyramid module based on depthwise separable convolution, used to extract multi-scale spatial features of the image; The feature fusion module is used to fuse global spectral context features and multi-scale spatial features; The lightweight spectral Transformer employs a grouped token learning mechanism to reduce computational complexity, including: The input spectral feature sequence is divided into multiple token groups; within each token group, the Top-K key tokens are selected by importance score; self-attention is only calculated between key tokens within each group to reduce computational complexity. The local-global pyramid module comprises three branches in parallel to capture multi-scale spatial information, namely: Local detail branch: Use a depthwise convolution branch with a small kernel to capture local details; Large-scale context branch: Use dilated convolution branches to expand the receptive field to capture large-scale context; Global context branching integrates global context information through pooling and upsampling branches; Finally, the outputs of the three branches are merged; S3: Use the initial classification model to predict the target domain unlabeled dataset, and based on multi-dimensional reliability assessment, select the first batch of high-confidence pseudo-label samples from the target domain unlabeled data to form the initial target domain sample set; S4: Combine the source domain labeled dataset with the initial target domain sample set, perform domain invariance enhancement training on the feature extraction network, and supplement pseudo-label samples for the uncovered categories in the target domain based on the collaborative prototype matching strategy to construct a complete target domain training set with balanced categories. In S4, the collaborative prototype matching strategy is specifically as follows: Calculate the source domain prototype of each category in the feature space, and the target domain prototype of each category of the pseudo-labeled samples obtained in the current target domain. For uncovered empty categories in the target domain, perform a three-stage sequential completion process: Phase 1: Calculate the similarity between the remaining samples in the target domain and the corresponding prototype in the source domain, and select the target domain samples whose similarity to the prototype in the source domain exceeds the first threshold. Second stage: For categories not completed in the first stage, select target domain samples that the model predicts as belonging to that category and whose confidence level exceeds the second threshold; The third stage: For categories that are still not complete in the first two stages, select several target domain samples that are closest to the corresponding source domain prototype Euclidean. S5: Based on the complete target domain training set, the final target domain classification model is trained and used to classify target domain images.

2. The method according to claim 1, characterized in that: In S3, the multi-dimensional reliability assessment specifically includes: Four reliability metrics are calculated for each target domain sample: classification confidence, feature similarity to the source domain class prototype, prediction uncertainty, and class balance factor based on the distribution of source domain samples. The four reliability indicators are weighted and summed to obtain the comprehensive reliability score; Based on the comprehensive reliability score, a progressive threshold strategy is used to select the first batch of high-confidence pseudo-label samples.

3. The method according to claim 2, characterized in that: In S3, After selecting the first batch of high-confidence pseudo-label samples, cluster-based sample purification and expansion are performed, specifically as follows: Cluster analysis is performed on the selected pseudo-label samples of each category; clusters with label consistency below a preset threshold are removed to purify the pseudo-label sample set; and neighboring samples are expanded using the center of a highly consistent cluster as the anchor point.

4. A cross-domain image classification device, characterized in that: The apparatus is used to perform the cross-domain image classification method according to any one of claims 1 to 3; The image classification device includes a data acquisition module, an initial model training module, a sample extraction module, a feature enhancement and completion module, and a final model training and classification module; The data acquisition module is used to acquire the source domain labeled dataset and the target domain unlabeled dataset; The initial model training module trains an initial feature extraction network and a classifier based on a small number of samples from the source domain labeled dataset to obtain an initial classification model. The sample extraction module uses the initial classification model to predict the target domain unlabeled dataset, and based on multi-dimensional reliability assessment, selects the first batch of high-confidence pseudo-label samples from the target domain unlabeled data to form the initial target domain sample set. The feature enhancement and completion module merges the source domain labeled dataset with the initial target domain sample set, performs domain invariance enhancement training on the feature extraction network, and supplements pseudo-label samples for the uncovered categories in the target domain based on the collaborative prototype matching strategy, thereby constructing a class-balanced complete target domain training set. The final model training and classification module trains the final target domain classification model based on the complete target domain training set, which is used to classify target domain images.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 3.

6. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 3.

7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 3.