Target detection domain adaptation methods, devices, storage media and computer program products

By constructing a simulation environment in the target detection domain adaptation and using an average teacher adversarial domain adaptation baseline model, combined with target category contrastive learning, the problems of data imbalance and fuzzy classification boundaries are solved, and better target detection domain adaptation results are achieved.

CN119559375BActive Publication Date: 2025-11-14SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411532282.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-11-14
Estimated Expiration
2044-10-30

AI Technical Summary

Technical Problem

Existing technologies suffer from data imbalance and fuzzy classification boundaries in the adaptation of target detection domains, which prevents the model from classifying correctly.

Method used

By constructing a simulation environment to collect labeled source domain data, and utilizing the average teacher adversarial domain adaptation baseline model and target category contrastive learning, combined with contrastive loss in four directions and imbalanced contrastive loss, the problem of data imbalance is solved, and target detection domain adaptation is achieved.

Benefits of technology

In cases of data imbalance, it effectively solves the problem of fuzzy classification boundaries and improves the adaptability of the target detection domain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119559375B_ABST
    Figure CN119559375B_ABST
Patent Text Reader

Abstract

This application discloses a method, device, storage medium, and computer program product for object detection domain adaptation, relating to the field of computer vision technology. The method includes: constructing a simulation environment based on a pre-built engine; automatically labeling and collecting source domain data from the simulation environment according to a specific data acquisition algorithm; acquiring target domain data collected from the real environment; inputting the source domain data and the target domain data into a pre-built average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels; and using target category contrastive learning to adapt the image-level features and the target domain pseudo-labels to the object detection domain. Through target category contrastive learning, data imbalance and fuzzy classification boundaries are avoided, resulting in better object detection domain adaptation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision technology, and in particular to object detection domain adaptation methods, devices, storage media, and computer program products. Background Technology

[0002] Unsupervised object detection domain adaptation is a task that adapts a model trained in the source domain to the target domain when there is a significant difference in data distribution between the source and target domains, without relying on labeled data in the target domain. Adaptation is achieved by aligning the data features between the source and target domains to make their features more similar. However, aligning image-level and instance-level features between the source and target domains through adversarial training of the discriminator, forcibly bringing the features of the source and target domains closer together, can create blurred classification boundaries, leading to misclassification. In extreme cases, it may even render all instance features indistinguishable, resulting in inability to classify correctly. Furthermore, this method of aligning image-level and instance-level features between the source and target domains through adversarial training of the discriminator is also affected by data imbalance between the source and target domains, which can severely impact the adaptation process.

[0003] Therefore, how to avoid data imbalance and the generation of fuzzy classification boundaries, and better adapt to the target detection domain, has become an urgent problem to be solved in this application.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this application is to provide a method, apparatus, storage medium, and computer program product for object detection domain adaptation, which aims to solve the technical problem of how to avoid data imbalance and generate fuzzy classification boundaries, and to better perform object detection domain adaptation.

[0006] To achieve the above objectives, this application proposes a target detection domain adaptation method, the method comprising:

[0007] A simulation environment is built based on a pre-built engine;

[0008] Source domain data is automatically labeled and collected from the simulation environment according to a specific data acquisition algorithm;

[0009] Acquire target domain data collected from a real-world environment;

[0010] The source domain data and the target domain data are input into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels.

[0011] Target detection domain adaptation is performed using target category contrastive learning on the image-level features and the target domain pseudo-labels.

[0012] In one embodiment, the step of inputting the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels further includes:

[0013] Obtain student and teacher models;

[0014] Weights are shared among the student models and among the teacher models;

[0015] An average teacher adversarial domain adaptation baseline model is constructed using a weighted student model and a weighted teacher model.

[0016] In one embodiment, the average teacher adversarial domain adaptation baseline model includes one or more of a first teacher model, a second teacher model, a first student model, and a second student model. The step of inputting the source domain data and the target domain data into the pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels includes:

[0017] Weak enhancement processing and strong enhancement processing are performed on the source domain data respectively;

[0018] The source domain data after weak enhancement is input into the first teacher model to obtain the first source domain image-level features and source domain labels.

[0019] The source domain data after strong enhancement is input into the first student model to obtain the second source domain image-level features;

[0020] Weak enhancement and strong enhancement processing are performed on the target domain data respectively;

[0021] The target domain data after weak enhancement is input into the second teacher model to obtain the first target domain image-level features and the target domain pseudo-labels.

[0022] The target domain data after strong enhancement is input into the second student model to obtain the image-level features of the second target domain.

[0023] Image-level features are constructed based on the first source domain image-level features, the second source domain image-level features, the first target domain image-level features, and the second target domain image-level features.

[0024] In one embodiment, after the step of inputting the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, the method further includes:

[0025] The image-level features are aligned using a domain discriminant.

[0026] The target domain pseudo-labels are used as supervision signals to supervise the second student model;

[0027] The source domain labels are used as supervisory signals to supervise the first student model;

[0028] The detector loss is minimized using the supervision signals from the second student model, the supervision signals from the first student model, and the image-level features after feature alignment.

[0029] In one embodiment, the target category contrastive learning includes: intra-domain and inter-domain contrastive loss, and imbalanced contrastive loss. The step of using target category contrastive learning to adapt the image-level features and the target domain pseudo-labels for target detection domain adaptation includes:

[0030] Extract target region features based on the image-level features and the target domain pseudo-labels;

[0031] By projecting the features of the target region onto the classification contrastive learning latent space, and performing inter-domain and intra-domain contrastive loss, the contrastive loss value is obtained.

[0032] Calculate the unbalanced contrast loss value based on the contrast loss value;

[0033] The target detection domain is adapted by combining the contrastive loss value and the imbalanced contrastive loss value. In one embodiment, the target region features include one or more of the following: a strong enhancement source domain, a weak enhancement source domain, a weak enhancement target domain, and a strong enhancement target domain. The step of obtaining the contrastive loss value by projecting the target region features onto the classification contrastive learning latent space and performing inter-domain and intra-domain contrastive loss includes:

[0034] The features of the target region are projected into a classification and contrast learning latent space;

[0035] Define the strong enhancement source domain and the strong enhancement target domain as query samples;

[0036] The weak enhancement source domain and the weak enhancement target domain are defined as key samples;

[0037] The key samples are stored in a class equilibrium momentum dictionary;

[0038] Using the query sample as the anchor point, the intra-domain and inter-domain contrast loss is applied to the target region features in conjunction with the class equilibrium momentum dictionary.

[0039] In one embodiment, the step of calculating the unbalanced contrast loss value based on the contrast loss value includes:

[0040] Count the number of instances in the domain class pair to which the anchor point belongs;

[0041] Based on the number of instances, class imbalance coefficients and domain imbalance coefficients are introduced;

[0042] The contrast loss value is re-weighted and calculated based on the category imbalance coefficient and the domain imbalance coefficient to obtain the imbalanced contrast loss value.

[0043] In addition, to achieve the above objectives, this application also proposes a target detection domain adaptation device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the target detection domain adaptation method as described above.

[0044] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the target detection domain adaptation method as described above.

[0045] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the target detection domain adaptation method as described above.

[0046] One or more technical solutions proposed in this application have at least the following technical effects:

[0047] A pre-built simulation environment for a specific scenario is constructed using a pre-built engine. A large amount of labeled source domain data is collected from this environment using a specific data acquisition algorithm. After collecting a large amount of labeled source domain data from the simulation environment, a certain amount of unlabeled target domain data is collected from the real environment. An adversarial training approach is employed, inputting the source and target domain data into a pre-built average teacher adversarial domain adaptation baseline model for processing, resulting in image-level features and target domain pseudo-labels. Target category contrastive learning includes contrastive losses in four directions and an imbalanced contrastive loss proposed to address data imbalance. By performing target category contrastive learning on image-level features and target domain pseudo-labels, the problem of blurred classification boundaries arising during adversarial domain adaptation is solved, avoiding data imbalance and the generation of blurred classification boundaries, thereby better achieving target detection domain adaptation. Attached Figure Description

[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a flowchart illustrating the first embodiment of the target detection domain adaptation method of this application.

[0051] Figure 2 This is a schematic diagram of an elevator simulation environment built using Unity3D.

[0052] Figure 3 This is a pseudocode diagram of a specific data acquisition algorithm used in an elevator button detection task.

[0053] Figure 4 This is a flowchart of the second embodiment of the target detection domain adaptation method of this application;

[0054] Figure 5 This is an overall schematic diagram of the target detection domain adaptation method of this application;

[0055] Figure 6 This is a schematic flowchart of the fourth embodiment of the target detection domain adaptation method of this application;

[0056] Figure 7 This is a schematic diagram of the module structure of the target detection domain adaptation device according to an embodiment of this application;

[0057] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the target detection domain adaptation method in the embodiments of this application.

[0058] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0059] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0060] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0061] This application's embodiments take into account that: Since unsupervised object detection domain adaptation tasks involve adapting a model trained in the source domain to the target domain directly, without relying on labeled data in the target domain, when there is a significant difference in data distribution between the source and target domains. While image-level and instance-level features between the source and target domains are aligned through adversarial training of the discriminator to complete the adaptation task, directly aligning these features and forcibly bringing them closer together can create blurred classification boundaries, leading to incorrect classifications. In extreme cases, it may even render all instance features indistinguishable, resulting in inability to classify correctly. Furthermore, since there is often a significant data imbalance between the source and target domains, the process of aligning image-level and instance-level features to achieve object detection domain adaptation is affected by this imbalance, severely impacting the adaptation process.

[0062] Therefore, this application provides a solution that uses a pre-defined building engine to construct a simulation environment for a specific scenario, and collects a large amount of labeled source domain data from the simulation environment according to a specific data acquisition algorithm. After collecting a large amount of labeled source domain data through the simulation environment, a certain amount of unlabeled target domain data is then collected from the real environment. An adversarial training approach is adopted, inputting the source domain data and target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing. Cross-domain invariant features are learned by aligning the image-level features between the source and target domains of the student model in the average teacher adversarial domain adaptation baseline model. After processing by the pre-constructed average teacher adversarial domain adaptation baseline model, image-level features and target domain pseudo-labels are obtained. Target category contrastive learning includes contrastive losses in four directions and an imbalanced contrastive loss proposed to address data imbalance. By performing target category contrastive learning on image-level features and target domain pseudo-labels, the problem of blurred classification boundaries arising during adversarial domain adaptation is solved on the basis of data imbalance, thereby achieving target detection domain adaptation.

[0063] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions. This application uses the elevator button detection task in a real-world elevator mobile robot project as an example to detail the implementation process of target detection domain adaptation according to the target detection domain adaptation method proposed in this application.

[0064] Based on this, embodiments of this application provide a target detection domain adaptation method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the target detection domain adaptation method of this application.

[0065] In this embodiment, the target detection domain adaptation method includes steps S10 to S50:

[0066] Step S10: Build a simulation environment based on the pre-built engine;

[0067] The pre-built engine is Unity3D. As a mainstream game development engine, Unity3D is widely used in the development of virtual reality and augmented reality applications due to its powerful virtual simulation capabilities. Unity3D is developed using the C# language and has powerful and realistic virtual scenes and interactive experience tools and functions that can help developers build simulation environments.

[0068] Use Unity3D's terrain editor to create terrain and build a basic simulation environment. Further, add environment elements to this basic simulation environment using Unity3D to simulate a realistic environment. Add rigid bodies and colliders (such as Box Collider and Mesh Collider) to the elements in the simulation environment to simulate physical interactions, achieving a high degree of realism.

[0069] Step S20: Automatically label and collect source domain data from the simulation environment according to a specific data acquisition algorithm;

[0070] Taking the elevator button detection task in a real-world elevator mobile robot project as an example, such as Figure 2 As shown, Figure 2 This is a schematic diagram of an elevator simulation environment built using Unity3D. Based on the layout and button styles of elevator panels in a real-world environment, a simulation panel corresponding to the real environment can be easily constructed using Unity3D. Each button on the panel is an independent control, and its position can be obtained in real time for automatic labeling. The camera can capture each frame of the image to compose the collected data.

[0071] like Figure 3 As shown, Figure 3 This is a pseudocode illustration of a specific data acquisition algorithm used in an elevator button detection task. The algorithm moves the camera position according to the algorithm's parameters. Taking the elevator button detection task in a real-world elevator mobile robot project as an example, the camera moves in a zigzag pattern on the XOY plane, while randomly changing the camera height and rotating it within a certain range to ensure that it can capture images of the elevator panel from various angles. The lighting system can provide different lighting conditions. Furthermore, the button number styles and colors can be randomly changed to generate more diverse data.

[0072] Furthermore, since the C# language automates the processes of building simulation environments and automatically labeling and collecting source domain data from simulation environments according to specific data acquisition algorithms, different types of simulation environments can be quickly built by modifying the configuration files in the Unity3D engine, and source domain data can be automatically labeled and collected from different simulation environments according to specific data acquisition algorithms.

[0073] Step S30: Obtain target domain data collected from the real environment;

[0074] The source domain data is large-scale labeled data, while the target domain data is small-scale unlabeled target domain data. Target domain data can be collected directly from the real environment using devices such as cameras, depth cameras, and infrared sensors. Alternatively, publicly available datasets on the internet, such as ImageNet, COCO, and Kitt, can be used to obtain target domain data that meets the requirements.

[0075] Step S40: Input the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels;

[0076] The Average Teacher Adversarial Domain Adaptation Baseline Model (ATBA / BAB) is a deep learning model designed to address the domain adaptation problem. It combines adversarial training and consistency regularization to improve the model's generalization ability across the target domain, enabling it to perform unsupervised object detection domain adaptation tasks and achieve domain adaptation for object detection.

[0077] The average teacher-adversarial adaptation baseline model extracts features from source and target domain data respectively, uses a pre-discriminator for adversarial training, and obtains image-level features and target domain pseudo-labels. Based on the obtained image-level features and target domain pseudo-labels, the feature distribution difference between the source and target domains is minimized, so that even when the target domain data is unlabeled, the model in the source domain can still have good classification performance in the target domain.

[0078] Step S50: Use target category contrastive learning to adapt the target detection domain to the image-level features and the target domain pseudo-labels.

[0079] Target class contrastive learning includes four contrastive losses and an improved imbalanced contrastive loss designed to address the data imbalance problem. It incorporates intra-domain and inter-domain target class contrastive learning to resolve the fuzzy classification boundary issue arising during adversarial domain adaptation. Furthermore, to address the data imbalance problem, an imbalanced contrastive loss is proposed. During training, the contrastive loss is dynamically weighted using the number of instances of each class in both the source and target domains, ensuring that the model in the source domain can adapt well to the target domain even with imbalanced data.

[0080] By performing target category comparison learning on image-level features and target domain pseudo-labels, the relevant models existing in the source domain can maintain good detection performance in the target domain, thus achieving adaptation to the target detection domain.

[0081] This embodiment provides a target detection domain adaptation method. A simulation environment for a specific scenario is constructed using a pre-defined engine. A large amount of labeled source domain data is collected from this simulation environment using a specific data acquisition algorithm. After collecting a large amount of labeled source domain data from the simulation environment, a certain amount of unlabeled target domain data is collected from the real environment. An adversarial training approach is employed, inputting the source domain data and target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing, resulting in image-level features and target domain pseudo-labels. Target category contrastive learning includes contrastive losses in four directions and an imbalanced contrastive loss proposed to address data imbalance. By performing target category contrastive learning on image-level features and target domain pseudo-labels, the method resolves the fuzzy classification boundary problem arising during adversarial domain adaptation despite data imbalance, thereby achieving target detection domain adaptation.

[0082] Based on the first embodiment of this application, a second embodiment of this application is proposed. In the second embodiment of this application, content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter.

[0083] Based on this, please refer to Figure 4 , Figure 4 This is a flowchart of the second embodiment of the target detection domain adaptation method of this application.

[0084] In this embodiment, before step S40, which involves inputting the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, steps S341 to S343 are also included:

[0085] Step S341: Obtain the student model and the teacher model;

[0086] The student and teacher models are existing, trained models. The weights and architectures of the teacher and student models are preserved, such as... Figure 5 As shown, Figure 5 This is an overall schematic diagram of the target detection domain adaptation method in this application. The overall structure of the average teacher adversarial domain adaptation baseline model applied in this application includes two weight-shared student models and two weight-shared teacher models. The two weight-shared student models or teacher models are used to extract features from the source domain and the target domain, respectively.

[0087] Step S342: Weight sharing is performed between the student models and weight sharing is performed between the teacher models;

[0088] The two student models and the two teacher models share weights. The student and teacher models have the same structure but different weight parameters. The student model focuses on exploration capabilities, using gradient descent to update its parameters to minimize detector loss. The teacher model, on the other hand, updates slowly using momentum based on the student model's parameters, resulting in a more stable and robust model.

[0089] Step S343: Construct an average teacher adversarial domain adaptation baseline model using a weight-shared student model and a weight-shared teacher model.

[0090] The student model is used to explore and learn feature representations of diverse data, while the teacher model focuses more on stability and applicability to generate reliable pseudo-labels for the target domain. Therefore, the average teacher adversarial domain adaptation baseline model proposed in this application includes two weight-shared student models and two weight-shared teacher models, which are used to extract features from the source domain and the target domain, respectively.

[0091] In this embodiment, an average teacher adversarial domain adaptation baseline model is constructed using two student models with shared weights and two teacher models with shared weights. The student models emphasize the model's exploratory capabilities, using gradient descent to update model parameters to minimize detector loss. The teacher models, on the other hand, are updated slowly using momentum updates based on the student models' parameters. This results in a more stable and robust model, enabling the average teacher adversarial domain adaptation baseline model to generate target domain pseudo-labels with stable test performance. Furthermore, it aligns image-level features between the source and target domains of the student network to learn cross-domain invariant features, while minimizing boundary ambiguity issues arising during target detection domain adaptation.

[0092] Based on the first and / or second embodiments of this application, a third embodiment of this application is proposed. In the third embodiment of this application, content that is the same as or similar to that in embodiments one and two described above can be referred to the above description and will not be repeated hereafter.

[0093] In this embodiment, it will be combined with Figure 5 Taking the elevator button detection task in a real-world elevator mobile robot project as an example, step S40, which involves inputting the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, may include steps S401 to S407:

[0094] Step S401: Perform weak enhancement processing and strong enhancement processing on the source domain data respectively;

[0095] Since student models are used to explore and learn feature representations of diverse data, teacher models place greater emphasis on stability and applicability to produce reliable pseudo-labels for the target domain. To maximize the performance of the average teacher-adversarial adaptation baseline model, such as... Figure 5 As shown, weak enhancement and strong enhancement processing are performed on the source domain data and the target domain data, respectively. Strong enhancement includes image blurring and random erasure, while weak enhancement includes image flipping and color change.

[0096] Step S402: Input the source domain data after weak enhancement processing into the first teacher model to obtain the first source domain image-level features and source domain labels;

[0097] The source domain data, after weak enhancement processing, is input into the first teacher model. First Teacher Model Features of the source domain data are extracted to obtain the source domain labels and image-level features of the source domain data after weak enhancement processing.

[0098] Step S403: Input the source domain data after strong enhancement processing into the first student model to obtain the second source domain image-level features;

[0099] The source domain data after strong enhancement is input into the first student model f. The first student model f learns the diverse feature representation capabilities of the source domain data after strong enhancement and obtains the second source domain image-level features.

[0100] Step S404: Perform weak enhancement processing and strong enhancement processing on the target domain data respectively;

[0101] Weak enhancement and strong enhancement are performed on the target domain data respectively. Strong enhancement includes image enhancement operations such as image blurring and random erasure, while weak enhancement includes image enhancement operations such as image flipping and color change.

[0102] Step S405: Input the target domain data after weak enhancement processing into the second teacher model to obtain the first target domain image-level features and target domain pseudo-labels;

[0103] like Figure 5 As shown, the target domain data after weak augmentation is input into the second teacher model. Second Teacher Model It receives weakly enhanced images as input to obtain stable test performance and generate target domain pseudo-labels and first target domain image-level features.

[0104] Step S406: Input the target domain data after strong enhancement processing into the second student model to obtain the second target domain image-level features;

[0105] The target domain data after strong enhancement is input into the second student model f. The second student model f learns the diverse feature representation capabilities of the target domain data after strong enhancement, and obtains the image-level features of the second target domain.

[0106] Step S407: Construct image-level features based on the first source domain image-level features, the second source domain image-level features, the first target domain image-level features, and the second target domain image-level features.

[0107] Image-level features are constructed based on the first source domain image-level features, the second source domain image-level features, the first target domain image-level features, and the second target domain image-level features.

[0108] In this embodiment, the student model receives strongly enhanced images as input to learn the ability to represent diverse features in the data, while the teacher model receives weakly enhanced images as input to achieve stable test performance and generate pseudo-labels for the target domain. The adversarial training approach learns cross-domain invariant features by aligning image-level features between the source and target domains of the student network with the average teacher adversarial domain adaptation baseline model.

[0109] Based on the above embodiments of this application, a fourth embodiment of this application is proposed. In the fourth embodiment of this application, the same or similar contents as those in the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0110] Based on this, please refer to Figure 6 , Figure 6 This is a schematic flowchart of the fourth embodiment of the target detection domain adaptation method proposed in this application.

[0111] In this embodiment, after step S40, in which the source domain data and the target domain data are input into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, steps S1 to S4 are further included:

[0112] Step S1: Use a domain discriminator to perform feature alignment on the image-level features;

[0113] The domain discriminator distinguishes whether the features extracted by the feature extractor come from the source domain or the target domain. During adversarial training using the average teacher adversarial domain adaptation baseline model, the output of the domain discriminator is used to guide the feature extractor to learn domain-invariant features.

[0114] The domain discriminator distinguishes the image-level features extracted from the source and target domain data. The domain discriminator prompts the feature extractor to generate features that are difficult to distinguish between the source and target domains, thereby achieving feature alignment.

[0115] Step S2: Use the target domain pseudo-label as a supervision signal to supervise the second student model;

[0116] Since the student model or teacher model, which shares weights, is used to extract features from the source and target domains respectively, the student and teacher models have the same model structure but different weight parameters. The student model focuses on the model's exploratory ability, while the teacher model updates slowly using momentum updates based on the student model's parameters, thus obtaining a more stable and robust model. Therefore, the target domain pseudo-labels and source domain labels generated by the more stable teacher model can serve as supervisory signals to supervise the student model.

[0117] like Figure 5 As shown, the target domain pseudo-label is used as the supervision signal for the supervised second student model.

[0118] Step S3: Use the source domain label as a supervision signal to supervise the first student model;

[0119] like Figure 5 As shown, the source domain tag, i.e. Figure 5 The ground-based real data shown serves as the supervisory signal for the first student model.

[0120] It's important to note that in the field of Virtual-to-Real Transfer, the term "Ground Truth" refers to accurate and reliable data or information in the target domain (usually the real world). Ground truth data serves as a reference standard for measuring model performance; it is considered the closest to reality and is indispensable.

[0121] Step S4: Minimize the detector loss using the supervision signal of the second student model, the supervision signal of the first student model, and the image-level features after feature alignment.

[0122] The student and teacher models have the same model structure but different weight parameters. The student model focuses on the model's exploratory ability and uses gradient descent to update the model parameters to minimize the detector loss, while the teacher model uses momentum updates based on the student model's parameters to slowly update them, thereby obtaining a more stable and robust model.

[0123] The student model updates the model parameters using gradient descent to minimize the detector loss, and further minimizes the detector loss by combining the supervision signal and image-level features after feature alignment.

[0124] In this embodiment, a domain discriminator is used to align image-level features, minimizing the data difference between the source and target domains, so that the model in the source domain can adapt well to the target domain. Based on the supervision signal and the image-level features after feature alignment, the detector loss is minimized, thereby improving the performance of the model in the source domain in the unsupervised target detection domain adaptation task.

[0125] Based on the above embodiments of this application, a fifth embodiment of this application is proposed. Content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0126] In this embodiment, step S50, which uses target category contrastive learning to adapt the image-level features and the target domain pseudo-labels to the target detection domain, may include steps S501 to S504:

[0127] Step S501: Extract target region features based on the image-level features and the target domain pseudo-labels; obtain four image-level features from two student models and two teacher models; use ROI Align to extract ROI features of the source domain and target domain respectively using the source domain labels and the target domain pseudo-labels generated by the teacher models; ROI features are target region features; and align the ROI features to a uniform size to obtain four types of ROI features: strongly enhanced source domain, weakly enhanced source domain, weakly enhanced target domain, and strongly enhanced target domain.

[0128] Step S502: By projecting the features of the target region onto the classification contrast learning latent space, inter-domain and intra-domain contrast loss is performed to obtain the contrast loss value.

[0129] By calculating inter-domain and intra-domain contrast losses, the problem of blurred classification boundaries arising during adversarial domain adaptation is addressed. An MLP projection layer is used to project ROI features onto a latent space for target classification contrastive learning. Inter-domain and intra-domain contrast losses are calculated based on target region features, specifically between strong and weak enhancement source domains, between weak and strong enhancement target domains, between strong and strong enhancement source domains, and between weak and weak enhancement source domains.

[0130] It should be noted that the MLP is a non-linear projection layer, consisting of two fully connected layers and a non-linear activation function. Both the MLP layer and the backbone network are updated using the average teacher paradigm.

[0131] Specifically, in one feasible implementation, step S502, which involves projecting the target region features onto a classification contrastive learning latent space and performing inter-domain and intra-domain contrastive loss to obtain the contrastive loss value, may include steps A1 to A5:

[0132] Step A1: Project the features of the target region into the classification and contrast learning latent space;

[0133] The ROI features are projected into a latent space for object classification and contrastive learning using an MLP projection layer.

[0134] Step A2: Define the strong enhancement source domain and the strong enhancement target domain as query samples;

[0135] To construct the comparison pair, the latent features of the strongly enhanced source and target domains are defined as query sample q.

[0136] Step A3: Define the weak enhancement source domain and the weak enhancement target domain as key samples;

[0137] The latent features of the weakly enhanced source and target domains are defined as key samples k.

[0138] Step A4: Store the key samples in a class equilibrium momentum dictionary;

[0139] We propose a class of equilibrium momentum dictionary to store historical key samples to build a large number of contrast pairs without relying on the size of mini-batch, similar to the momentum queue in unsupervised contrastive learning MOCO.

[0140] Step A5: Using the query sample as the anchor point, perform intra-domain and inter-domain contrast loss on the target region features in conjunction with the class equilibrium momentum dictionary;

[0141] In target class contrastive learning, the query sample is used as an anchor. The goal of target class contrastive learning is to bring the anchor closer to key samples (positive samples) of the same class, while moving away from key samples (negative samples) of different classes.

[0142] For each category, the momentum dictionary maintains a queue of equal size, where key samples are stored according to a first-in, first-out (FIFO) rule. The momentum dictionary provides not only a rich set of negative samples but also a rich set of positive samples.

[0143] like Figure 5As shown, the target category contrastive learning considers different combinations of anchor points and momentum dictionaries, including four types of contrastive losses: intra-domain and inter-domain. Intra-domain includes source-to-source and target-to-target, while inter-domain includes source-to-target and target-to-source, namely, contrastive loss between strong and weak augmented source domains, contrastive loss between weak and strong augmented target domains, contrastive loss between strong and strong augmented target domains, and contrastive loss between weak and weak augmented source domains.

[0144] The contrast loss L from the source domain to the target domain c st Taking this as an example, the specific calculation process of the contrast loss will be explained in detail. The contrast loss L from the source domain to the target domain... c st The calculation formula is as follows:

[0145]

[0146] Where q i A specific query sample within a mini-batch serves as an anchor point in comparative learning. and These represent the unbalanced momentum dictionary M. t Regarding anchor point q i The algorithm considers both positive and negative samples. `sim` is a distance metric function, calculated using the inner product (i.e., cosine similarity). `tau` is a temperature coefficient, where the symbol `T` represents the exponential similarity between the anchor point and positive samples, and the denominator represents the sum of the exponential similarities between the anchor point and positive samples, as well as all negative samples. `tau` guides the anchor point closer to positive samples and further away from all negative samples.

[0147] For the contrast loss calculation in other directions, refer to the contrast loss L from the source domain to the target domain. c st The calculation formula, with q in the formula s and M t The comparison loss calculation for the other directions can be completed by replacing the subscript with the corresponding field.

[0148] In this implementation, target category contrastive learning considers different combinations of anchor points and momentum dictionaries, encompassing four contrastive losses: intra-domain (source-to-source and target-to-target) and inter-domain (source-to-target and target-to-source). Intra-domain and inter-domain target category contrastive learning addresses the problem of fuzzy classification boundaries arising during adversarial domain adaptation.

[0149] The above is only one possible implementation of step S502 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S502.

[0150] Step S503: Calculate the unbalanced contrast loss value based on the contrast loss value;

[0151] Virtual-to-real transfer tasks and real-world object detection datasets often suffer from severe data imbalance, including class and domain imbalance. In object class contrastive learning, ROI features are extracted based on actual labels or pseudo-labels; therefore, the data distribution in the source and target domains directly affects the distribution of ROI features, and consequently, the contrastive loss.

[0152] To address the imbalanced contrast loss and consider both class and domain imbalance, as well as to better count the number of instances in each class within each domain, the concept of domain-class pairs is proposed. A domain-class pair can be represented as a two-dimensional tuple (domain, class), representing the set of all samples from the same domain and class. Each query sample and key sample can find a unique (domain, class) pair, and n(.) is used to represent the number of instances in the domain-class pair of the specified query sample or key sample.

[0153] Specifically, in one feasible implementation, step S503, which calculates the unbalanced contrast loss based on the contrast loss value to adapt to the target detection domain, may include steps A6 to A8:

[0154] Step A6: Count the number of instances in the domain class pair to which the anchor point belongs;

[0155] Since data imbalance includes both class imbalance and domain imbalance, in order to perform object detection domain adaptation tasks even with imbalanced data, it is necessary to address the issues of class imbalance and domain imbalance.

[0156] It's important to note that class imbalance refers to the uneven distribution of classes within a single domain. This type of imbalance is very common in real-world datasets. For example, in the training set of the public dataset Cityscapes, the "person" class has 17,994 instances, while the "train" class only has 171 instances. This can cause the model to favor learning features from classes with more instances, while neglecting those with fewer instances. Therefore, this application addresses class imbalance by weighting the contrastive loss of each anchor point in the (domain, class) pair according to the number of instances it belongs to. This allows the model to prioritize the transfer of features from classes with fewer instances during the learning process.

[0157] Additionally, it's important to note that domain imbalance refers to a significant difference in the amount of data between the source and target domains. In virtual-to-real-world domain adaptation tasks, there is typically a large amount of labeled virtual data, while considering the costs of data collection and labeling, only a small amount of real data is unlabeled. For example, in the publicly available BDD100k dataset, the source domain "daytime" contains 36,728 images, while the target domain "dawn / dusk" contains only 5,027 images. In fact, many real-world domain adaptation tasks involve adapting large-scale datasets to small-scale datasets, and this domain imbalance can severely impact model performance. Due to the uncertainty of pseudo-labels, the number of (domain, class) pairs in the target domain is dynamically changing. Therefore, this application uses the ratio of the number of positive samples at an anchor point to the number of class pairs within the anchor point itself to weight the contrastive loss of a single anchor point. This allows the model to prioritize knowledge transfer from domains with fewer classes to domains with more classes when performing class semantic alignment, thereby addressing domain imbalance.

[0158] Step A7: Introduce class imbalance coefficient and domain imbalance coefficient based on the number of instances;

[0159] A class imbalance coefficient, denoted as w, is introduced based on the number of instances. c This is used for reweighted comparison loss, specifically expressed as follows:

[0160]

[0161] Here, ε (=0.999) is a hyperparameter. n(q) i ) represents the anchor point q i The number of instances of the (domain, class) pair to which it belongs. c To mitigate class imbalance, a larger weight is assigned to a minority of categories.

[0162] A domain imbalance coefficient, w, is introduced based on the number of instances. d This indicates that the reweighted comparison loss is used, and is specifically expressed as follows:

[0163]

[0164] Domain imbalance coefficients are applicable to target class contrast loss between domains. and Because the query anchor point q i and its positive samples From different domains. When applied to intra-domain contrastive loss. and At that time, due to q i and If the categories are the same and the domains are also the same, meaning they come from the same (domain, class) pair, then w dIt degenerates, and its value becomes 1.

[0165] Step A8: The contrast loss value is re-weighted and recalculated based on the category imbalance coefficient and the domain imbalance coefficient to adapt to the target detection domain.

[0166] After introducing class imbalance coefficients and domain imbalance coefficients, the contrast loss L from the source domain to the target domain is used. c st For example, the contrast loss L from the source domain to the target domain c st The calculation formula is converted into the following form:

[0167]

[0168] Among them, w c w is the class imbalance coefficient. d Let L be the domain imbalance coefficient, S be the sum of the exponential similarities of all negative samples, and sim be the original L. c st The distance metric function q in the calculation formula i A specific query sample within a mini-batch serves as an anchor point in comparative learning. and These represent the momentum dictionary M respectively. t Regarding anchor point q i The positive and negative samples are represented by tau, which is a temperature coefficient, denoted as T in the formula. Its numerator represents the exponential similarity between the anchor point and the positive samples, and its denominator represents the sum of the exponential similarities between the anchor point and the positive samples as well as all the negative samples.

[0169] In this implementation, the contrastive loss of each anchor point is weighted by the number of instances in the (domain, class) pair to which it belongs during the target class contrastive learning process. This introduces a class imbalance coefficient, causing the model to prioritize the transfer of data from classes with fewer classes during the learning process, thus addressing class imbalance. Furthermore, a domain imbalance coefficient is introduced to weight the contrastive loss of a single anchor point by dynamically calculating the ratio between the number of positive samples at the anchor point and the number of class pairs within the anchor point itself. This allows the model to prioritize knowledge transfer from domains with fewer classes to domains with more classes during class semantic alignment, thereby addressing domain imbalance.

[0170] The above is only one possible implementation of step S503 provided in this embodiment. This embodiment does not specifically limit the specific implementation of step S503.

[0171] Step S504: Combine the contrast loss value and the imbalanced contrast loss value to perform target detection domain adaptation;

[0172] The contrastive loss value is re-weighted by class imbalance coefficient and domain imbalance coefficient. The contrastive loss value solves the problem of blurred classification boundaries caused by the adaptation of detection domain, while the introduced imbalance coefficient solves the problem of huge data differences and data imbalance between source domain data and target domain data.

[0173] In this embodiment, target category contrastive learning includes intra-domain and inter-domain contrastive loss as well as imbalanced contrastive loss. Intra-domain and inter-domain contrastive loss addresses the problem of blurred classification boundaries that arise during target domain adaptation. Imbalanced contrastive loss is applied on top of intra-domain and inter-domain contrastive loss to address the problem of imbalanced source and target domain data. This enables target detection domain adaptation even when there are significant differences between source and target domain data and the data is imbalanced. It also prevents the problem of blurred classification boundaries during target detection domain adaptation, achieving zero annotation cost and effectively improving detection accuracy.

[0174] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the target detection domain adaptation method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0175] This application also provides a target detection domain adaptation device, please refer to... Figure 7 The target detection domain adaptation device includes:

[0176] Simulation environment building module 10 is used to build a simulation environment based on a pre-built engine;

[0177] Use Unity3D's terrain editor to create terrain and build a basic simulation environment. Then, use Unity3D to add environmental elements to this basic simulation environment to simulate a realistic environment.

[0178] Source domain data acquisition module 20 is used to automatically label and acquire source domain data from the simulation environment according to a specific data acquisition algorithm;

[0179] By modifying the configuration files in the Unity3D engine, different types of simulation environments can be quickly built, and source domain data can be automatically labeled and collected from different simulation environments according to specific data acquisition algorithms.

[0180] The target domain data acquisition module 30 is used to acquire target domain data collected from the real environment.

[0181] Use devices such as cameras, depth cameras, and infrared sensors to collect target domain data directly from the real environment.

[0182] The target detection domain adaptation module 40 is used to input the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, and to use target category contrastive learning to adapt the image-level features and the target domain pseudo-labels to the target detection domain.

[0183] The average teacher-adversarial adaptation baseline model extracts features from source and target domain data respectively, uses a pre-discriminator for adversarial training, and obtains image-level features and target domain pseudo-labels. Based on the obtained image-level features and target domain pseudo-labels, the feature distribution difference between the source and target domains is minimized, so that even when the target domain data is unlabeled, the model in the source domain can still have good classification performance in the target domain.

[0184] Target class contrastive learning includes four contrastive losses and an improved imbalanced contrastive loss designed to address the data imbalance problem. It incorporates intra-domain and inter-domain target class contrastive learning to resolve the fuzzy classification boundary issue arising during adversarial domain adaptation. Furthermore, to address the data imbalance problem, an imbalanced contrastive loss is proposed. During training, the contrastive loss is dynamically weighted using the number of instances of each class in both the source and target domains, ensuring that the model in the source domain can adapt well to the target domain even with imbalanced data.

[0185] The target detection domain adaptation device provided in this application, employing the target detection domain adaptation method in the above embodiments, can solve the technical problem of target detection domain adaptation. Compared with the prior art, the beneficial effects of the target detection domain adaptation device provided in this application are the same as those of the target detection domain adaptation method provided in the above embodiments, and other technical features in the target detection domain adaptation device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0186] This application provides a target detection domain adaptation device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the target detection domain adaptation method in the first embodiment described above.

[0187] The following is for reference. Figure 8This document illustrates a structural schematic diagram of a target detection domain adaptation device suitable for implementing embodiments of this application. The target detection domain adaptation device in embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The target detection domain adaptation device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0188] like Figure 8 As shown, the target detection domain adaptation device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the target detection domain adaptation device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the target detection domain adaptation device to communicate wirelessly or wiredly with other devices to exchange data. Although the figures show target detection domain adaptation devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0189] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0190] The target detection domain adaptation device provided in this application, employing the target detection domain adaptation method in the above embodiments, can solve the technical problem of target detection domain adaptation. Compared with the prior art, the beneficial effects of the target detection domain adaptation device provided in this application are the same as the beneficial effects of the target detection domain adaptation method provided in the above embodiments, and other technical features in this target detection domain adaptation device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.

[0191] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0192] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0193] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the target detection domain adaptation method in the above embodiments.

[0194] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0195] The aforementioned computer-readable storage medium may be included in the target detection domain adaptation device; or it may exist independently and not assembled into the target detection domain adaptation device.

[0196] The aforementioned computer-readable storage medium carries one or more programs that, when executed by the target detection domain adaptation device, cause the target detection domain adaptation device to: construct a simulation environment based on a pre-built engine; automatically label and collect source domain data from the simulation environment according to a specific data acquisition algorithm; acquire target domain data collected from the real environment; input the source domain data and the target domain data into a pre-built average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels; and perform target detection domain adaptation using target category contrastive learning on the image-level features and the target domain pseudo-labels.

[0197] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0198] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0199] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0200] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described target detection domain adaptation method, thereby solving the technical problem of target detection domain adaptation. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the target detection domain adaptation method provided in the above embodiments, and will not be repeated here.

[0201] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the target detection domain adaptation method described above.

[0202] The computer program product provided in this application can solve the technical problem of target detection domain adaptation. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the target detection domain adaptation method provided in the above embodiments, and will not be repeated here.

[0203] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A target detection domain adaptation method, characterized in that, The method includes: A simulation environment is built based on a pre-built engine; Source domain data is automatically labeled and collected from the simulation environment according to a specific data acquisition algorithm; Acquire target domain data collected from a real-world environment; Obtain student and teacher models; Weights are shared among the student models and among the teacher models; An average teacher adversarial domain adaptation baseline model is constructed by using a weight-sharing student model and a weight-sharing teacher model. The average teacher adversarial domain adaptation baseline model includes one or more of the following: a first teacher model, a second teacher model, a first student model, and a second student model. The source domain data and the target domain data are input into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels. This process includes: performing weak and strong enhancement processing on the source domain data; inputting the weakly enhanced source domain data into the first teacher model to obtain first source domain image-level features and source domain labels; inputting the strongly enhanced source domain data into the first student model to obtain second source domain image-level features; performing weak and strong enhancement processing on the target domain data; inputting the weakly enhanced target domain data into the second teacher model to obtain first target domain image-level features and target domain pseudo-labels; inputting the strongly enhanced target domain data into the second student model to obtain second target domain image-level features; and constructing image-level features based on the first source domain image-level features, the second source domain image-level features, the first target domain image-level features, and the second target domain image-level features. The target detection domain adaptation is performed by using target category contrastive learning on the image-level features and the target domain pseudo-labels, including: extracting target region features based on the image-level features and the target domain pseudo-labels; the target category contrastive learning includes intra-domain and inter-domain contrastive loss and imbalanced contrastive loss; the target region features include one or more of strong enhancement source domains, weak enhancement source domains, weak enhancement target domains, and strong enhancement target domains. The method involves projecting the target region features onto a classification contrastive learning latent space and performing inter-domain and intra-domain contrastive loss to obtain a contrastive loss value. This includes: projecting the target region features onto the classification contrastive learning latent space; defining the strong enhancement source domain and the strong enhancement target domain as query samples; defining the weak enhancement source domain and the weak enhancement target domain as key samples; storing the key samples in a class equilibrium momentum dictionary; and using the query samples as anchors, combining the class equilibrium momentum dictionary to perform intra-domain and inter-domain contrastive loss on the target region features. Calculate the unbalanced contrast loss value based on the contrast loss value; The target detection domain is adapted by combining the contrast loss value and the imbalanced contrast loss value.

2. The method as described in claim 1, characterized in that, After the step of inputting the source domain data and the target domain data into a pre-constructed average teacher adversarial domain adaptation baseline model for processing to obtain image-level features and target domain pseudo-labels, the method further includes: The image-level features are aligned using a domain discriminant. The target domain pseudo-labels are used as supervision signals to supervise the second student model; The source domain labels are used as supervisory signals to supervise the first student model; The detector loss is minimized using the supervision signals from the second student model, the supervision signals from the first student model, and the image-level features after feature alignment.

3. The method as described in claim 1, characterized in that, The step of calculating the imbalanced contrast loss value based on the contrast loss value includes: Count the number of instances in the domain class pair to which the anchor point belongs; Based on the number of instances, class imbalance coefficients and domain imbalance coefficients are introduced; The contrast loss value is re-weighted and calculated based on the category imbalance coefficient and the domain imbalance coefficient to obtain the imbalanced contrast loss value.

4. A target detection domain adaptation device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the target detection domain adaptation method as described in any one of claims 1 to 3.

5. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the target detection domain adaptation method as described in any one of claims 1 to 3.

6. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the target detection domain adaptation method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Cross-domain small sample classification method, system and device and storage medium

    CN116452897A

  • Unsupervised cross-domain target detection method for aligning mean teachers based on pseudo label confidence

    CN118823456A