Closed data space model test adaptive method based on two-stage feature whitening
By using a two-stage feature whitening method, the problem of insufficient model adaptation in closed data spaces is solved, and the generalization ability and stability of the model in complex environments are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING BIG DATA ADVANCED TECH RES INST
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-17
AI Technical Summary
Existing test-time adaptive methods cannot effectively bridge the domain gap between the source and target domains in closed data spaces, resulting in limited generalization ability and stability of the model in complex and changing test environments.
A two-stage feature whitening method is adopted. By inputting enhanced views with different perturbation intensities into the data processing model, the activation features of the intermediate layer and the output results are obtained. Feature whitening is then performed to construct a joint model loss and update the target data layer to adapt to the data distribution of the target domain.
The model achieves adaptive adjustment in a closed data space, improving its generalization performance and inference stability in complex environments, and reducing the negative impact of distribution shift.
Smart Images

Figure CN121884036A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of model adaptation, specifically relating to an adaptive method, apparatus, device, and storage medium for testing closed data space models based on two-stage feature whitening. Background Technology
[0002] With the widespread application of deep learning models in tasks such as image classification, object detection, and medical image analysis, these models typically rely on large-scale, stable labeled data during the training phase. However, in actual deployment, models often need to perform inference under unknown environments or dynamically changing data distributions, such as variations in camera imaging conditions, differences in medical equipment imaging, and fluctuations in lighting in industrial scenes. This makes it difficult to maintain consistency in data distribution between the training and inference phases.
[0003] To improve the model's adaptability during the testing phase, Test-Time Adaptation (TTA) methods based on data augmentation are commonly used. These methods perform various augmentation operations on the input image, leveraging the predictive consistency between augmented views to constrain the model's output, thereby enhancing the model's robustness during testing.
[0004] However, in constrained environments such as trusted data spaces, due to factors such as data security, privacy protection, and environmental isolation, training and inference often must be conducted within a closed data space. The model cannot simultaneously access data from multiple data domains, nor can it access source domain data statistics from the training phase during the inference phase. Under this constraint, TTA can only rely on unlabeled data from the target domain for adaptive adjustment, making it difficult to bridge the domain gap between the source and target domains. When the distribution of test data undergoes complex changes, existing TTA methods cannot achieve ideal adaptive results, thus significantly limiting the model's generalization ability and stability. Summary of the Invention
[0005] This application aims to provide a test adaptation method, apparatus, device, and storage medium based on a closed data space model with two-stage feature whitening, which at least solves the problem of insufficient adaptive effect of the test adaptation process based on data augmentation under cross-data space conditions.
[0006] In a first aspect, embodiments of this application disclose an adaptive testing method for closed data space models based on two-stage feature whitening, including: Each enhanced view in the enhanced dataset, consisting of a first enhanced view and a second enhanced view, is input into the data processing model to obtain the intermediate layer activation features and output results corresponding to each enhanced view. The first enhanced view is obtained based on the perturbation of the corresponding original image within a first perturbation intensity range. The second enhanced view is obtained based on the perturbation of the corresponding original image within a second perturbation intensity range. A first whitening feature is determined for each of the intermediate layer activation features, and a second whitening feature is determined for each of the first whitening features after projection mapping based on all the first whitening features; the distribution edges of the first whitening features are aligned with the distribution edges of the enhanced view; the distribution of the second whitening features is a hyperspherical uniform distribution; Based on the joint model loss constructed from the output and the second whitening feature, the parameters of the target data layer in the data processing model are updated; the target data layer is used to perceive the data distribution of the input data.
[0007] Secondly, embodiments of this application also disclose an adaptive testing device for a closed data space model based on two-stage feature whitening, comprising: The data acquisition module is used to input each enhanced view in the enhanced dataset consisting of a first enhanced view and a second enhanced view into the data processing model to obtain the intermediate layer activation features and output results corresponding to each enhanced view; the first enhanced view is obtained based on the perturbation of the corresponding original image under a first perturbation intensity range; the second enhanced view is obtained based on the perturbation of the corresponding original image under a second perturbation intensity range; A two-stage whitening module is used to determine a first whitening feature corresponding to each of the intermediate layer activation features, and to determine a second whitening feature corresponding to each of the first whitening features after projection mapping based on all the first whitening features; the distribution edges of the first whitening features are aligned with the distribution edges of the enhanced view; the distribution of the second whitening features is a hyperspherical uniform distribution; An adaptive module is used to update the parameters of the target data layer in the data processing model based on the joint model loss constructed from the output and the second whitening feature; the target data layer is used to perceive the data distribution of the input data.
[0008] Thirdly, embodiments of this application also disclose an electronic device, including a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0009] Fourthly, embodiments of this application also disclose a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the method described in the first aspect.
[0010] In summary, in the embodiments of this application, by inputting the first and second enhanced views obtained from different perturbation intensities into the data processing model, the model can simultaneously encounter feature changes under multi-scale perturbations during the inference stage. This results in obtaining richer intermediate layer activation features and output results on unlabeled target domain data, providing a necessary diversity foundation for subsequent feature alignment and distribution constraints. Furthermore, the first whitening feature can be determined based on the intermediate layer activation features, ensuring that the edge statistics of the feature distribution remain consistent with the distribution edges of the corresponding enhanced view. Utilizing the local statistical alignment process, a more stable feature correspondence is established between different perturbed views, reducing the impact of local distribution shifts caused by changes in imaging conditions. Then, based on all the first... After projection mapping, the whitening features are used to determine the second whitening feature, making it present a hyperspherical uniform distribution. This achieves a more stable and structured feature representation at the global statistical level, effectively suppressing directional bias in the feature space. This suppresses single-point feature degradation while allowing the model to maintain high expression stability and discriminative ability even when facing complex distribution changes. Finally, a joint model loss is constructed based on the output results and the second whitening features, and the parameters of the target data layer are updated. This allows the model to adaptively adjust in a closed data space, relying only on unlabeled data in the target domain. The model balances semantic consistency and feature distribution stability during the update process, and improves the model's ability to perceive the data distribution of the target domain without accessing the statistical information of the source domain data. Therefore, based on the embodiments of this application, by introducing a two-stage feature whitening mechanism, features are effectively aligned at both the local statistical and global structural levels. Combined with the joint model loss based on the output results and whitening features, the model can obtain better adaptive ability in a closed data space, reducing the negative impact of distribution shift under data isolation conditions, thereby improving the model's generalization performance and inference stability in complex testing environments. Attached Figure Description
[0011] In the attached diagram: Figure 1 This is a flowchart illustrating the steps of an adaptive testing method for a closed data space model based on two-stage feature whitening, as provided in an embodiment of this application. Figure 2 This is a flowchart of another adaptive testing method for a closed data space model based on two-stage feature whitening provided in this application embodiment; Figure 3 This is a schematic diagram of the optimization process based on whitening contrast learning in an embodiment of this application; Figure 4 This is a two-stage whitening process according to an embodiment of this application; Figure 5 This is a block diagram of an adaptive testing device for a closed data space model based on two-stage feature whitening, provided in an embodiment of this application. Figure 6 This is a block diagram of an electronic device provided in one embodiment of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0014] Furthermore, it is important to emphasize that, to facilitate a unified modeling of the detailed processes proposed later, this application uses an augmentation dataset consisting of a first augmented view and two second augmented views generated from the original image as an example to derive and explain the relevant formulas. Specifically, each original image is first subjected to a weak perturbation to generate a first augmented view, and then subjected to two independent strong perturbations to generate two second augmented views, thereby forming an augmentation set containing three views with different perturbation intensities. Based on this augmentation set, the derivation of the formulas in the subsequent explanations of this invention is based on this structure. To avoid repetition, the method of constructing the augmented views will not be further emphasized in the subsequent formulas.
[0015] like Figure 1 The image shows an adaptive testing method for a closed data space model based on two-stage feature whitening, provided in an embodiment of this application.
[0016] The method may include the following steps: Step 101: Input each augmented view in the augmented dataset consisting of the first augmented view and the second augmented view into the data processing model to obtain the intermediate layer activation features and output results corresponding to each augmented view.
[0017] The first enhanced view is obtained based on the perturbation of the corresponding original image under the first perturbation intensity range; the second enhanced view is obtained based on the perturbation of the corresponding original image under the second perturbation intensity range.
[0018] In some embodiments of this application, to enable the data processing model to extract features related to changes in the input distribution based on multiple perturbation views, each enhanced view in the enhanced dataset, consisting of a first enhanced view and a second enhanced view, is input into the data processing model to obtain corresponding intermediate layer activation features and output results. The first and second enhanced views are derived from the processing results of the original image under different perturbation intensities, allowing the model to be exposed to input changes under multi-scale perturbations during inference. The intermediate layer activation features characterize the model's feature response to the enhanced view, and the output results characterize the model's prediction performance under that view. Both serve as the foundational information for subsequent local whitening, global whitening, and joint model loss construction. In this way, the model can generate corresponding feature responses and prediction results under different perturbation intensities, thereby improving its adaptability under complex distribution change conditions.
[0019] In a medical image classification scenario, researchers input multiple enhanced views of a chest X-ray image into a trained model to obtain feature responses under different perturbation conditions. The first enhanced view was generated by a slight brightness perturbation, while the second enhanced view was generated by color perturbation and noise injection. After receiving these enhanced views, the model outputs the corresponding intermediate layer activation features and classification results, enabling subsequent steps to perform two-stage whitening processing and joint model loss construction based on this multi-view information, thereby improving the model's stability under different imaging conditions.
[0020] Step 102: Determine the first whitening feature corresponding to each intermediate layer activation feature, and determine the second whitening feature corresponding to each first whitening feature after projection mapping based on all the first whitening features.
[0021] The distribution edges of the first whitening feature are aligned with the distribution edges of the enhanced view; the distribution of the second whitening feature is uniformly distributed on a hyperspherical surface.
[0022] In some embodiments of this application, to obtain stable and aligned feature representations at both the local statistical and global structural levels, a first whitening feature is determined based on the intermediate layer activation features of each augmented view. Furthermore, a second whitening feature corresponding to each of the first whitening features is determined after projection mapping of all the first whitening features. The first whitening features align the distribution edges of the augmented views through batch whitening, ensuring consistency in local statistics across different perturbation views. The second whitening features, after projection mapping, exhibit a hyperspherical uniform distribution through global whitening, making the features more balanced in direction and scale, thereby reducing feature bias aggregation and improving overall representation stability. In this way, the model can obtain a more robust feature structure at both the local and global scales, providing a reliable feature foundation for subsequent joint model loss construction and adaptive updates, thus enhancing its adaptability under complex distribution changes.
[0023] In a medical image analysis scenario, the model obtains corresponding first whitening features based on multiple enhanced views of a chest X-ray image, ensuring a consistent edge distribution at the local statistical level. Subsequently, global whitening is performed based on all the first whitening features, resulting in a uniformly distributed second whitening feature structure on the hypersphere. Through this two-stage whitening process, the model can maintain more stable feature representation under different imaging devices, lighting conditions, or noise levels, thereby improving its adaptability in the target domain.
[0024] Step 103: Update the parameters of the target data layer in the data processing model based on the joint model loss constructed from the output results and the second whitening features.
[0025] The target data layer is used to perceive the data distribution of the input data.
[0026] In some embodiments of this application, to enable the data processing model to adaptively adjust based solely on unlabeled data in the target domain within a closed data space, a joint model loss is constructed based on the output of the enhanced view and the second whitening feature. This loss is then used as an optimization signal to update the parameters of the target data layer. The output provides semantic prediction information for the model under different perturbed views, while the second whitening feature provides a structured feature representation under global whitening constraints. The joint model loss, composed of both, simultaneously constrains the semantic consistency and feature distribution stability of the model, allowing the target data layer to gradually adapt to changes in the data distribution of the target domain during the update process. In this process, the target data layer, as the structural unit most sensitive to the input data distribution, adjusts its adjustable parameters through the backpropagation signal of the joint model loss, enabling it to more accurately perceive the statistical characteristics and structural changes of the target domain data. In this way, the model can dynamically correct its internal feature mapping relationship during the inference stage without accessing the source domain statistical information, thereby mitigating the distribution shift caused by changes in imaging conditions, noise perturbations, or device differences.
[0027] In a medical image analysis scenario, the model obtains the corresponding output and second whitening feature based on an enhanced view of a chest X-ray image, and constructs a joint model loss accordingly. Subsequently, the model updates the parameters of the target data layer, ensuring stable feature perception under different imaging devices or exposure conditions. In this way, the model achieves more robust predictive performance in the target domain, thereby improving its adaptability in complex clinical environments.
[0028] In summary, in the embodiments of this application, by inputting the first and second enhanced views obtained from different perturbation intensities into the data processing model, the model can simultaneously encounter feature changes under multi-scale perturbations during the inference stage. This results in obtaining richer intermediate layer activation features and output results on unlabeled target domain data, providing a necessary diversity foundation for subsequent feature alignment and distribution constraints. Furthermore, the first whitening feature can be determined based on the intermediate layer activation features, ensuring that the edge statistics of the feature distribution remain consistent with the distribution edges of the corresponding enhanced view. Utilizing the local statistical alignment process, a more stable feature correspondence is established between different perturbed views, reducing the impact of local distribution shifts caused by changes in imaging conditions. Then, based on all the first... After projection mapping, the whitening features are used to determine the second whitening feature, making it present a hyperspherical uniform distribution. This achieves a more stable and structured feature representation at the global statistical level, effectively suppressing directional bias in the feature space. This suppresses single-point feature degradation while allowing the model to maintain high expression stability and discriminative ability even when facing complex distribution changes. Finally, a joint model loss is constructed based on the output results and the second whitening features, and the parameters of the target data layer are updated. This allows the model to adaptively adjust in a closed data space, relying only on unlabeled data in the target domain. The model balances semantic consistency and feature distribution stability during the update process, and improves the model's ability to perceive the data distribution of the target domain without accessing the statistical information of the source domain data. Therefore, based on the embodiments of this application, by introducing a two-stage feature whitening mechanism, features are effectively aligned at both the local statistical and global structural levels. Combined with the joint model loss based on the output results and whitening features, the model can obtain better adaptive ability in a closed data space, reducing the negative impact of distribution shift under data isolation conditions, thereby improving the model's generalization performance and inference stability in complex testing environments.
[0029] Figure 2 This is another adaptive testing method for closed data space models based on two-stage feature whitening provided in the embodiments of this application.
[0030] The method may include the following steps: Step 201: Perform a first enhancement on each original image in the dataset to be enhanced to obtain a first enhanced view of each original image, and perform a second enhancement on each original image in the dataset to be enhanced to obtain a second enhanced view of each original image.
[0031] In some embodiments of this application, in order to obtain multi-view inputs with consistent sources and clear perturbation levels in subsequent processing, a first enhancement and a second enhancement are performed on each original image in the dataset to be enhanced, to generate corresponding first and second enhanced views. The first enhancement typically uses weaker perturbations to preserve the basic structural information of the image, while the second enhancement uses stronger perturbations to introduce more obvious appearance changes, thereby forming multi-view inputs with different perturbation intensities, providing a multi-scale feature basis for subsequent whitening processing and joint model loss construction.
[0032] In a medical image analysis scenario, researchers performed slight brightness adjustments or random cropping on raw chest X-ray images to generate a first enhanced view, and then generated a second enhanced view by color perturbation or noise injection, ensuring that each raw image received two views with different perturbation intensities. Based on these multi-view inputs, the model can extract richer information on feature variations, thereby improving its adaptability under complex distribution conditions.
[0033] Optionally, in order to perform the first enhancement on each original image in the dataset to be enhanced, to obtain a first enhanced view of each original image, step 201 includes the following sub-steps: Sub-step 2011 involves performing at least one of the following processes on the original image: random flipping, cropping, and brightness adjustment, to obtain a first enhanced view corresponding to the original image.
[0034] In some embodiments of this application, in order to introduce a moderate perturbation into the first enhanced view while maintaining the basic structural information of the original image, at least one weak perturbation process, such as random flipping, cropping, or brightness adjustment, can be performed on the original image to obtain the corresponding first enhanced view. The aforementioned weak perturbation methods can introduce slight changes in dimensions such as spatial structure, local regions, or lighting conditions, allowing the first enhanced view to maintain high structural fidelity under weak perturbation conditions, thereby providing stable input for subsequent construction of feature representations under local statistical constraints.
[0035] In one example of a medical image analysis scenario, researchers performed random flipping and brightness adjustments on a raw chest X-ray image to generate a first enhanced view. This enhanced view, while preserving the integrity of lung structural information, exhibits slight directional or brightness variations, thus simulating image performance under different imaging conditions. Based on this enhanced view, the model can extract more stable features under local statistical constraints, thereby improving its adaptability to different imaging conditions.
[0036] Optionally, in order to perform a second enhancement on each original image in the dataset to be enhanced, to obtain a second enhanced view of each original image, step 201 includes the following sub-steps: Sub-step 2012 involves performing at least two of the following on the original image: color perturbation, noise injection, blurring, and shearing transformation, to obtain a second enhanced view corresponding to the original image.
[0037] In some embodiments of this application, in order to make the second enhanced view present a stronger appearance change while preserving the semantic information of the original image, at least two strong perturbation operations, such as color perturbation, noise injection, blurring, or shearing transformation, can be performed on the original image. At least two processing methods are applied to the original image to generate different enhanced views, enabling each enhanced view to independently reflect the appearance change under a single perturbation method. This covers multiple types of strong perturbation features, providing a richer input foundation for subsequently constructing structured alignment features under global statistical constraints.
[0038] In an example of an industrial vision inspection scenario, researchers performed color perturbation and noise injection on product surface images to generate a second enhanced view with different strong perturbation features. This enabled the model to extract more stable structured alignment features under global statistical constraints, thereby improving its adaptability in complex industrial environments.
[0039] Step 202: Integrate each corresponding first enhanced view and each second enhanced view as an enhanced view to obtain an enhanced dataset.
[0040] In some embodiments of this application, in order to enable the data processing model to perform feature extraction based on multi-view inputs with consistent sources and well-defined structures, the first and second enhanced views corresponding to each original image are integrated as independent enhanced views to form an enhanced dataset. In this way, the enhanced dataset can simultaneously contain image views under both weak and strong perturbations, providing a stable multi-view input foundation for subsequent whitening processing and joint model loss construction, thereby improving the model's adaptability under complex distribution variations.
[0041] In an example of an industrial vision inspection scenario, researchers paired and integrated a first augmented view with a second augmented view for each original image to construct an augmented dataset containing views with varying perturbation intensities. Based on this dataset, subsequent steps can perform feature whitening and model adaptation processing on multi-view inputs, thereby improving the model's stability under different lighting, noise, or surface reflection conditions.
[0042] Step 203: Input each augmented view in the augmented dataset consisting of the first augmented view and the second augmented view into the data processing model to obtain the intermediate layer activation features and output results corresponding to each augmented view.
[0043] The first enhanced view is obtained based on the perturbation of the corresponding original image under the first perturbation intensity range; the second enhanced view is obtained based on the perturbation of the corresponding original image under the second perturbation intensity range.
[0044] The method shown in this step has been explained in step 101 and will not be repeated here.
[0045] Step 204: Determine the first whitening feature corresponding to each intermediate layer activation feature, and determine the second whitening feature corresponding to each first whitening feature after projection mapping based on all the first whitening features.
[0046] The distribution edges of the first whitening feature are aligned with the distribution edges of the enhanced view; the distribution of the second whitening feature is uniformly distributed on a hyperspherical surface.
[0047] The method shown in this step has been explained in step 102 and will not be repeated here.
[0048] In some embodiments of this application, to further illustrate the calculation method of feature normalization under local statistical constraints, the explanation can be based on the Batch Normalization (BN) layer: For a Batch Normalization (BN) layer, its input can be represented as: The output is The normalization result of the i-th sample in the k-th channel can be expressed as: ;in, and These represent the mean and variance calculated based on the current batch, respectively. These are constants used to improve numerical stability. and These are learnable affine parameters. During the training phase, and The current batch is updated in real time, while the statistics accumulated during training are used during the inference phase. This normalization process can stabilize the feature distribution within a local batch range, providing a basis of statistics for subsequent local whitening processing.
[0049] In the above process, to address the issue that batch normalization (BN) may still retain feature correlations after standardization, and to further improve the model's feature alignment ability under neighborhood offset conditions, batch whitening (BW) can be used as an alternative to BN. Batch whitening decorrelates features through principal component analysis and transforms the features into a spherical distribution with zero mean and unit variance. Specifically, batch whitening can be expressed as: (1), in, These are the characteristics after whitening. The whitening process can be further represented as: (2), in, For batch The mean of the matrix satisfy , Based on batch The calculated covariance matrix, These represent the first and second order statistics of the batch. Using formula (2), the batch characteristics can be mapped to a set of spherical distribution vectors. .
[0050] In the network structure of this application, for any layer ,make , indicating that the target domain data is in the middle activation batch of this layer. Based on formulas (1)-(2), the Whitening Batch Normalization (WBN) layer can be further defined, and its formal definition for the whitening operation is: (3), In calculation In this application, the whitening matrix is directly obtained using Cholesky decomposition, and the traditional coloring steps after whitening are replaced by simple scaling and translation operations, thereby reducing computational complexity. To avoid introducing additional network parameters, this application also employs feature grouping technology to improve the stability of batch statistics estimation when the sample size is small and the feature dimension is large. Furthermore, during training, the WBN layer continuously updates the statistical information of the target domain using a moving average of the batch statistics, making the whitening process more stable and reliable.
[0051] Based on the above analysis process, optionally, in order to determine the first whitening feature corresponding to each intermediate layer activation feature, step 204 includes the following sub-steps: Sub-step 2041: Based on the intermediate layer activation features obtained by the enhanced view during each batch input data processing model, determine the batch mean and batch covariance matrix corresponding to each batch of input data.
[0052] In some embodiments of this application, to accurately characterize the feature distribution structure of the augmented view in the intermediate layer within a local batch scope, the batch mean and batch covariance matrix corresponding to each batch input are determined based on the intermediate layer activation features obtained by the augmented view during each batch input data processing model. Specifically, after receiving a batch of augmented views, the model first collects the activation vectors of all samples in the target intermediate layer in that batch, and calculates the corresponding mean and covariance statistics based on these activation vectors to reflect the linear correlation between the features of that batch in different dimensions. By constructing the batch mean at the batch scale, the model can capture the correlation structure of the augmented view at the local statistical level, providing the necessary first-order statistical information for subsequent zero-mean processing. By constructing the covariance matrix at the batch scale, the model can capture the correlation structure of the augmented view at the local statistical level, providing the necessary second-order statistical information for subsequent batch whitening transformation. This covariance matrix not only reflects the correlation degree of different perturbation views in feature dimensions, but also provides an accurate statistical basis for subsequent decorrelation processing, thereby enabling the first whitening feature to obtain a more stable and aligned feature expression within a local scope.
[0053] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model calculates the corresponding covariance matrix based on the intermediate layer activation features of that batch. This ensures that the model accurately reflects the correlation structure between feature dimensions under different imaging conditions. In this way, the model can obtain reliable feature correlation information at the local statistical level, providing a stable statistical basis for subsequent batch whitening and feature alignment.
[0054] Sub-step 2042: Determine the batch whitening transformation matrix corresponding to each batch based on the batch covariance matrix, and perform zero-mean processing on each intermediate layer activation feature based on the batch mean of the corresponding batch.
[0055] In some embodiments of this application, to perform stable decorrelation processing on intermediate layer activation features within a local batch range, a batch whitening transformation matrix is determined based on the batch covariance matrix for each batch, and each intermediate layer activation feature is zero-mean-normalized based on all intermediate layer activation features in that batch. Specifically, after obtaining the batch covariance matrix, the model uses this matrix to construct a whitening transformation matrix that eliminates linear correlation between feature dimensions, so that subsequent features exhibit a spherical distribution structure with zero mean and unit variance after mapping. Before performing the whitening transformation, the model first performs zero-mean-normalization on each intermediate layer activation feature to eliminate mean shift within the batch range, thereby ensuring that the whitening transformation works on a unified statistical benchmark. In this way, the batch whitening transformation matrix can more accurately decorrelate features, making the first whitened feature present a more stable and aligned feature structure at the local statistical level.
[0056] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model constructs a whitening transformation matrix based on the batch's covariance matrix and performs zero-mean normalization on all intermediate layer activation features to eliminate statistical differences caused by brightness shifts or local noise within the batch. This approach allows the model to obtain more stable local whitening features, providing a reliable feature foundation for subsequent global whitening and joint model loss construction.
[0057] Sub-step 2043 involves linearly transforming each intermediate layer activation feature after zero-mean processing according to the batch whitening transformation matrix of the corresponding batch to obtain the corresponding first whitening feature.
[0058] In some embodiments of this application, to obtain stable feature representations after decorrelation processing within a local batch range, each intermediate layer activation feature after zero-mean processing is linearly transformed according to the batch whitening transformation matrix under the corresponding batch to obtain the corresponding first whitening feature. Specifically, after completing zero-mean processing, the model uses the whitening transformation matrix constructed based on the batch covariance matrix in the previous step to perform a linear mapping on each intermediate layer activation feature, making it present a spherical distribution structure with zero mean, unit variance, and linear independence between dimensions at the batch scale. Through this linear transformation process, the model can effectively eliminate the correlation between different feature dimensions, making the first whitening feature have a more stable, alignable, and unaffected feature structure at the local statistical level. This feature structure can not only improve the feature consistency of the model across different augmented views, but also provide a more reliable input basis for subsequent global whitening and joint model loss construction.
[0059] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model linearly maps the zero-mean intermediate layer activation features using a batch whitening transformation matrix, resulting in a spherical distribution within the local statistical range. This approach allows the model to obtain more stable first whitening features, maintaining consistent feature representation under different imaging conditions and providing a solid foundation for subsequent global whitening and adaptive updates.
[0060] Optionally, in order to determine the second whitening feature corresponding to each of the first whitening features based on all the first whitening features, step 204 includes the following sub-steps: Sub-step 2044 involves updating the parameters of the projection mapping layer based on the whitening contrast loss constructed from the projection features of the first whitening feature in the projection mapping layer of the data processing model, and obtaining the target projection feature of each first whitening feature from the updated projection mapping layer.
[0061] In some embodiments of this application, to obtain more structured and semantically consistent feature representations under global statistical constraints, a whitening contrast loss is constructed based on the projection features of the first whitening feature in the projection mapping layer of the data processing model. This loss is then used to update the parameters of the projection mapping layer, thereby obtaining the target projection feature corresponding to each first whitening feature. Specifically, the model first inputs the first whitening feature into the projection mapping layer to obtain its initial projection features in the projection space. Then, a whitening contrast loss is constructed based on these projection features, enabling the projection mapping layer to simultaneously satisfy the dual constraints of avoiding feature degradation and maintaining semantic aggregation under unsupervised conditions. In this process, the whitening contrast loss applies distribution balance and semantic consistency constraints to the projection features, ensuring that enhanced views from the same original image maintain aggregation relationships in the projection space while preventing all projection features from collapsing into single-point regions. By minimizing this loss, the adjustable parameters of the projection mapping layer can gradually converge to the optimal solution that satisfies the above constraints, allowing the updated projection mapping layer to output more stable, balanced, and semantically structured target projection features.
[0062] In a medical image analysis scenario, the model inputs the first whitening feature of a chest X-ray image into a projection mapping layer and constructs a whitening contrast loss based on the projection result. This ensures semantic consistency between different enhanced views from the same patient image in the projection space, while preventing directional degradation of features in high-dimensional space. In this way, the model obtains more reliable target projection features, providing a stable input foundation for subsequent global whitening processing.
[0063] Optionally, in order to update the parameters of the projection mapping layer based on the whitening contrast loss constructed from the projection features of the first whitening feature in the projection mapping layer of the data processing model, sub-step 2044 includes the following sub-steps: Sub-step 20441: Establish the whitening contrast loss for the projection mapping layer based on the first and second constraints.
[0064] The first constraint is used to prevent the feature distribution of the projection features from degenerating into a single-point distribution; the second constraint is used to ensure that the projection features corresponding to different enhanced views of the same original image satisfy a preset semantic aggregation relationship.
[0065] In some embodiments of this application, in order to obtain a structured representation in the projection space that possesses both semantic aggregation capabilities and avoids feature degradation, a whitening contrast loss for the projection mapping layer is constructed based on a first constraint and a second constraint. This loss function is based on the projection result of the first whitening feature in the projection mapping layer. By jointly applying distribution equilibrium constraints and semantic consistency constraints, the projection mapping layer can learn a more robust feature structure under unsupervised conditions. Specifically, the first constraint is used to suppress the collapse of projection features into single-point regions in high-dimensional space, avoiding loss of expressive power due to feature distribution degradation; the second constraint is used to ensure that different enhanced views from the same original image maintain a preset semantic aggregation relationship in the projection space, enabling the model to maintain a consistent semantic structure even under changes in perturbation intensity. By incorporating these two constraints into the whitening contrast loss, the projection mapping layer can simultaneously consider distribution stability and semantic consistency during the optimization process, thereby providing a more reliable foundation of projection features for subsequent global whitening steps.
[0066] In a medical image analysis scenario, the model inputs the first whitening feature of a chest X-ray image into the projection mapping layer and constructs a whitening contrast loss based on the projection result. This loss, on the one hand, avoids excessive clustering of images from different patients in the projection space, and on the other hand, promotes semantically close semantic relationships among multiple enhanced views of the same patient. Through this structured constraint, the model can obtain more stable projection features under complex imaging conditions, providing solid support for subsequent global whitening and feature alignment.
[0067] In some embodiments of this application, in order to obtain discriminative feature representations under unsupervised conditions, the data processing model employs adjustable parameters. encoder network From the input image Extracting embedding vectors To avoid the degenerate distribution of embedding vectors collapsing to a single point, and to ensure that positive samples from the same semantics (i.e., different augmented views relative to the same original image in this application) can be tightly clustered in the feature space, this application formalizes the representation learning objective as follows: (4) Used as the first constraint condition; And apply covariance constraints: (5) Used as the second constraint condition.
[0068] in, Represents the distance between vectors. As the identity matrix, constraint (5) requires that each dimension of the embedded vector maintain linear independence, thereby avoiding degenerate distribution and prompting each dimension to express different semantic content.
[0069] Furthermore, in the above process, the normalized mean square error based on cosine similarity can be used as the distance metric, and its form is: (6), To construct positive samples with shared semantics, this application employs standard image augmentation strategies within the Adaptive Contrastive Learning (AdaContrast) framework, starting from the same original image. Each positive sample is randomly and independently selected. Generate positive samples and use This indicates two enhanced views. and Whether they come from the same original image. Number of positive samples per image. The adjustment can be made according to the training signal quantity and batch diversity. In the experiment, this application adopted the following methods respectively. and .
[0070] In terms of representation learning structure, this application employs an unsupervised backbone encoder. Extracting high-dimensional features or and through a nonlinear projection head Map it to a low-dimensional vector ,in It consists of a multi-layer perceptron containing hidden layers and batch normalization (BN) layers. The overall network structure is as follows: .
[0071] Let the number of original images be... Each image is generated If there are multiple enhanced views, the batch size will be... The corresponding feature batch is represented as .
[0072] Thus, based on the above formulas (4) to (6), the weighted mean squared error (W-MSE) loss can be used as the whitening contrast loss: By analyzing the whitened variables Perform reparameterization and calculate all The mean squared error of each positive sample pair is obtained as follows: (7), The summation range covers all conditions that satisfy... (Indicates an enhanced view) and Positive sample pairs (from the same original image) under the condition.
[0073] Sub-step 20442: Fix the adjustable parameters of the projection mapping layer when the whitening contrast loss reaches its minimum value.
[0074] In some embodiments of this application, to ensure the projection mapping layer maintains stable feature mapping capability after satisfying the whitening contrast constraint, the adjustable parameters of the projection mapping layer are fixed when the whitening contrast loss converges to its minimum. As the optimization process continues, the whitening contrast loss gradually decreases and eventually reaches the preset optimum. At this point, the projection mapping layer can output target projection features that simultaneously satisfy distribution balance and semantic aggregation. To avoid disrupting this structured feature relationship due to continued updates in subsequent steps, the model freezes the parameters of the projection mapping layer at this stage, allowing it to participate in subsequent global whitening processing as a stable projection transformation module. After the parameters are fixed, the projection mapping layer no longer participates in subsequent gradient updates, and its output target projection features can serve as a reliable input source for global covariance estimation and global whitening transformation construction. In this way, the model can provide a stable projection space foundation for the generation of the second whitening feature while maintaining semantic consistency and distribution balance.
[0075] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model freezes the parameters of the projection mapping layer after the whitening contrast loss converges, ensuring that it outputs structurally consistent target projection features under different imaging conditions. This stable projection space allows the model to obtain more reliable feature structures in subsequent global whitening steps, thereby improving its overall adaptability.
[0076] Sub-step 2045: Determine the global mean and global covariance matrix of all the target projection features, and determine the global whitening transformation matrix of the target projection features based on the global covariance matrix.
[0077] In some embodiments of this application, to obtain a more stable and structurally balanced feature representation at the global statistical level, a global statistical analysis is performed on all target projection features to determine their corresponding global mean and global covariance matrix. Based on this, a global whitening transformation matrix applicable to all target projection features is constructed. Specifically, the model first aggregates all target projection features and calculates the cross-batch covariance structure based on their overall distribution to characterize the correlation pattern of features at the global scale. Subsequently, a global whitening transformation matrix that can eliminate linear correlation between dimensions is derived from this covariance matrix, so that subsequent features present a spherical structure with balanced orientation and consistent scale after mapping. By constructing the covariance matrix globally and generating the whitening transformation matrix accordingly, the model can unify the feature structure under different augmented views and different perturbation conditions at a higher level, enabling target projection features to obtain a more consistent expression under global statistical constraints. This process can not only effectively suppress the directional bias of features in high-dimensional space, but also provide a stable structural basis for the generation of the second whitening feature, thereby improving the overall reliability of the model's expression under complex distribution variation conditions.
[0078] In a medical image analysis scenario, the model integrates multiple target projection features from a chest X-ray image and calculates a global covariance matrix based on their overall distribution. Subsequently, the model constructs a global whitening transformation matrix using this matrix, ensuring that all target projection features exhibit a balanced spherical structure after mapping. This approach allows the model to maintain a more stable feature structure under different imaging devices or noise conditions, providing reliable support for the subsequent generation of second whitening features.
[0079] Sub-step 2046 involves performing an offset operation on each target projection feature according to the global mean, and a linear transformation according to the global whitening transformation matrix, to obtain the corresponding second whitening feature.
[0080] In some embodiments of this application, to achieve a more balanced and directionally consistent structural representation of the target projection features under global statistical constraints, each target projection feature is offset according to the global mean and then linearly transformed according to the global whitening transformation matrix to obtain the corresponding second whitening feature. The offset operation and linear transformation ensure that the target projection features are readjusted on a global scale, resulting in a hyperspherically uniform distribution after mapping, thus achieving a more stable feature structure in terms of directionality, scale, and dimensionality independence. With this global whitening mapping, the model can effectively mitigate feature biases caused by different perturbation views, different imaging conditions, or different noise levels, allowing the second whitening feature to maintain a more consistent structural morphology in high-dimensional space. This structured, balanced representation not only improves the alignability of features under cross-view conditions but also provides a more reliable input basis for subsequent adaptive updates based on joint model loss.
[0081] In a medical image analysis scenario, the model inputs the target projection features of a chest X-ray image into a global whitening transformation matrix, resulting in a uniformly distributed spherical structure after mapping. This process allows the model to maintain more stable feature representations under different imaging devices or exposure conditions, thereby improving its adaptability in the target domain.
[0082] Furthermore, based on the determination of the adjustable parameters of the projection mapping layer using the above formula (7), the whitened variables are then determined as follows: (8) obtained, Among them, global mean Whitening matrix satisfy ; The covariance matrix is: (9), Through the aforementioned whitening constraints, this application is able to obtain feature representations that are distributed evenly, dimensionally decoupled, and semantically consistent under unsupervised conditions, providing a theoretical basis for subsequent local whitening, global whitening, and joint model loss construction.
[0083] Step 205: Update the parameters of the target data layer in the data processing model based on the joint model loss constructed from the output results and the second whitening features.
[0084] The target data layer is used to perceive the data distribution of the input data.
[0085] The method shown in this step has been explained in step 103 and will not be repeated here.
[0086] Optionally, step 205 includes the following sub-steps: Sub-step 2051: Establish the joint model loss for the target data layer based on the third, fourth, and fifth constraints.
[0087] The third constraint is used to reduce the interference of similar negative samples generated by the various enhanced views obtained based on the same perturbation on the data processing model; the fourth constraint is used to ensure that the output results of different enhanced views corresponding to the same original image meet the preset prediction consistency relationship; and the fifth constraint is used to ensure that the second whitening feature corresponding to different original images meets the preset whitening difference relationship.
[0088] In some embodiments of this application, to achieve more robust adaptive adjustments to unlabeled data in the target domain during the inference phase, a joint model loss for optimizing the target data layer is constructed by integrating the third, fourth, and fifth constraints. This joint model loss simultaneously considers cross-class discriminability in the feature space, prediction consistency between augmented views, and the diverse structure of whitening features, enabling the model to balance semantic stability and structural equilibrium of feature distribution during the update process. Specifically, the third constraint aims to reduce the interference of similar negative samples caused by augmented views generated with the same perturbation method, making the model more focused on cross-class discriminative structures in the feature space; the fourth constraint is used to constrain the consistency of different augmented views from the same original image in the prediction space, thereby improving the semantic stability of the model under different perturbation intensities; and the fifth constraint, by introducing whitening difference constraints, ensures that the second whitening features from different original images are moderately dispersed in the global structure, avoiding expression degradation caused by excessive feature aggregation. Under the combined effect of the above three constraints, the joint model loss can achieve a balance between semantic consistency, cross-class discriminability and feature diversity, enabling the target data layer to gradually adapt to changes in the data distribution of the target domain during the update process, and to obtain more reliable adaptive capabilities under closed data space conditions.
[0089] In a medical image analysis scenario, when processing chest X-ray images, the model constructs third, fourth, and fifth constraints based on the output results of different enhanced views and the second whitening feature. For example, weakly enhanced and strongly enhanced views from the same patient image should maintain consistency in the prediction space to satisfy the fourth constraint; while the second whitening features from different patients should maintain a moderate dispersion in the global structure to satisfy the fifth constraint. Simultaneously, when constructing the third constraint, the model excludes interference from similar negative samples generated by the same perturbation method between enhanced views, making the cross-class discriminative structure more prominent. Based on the joint model loss constituted by the above constraints, the model can progressively adjust the parameters of the target data layer in a closed data space, maintaining stable predictive performance under different imaging devices, exposure conditions, or noise levels.
[0090] Furthermore, regarding the third constraint, in order to reduce the interference of similar negative samples on the data processing model caused by various enhanced views obtained based on the same perturbation, this application introduces a class-aware contrastive loss. This loss eliminates negative samples belonging to the same category as the current sample, enabling the model to learn the cross-category discriminative structure more accurately in the feature space. Specifically, let... Let be the temperature parameter, used to adjust the smoothness of the similarity distribution. Then, the loss of similar negative samples can be expressed as: (10) in, Indicates the second albinism feature (e.g.) and Similarity measures between (e.g., cosine similarity can be used). and This represents the class label of a sample. By constructing contrast constraints only between samples from different classes, this loss can enhance cross-class discrimination ability, reduce the noise impact of comparing samples from the same class, and thus improve the discriminative structure of the model in the feature space.
[0091] Meanwhile, regarding the fourth constraint, in order to constrain the consistency between the weakly augmented view and the strongly augmented view in the prediction space, this application introduces a prediction consistency loss based on cross-entropy. This is to ensure that the outputs of different augmented views corresponding to the same original image satisfy a predefined prediction consistency relationship. This loss measures weakly augmented samples. Predicted probability distribution With two strongly enhanced samples and Predicted probability distribution and (i.e. and The differences between the output results (and the model's output results) enable the model to maintain stable predictive behavior under different perturbation intensities.
[0092] The cross-entropy loss is defined as follows: , in This is an indicator function.
[0093] Based on this, the prediction consistency loss can be expressed as: (11), By minimizing this loss, the model can maintain predictive consistency between views with weak and strong perturbations, thereby improving its stability under complex distributional variations.
[0094] Meanwhile, regarding the fifth constraint, to avoid excessive shrinkage of the model in the feature space leading to homogenization of representations, this application introduces feature diversity loss. This loss is designed to ensure that the second whitening features corresponding to different original images satisfy a predefined whitening difference relationship. This loss enhances the diversity of feature distribution by maximizing the variance of intra-batch sample features, thereby preventing excessive aggregation of all enhanced views after whitening. set up Let represent the feature set of the three enhanced views of the i-th original image after WCL whitening, and let Tr be the matrix trace used to measure the total variance of the covariance matrix. Based on this, the feature diversity loss can be expressed as: (12), in Represents a set The covariance matrix is calculated. By maximizing the feature variance (i.e. minimizing the negative total variance), the model can maintain sufficient feature dispersion while preserving alignment constraints, thereby improving the overall feature representation capability.
[0095] Finally, based on formulas (10) to (12), , , By integrating these components, we can obtain the overall optimization goals for the AdaContrast framework: , Building upon this foundation, this application can further introduce Whitening Batch Normalization (WBN) and Whitening Contrastive Learning (WCL) modules into AdaContrast, enabling features to simultaneously achieve whitening alignment under both local statistical and global structural constraints, thereby constructing the final two-stage whitening optimization objective. This objective function serves as a unified optimization signal for overall training and adaptive updates, enabling the model to obtain a more stable feature structure and prediction performance under complex distribution changes.
[0096] Sub-step 2052 updates the parameters of the target data layer in the data processing model based on the joint model loss.
[0097] In some embodiments of this application, to enable the data processing model to gradually adapt to the data distribution of the target domain within a closed data space, parameter updates are performed on the target data layer based on the aforementioned joint model loss. The joint model loss integrates cross-class discriminative constraints, prediction consistency constraints, and whitening difference constraints, allowing the target data layer to balance semantic stability and feature structure diversity during the update process. This enables adaptive adjustment of the statistical characteristics of the target domain under unsupervised conditions. During parameter updates, the target data layer, as the structural unit most sensitive to the input data distribution, iteratively corrects its adjustable parameters based on the backpropagation signal of the joint model loss, enabling it to more accurately capture the statistical changes of the target domain data in the feature space. As the optimization process continues, the target data layer gradually forms a feature mapping relationship more consistent with the target domain distribution, thereby improving the model's predictive stability under different perturbation intensities, imaging conditions, or noise levels.
[0098] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model updates the target data layer based on a joint model loss. This allows the model to adapt to distributional differences arising from different devices, exposure conditions, or patient groups. Through this update process, the model gains a more robust feature perception capability in the target domain, thereby improving its reliability and generalization performance in clinical applications.
[0099] Optionally, sub-step 2052 includes the following sub-steps: Sub-step 20521: Based on the relationship between the sensitivity parameters of each data layer in the data processing model and the preset sensitivity threshold for data distribution changes, determine at least one target data layer.
[0100] The sensitivity parameter is used to characterize at least one of the following: changes in data gradient, changes in statistics, and changes in feature distribution generated by the corresponding data layer during backpropagation based on joint model loss.
[0101] In some embodiments of this application, to enable the model to focus on the structural units most sensitive to the target domain data distribution during adaptive updates, at least one target data layer is determined based on the relationship between the sensitivity parameters of each data layer in the data processing model and a preset sensitivity threshold for data distribution changes. The sensitivity parameters measure the response magnitude of a data layer during backpropagation based on joint model loss. They can reflect at least one of the following data changes: gradient changes, statistical changes, and feature distribution changes, thus comprehensively characterizing the data layer's ability to perceive input distribution perturbations. In practice, the model evaluates the sensitivity parameters of each data layer layer by layer and compares them with the preset sensitivity threshold. When the sensitivity parameter of a data layer exceeds the threshold, it indicates that the data layer has a high degree of response to distribution changes under the current target domain data and can be selected as the target data layer for subsequent parameter updates. Through this sensitivity-based selection method, the model can avoid indiscriminate updates to all data layers, thereby reducing unnecessary structural perturbations and making the adaptive process more focused, efficient, and targeted.
[0102] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model calculates sensitivity parameters for each data layer based on the backpropagation signal from the joint model loss. For example, some intermediate layers exhibit more significant gradient changes under different imaging devices or exposure conditions, and their sensitivity parameters may exceed a preset threshold, thus being selected as target data layers for subsequent updates. Through this selection mechanism, the model can prioritize adjusting the structural units most sensitive to distribution changes, thereby enhancing its adaptability in complex clinical environments.
[0103] Sub-step 20522: When the joint model loss reaches its minimum, fix the adjustable parameters of each target data layer.
[0104] In some embodiments of this application, to ensure that the target data layer maintains a stable feature mapping relationship after satisfying the joint model loss constraints, the adjustable parameters of each target data layer are fixed when the joint model loss converges to its minimum. As the optimization process iterates, the joint model loss gradually decreases and eventually reaches a preset optimum. At this point, the target data layer has formed a feature structure that matches the target domain data distribution under multiple constraints such as semantic consistency, cross-class discriminability, and feature diversity. To avoid disrupting this stable structure due to continued updates in subsequent steps, the model freezes the parameters of the target data layer at this stage, making it a fixed feature-aware module participating in subsequent inference. After the parameters are fixed, the target data layer no longer participates in gradient updates, and its output feature representation can serve as a stable basis for the model to perform prediction and feature alignment in the target domain. In this way, the model can maintain adaptability to the target domain distribution without accessing source domain data, while avoiding structural perturbations or performance fluctuations caused by excessive updates.
[0105] In a medical image analysis scenario, when processing enhanced views of chest X-ray images, the model freezes the parameters of the target data layer after the joint model loss converges. This ensures that the model outputs stable feature representations under different imaging devices, exposure conditions, or patient populations. Through this fixation mechanism, the model can maintain more reliable inference performance in clinical settings, thereby improving its overall adaptability and generalization performance.
[0106] To verify the adaptability of the proposed method in closed data spaces, closed-set adaptation experiments were conducted on mainstream benchmark datasets. Taking the Visual Domain Adaptation Challenge (VisDA-C) dataset as an example, Table 1 provides a systematic comparison between the proposed method and current state-of-the-art unsupervised domain adaptation methods and test-time adaptation methods: Table 1: Classification accuracy (%) of the method in this application on the VisDA-C training set to validation set.
[0107] The experimental results shown in Table 1 demonstrate that, in the 12 classification tasks of VisDA-C, the method of this application achieved high classification accuracy in all categories, with an overall average accuracy of 87.8%, which is about 1% higher than that of existing methods.
[0108] In the transfer learning task from training set to validation set, this application further compares the performance differences between AdaContrast and state-of-the-art unsupervised domain adaptation (UDA) methods. The results show that, during the adaptation phase without using any source domain data in the test, the proposed method still significantly outperforms other models. In the UDA task, the performance of the proposed method is also comparable to strong baseline solutions, validating its stability and effectiveness in different adaptation scenarios.
[0109] Figure 3 A schematic diagram of the WCL-based optimization process is shown, where positive sample pairs are labeled with the same shape for differentiation. Figure 3 As can be seen from 'a', in the initial stage of training, the sample distribution in the feature batch is relatively chaotic and has not yet formed a clear structure. The WCL loss calculated based on the normalized features (…) Figure 3 (b) in the above text prompts the network to gradually narrow the representation distance between positive sample pairs; as training iterations proceed, the network further clusters the positive sample pairs together. Figure 3 (c) At the same time, the overall distribution of all samples is constrained to a spherical structure, thereby achieving global whitening of features and structural alignment.
[0110] like Figure 4 The diagram shows a two-stage whitening process consisting of two consecutive steps: a local whitening stage (S1) and a global whitening stage (S2). First, the original image O is processed by the first enhancement strategy R1 and the second enhancement strategy R2 to generate the first enhanced view X1 and the second enhanced view X2, respectively. In the local whitening stage S1, multiple batches of features (denoted as X11 to X1n) of the first enhanced view X1 and multiple batches of features (denoted as X21 to X2m) of the second enhanced view X2 are subjected to whitening normalization processing based on the covariance matrix of the corresponding batches, thereby obtaining the projection features Y1 and Y2 under local statistical constraints. Subsequently, in the global whitening stage S2, the projection features Y1 obtained from the first enhanced view X1 and the projection features Y2 obtained from the second enhanced view X2 are incorporated into a unified feature space. Through the estimation of the global covariance matrix and the whitening transformation, structured alignment across enhanced views is achieved.
[0111] Through the continuous whitening process in the two stages described above, the present invention can establish an effective connection between local distribution stabilization and global structural consistency, thereby obtaining a more robust and discriminative feature representation.
[0112] In summary, in the embodiments of this application, by inputting the first and second enhanced views obtained from different perturbation intensities into the data processing model, the model can simultaneously encounter feature changes under multi-scale perturbations during the inference stage. This results in obtaining richer intermediate layer activation features and output results on unlabeled target domain data, providing a necessary diversity foundation for subsequent feature alignment and distribution constraints. Furthermore, the first whitening feature can be determined based on the intermediate layer activation features, ensuring that the edge statistics of the feature distribution remain consistent with the distribution edges of the corresponding enhanced view. Utilizing the local statistical alignment process, a more stable feature correspondence is established between different perturbed views, reducing the impact of local distribution shifts caused by changes in imaging conditions. Then, based on all the first... After projection mapping, the whitening features are used to determine the second whitening feature, making it present a hyperspherical uniform distribution. This achieves a more stable and structured feature representation at the global statistical level, effectively suppressing directional bias in the feature space. This suppresses single-point feature degradation while allowing the model to maintain high expression stability and discriminative ability even when facing complex distribution changes. Finally, a joint model loss is constructed based on the output results and the second whitening features, and the parameters of the target data layer are updated. This allows the model to adaptively adjust in a closed data space, relying only on unlabeled data in the target domain. The model balances semantic consistency and feature distribution stability during the update process, and improves the model's ability to perceive the data distribution of the target domain without accessing the statistical information of the source domain data. Therefore, based on the embodiments of this application, by introducing a two-stage feature whitening mechanism, features are effectively aligned at both the local statistical and global structural levels. Combined with the joint model loss based on the output results and whitening features, the model can obtain better adaptive ability in a closed data space, reducing the negative impact of distribution shift under data isolation conditions, thereby improving the model's generalization performance and inference stability in complex testing environments.
[0113] refer to Figure 5 This application illustrates an adaptive testing device 30 for a closed data space model based on two-stage feature whitening, as provided in an embodiment of this application, comprising: The data acquisition module 301 is used to input each enhanced view in the enhanced dataset consisting of the first enhanced view and the second enhanced view into the data processing model to obtain the intermediate layer activation features and output results corresponding to each enhanced view; the first enhanced view is obtained based on the perturbation of the corresponding original image under the first perturbation intensity range; the second enhanced view is obtained based on the perturbation of the corresponding original image under the second perturbation intensity range. The two-stage whitening module 302 is used to determine the first whitening feature corresponding to each intermediate layer activation feature, and to determine the second whitening feature corresponding to each first whitening feature after projection mapping based on all the first whitening features; the distribution edge of the first whitening feature is aligned with the distribution edge of the enhanced view; the distribution of the second whitening feature is a hyperspherical uniform distribution; The adaptive module 303 is used to update the parameters of the target data layer in the data processing model based on the joint model loss constructed from the output results and the second whitening features; the target data layer is used to perceive the data distribution of the input data.
[0114] Optionally, the two-stage whitening module 302 includes: The batch covariance submodule is used to determine the batch mean and batch covariance matrix corresponding to each batch of input data based on the intermediate layer activation features obtained by the enhanced view during each batch input data processing model. The batch whitening matrix submodule is used to determine the batch whitening transformation matrix corresponding to each batch based on the batch covariance matrix, and to perform zero-mean processing on each intermediate layer activation feature based on the batch mean of the corresponding batch. The first whitening submodule is used to linearly transform each intermediate layer activation feature after zero-mean processing according to the batch whitening transformation matrix of the corresponding batch to obtain the corresponding first whitening feature.
[0115] Optionally, the two-stage whitening module 302 includes: The projection submodule is used to update the parameters of the projection mapping layer based on the whitening contrast loss constructed from the projection features of the first whitening feature in the projection mapping layer of the data processing model, and to obtain the target projection feature of each first whitening feature from the updated projection mapping layer. The global matrix submodule is used to determine the global mean and global covariance matrix of all the target projection features, and to determine the global whitening transformation matrix of the target projection features based on the global covariance matrix. The second whitening submodule is used to perform an offset operation on each target projection feature according to the global mean, and to perform a linear transformation according to the global whitening transformation matrix to obtain the corresponding second whitening feature.
[0116] Optionally, the projection submodule includes: The whitening contrast loss unit is used to establish the whitening contrast loss of the projection mapping layer based on the first constraint and the second constraint. The first constraint is used to avoid the feature distribution of the projection features from degenerating to a single point distribution. The second constraint is used to make the projection features corresponding to different enhanced views of the same original image satisfy the preset semantic aggregation relationship. The whitening learning unit is used to fix the adjustable parameters of the projection mapping layer while minimizing the whitening contrast loss.
[0117] Optionally, the adaptive module 303 includes: The joint loss submodule is used to establish a joint model loss for the target data layer based on the third, fourth, and fifth constraints. The third constraint is used to reduce the interference of similar negative samples generated by the various enhanced views obtained based on the same perturbation on the data processing model. The fourth constraint is used to ensure that the output results of different enhanced views corresponding to the same original image meet a preset prediction consistency relationship. The fifth constraint is used to ensure that the second whitening features corresponding to different original images meet a preset whitening difference relationship. The adaptive submodule is used to update the parameters of the target data layer in the data processing model based on the joint model loss.
[0118] Optional, the adaptive submodule includes: The data layer determination unit is used to determine at least one target data layer based on the relationship between the sensitivity parameters of each data layer in the data processing model and the preset data distribution change sensitivity threshold. The sensitivity parameters are used to characterize at least one of the data gradient change, statistical change, and feature distribution change generated by the corresponding data layer during the backpropagation process based on the joint model loss. An adaptive unit is used to fix the adjustable parameters of each target data layer when the joint model loss is minimized.
[0119] Optionally, the adaptive testing device 30 for closed data space models based on two-stage feature whitening also includes: An enhancement module is used to perform a first enhancement on each original image in the dataset to be enhanced, to obtain a first enhanced view of each original image, and to perform a second enhancement on each original image in the dataset to be enhanced, to obtain a second enhanced view of each original image; The dataset module is used to integrate each corresponding first augmented view and each corresponding second augmented view as an augmented view to obtain an augmented dataset.
[0120] Optional enhancement modules include: The first enhancement submodule is used to perform at least one of random flipping, cropping, and brightness adjustment processing on the original image to obtain a first enhanced view corresponding to the original image.
[0121] Optional enhancement modules include: The second enhancement submodule is used to perform at least two of the following on the original image: color perturbation processing, noise injection processing, blur processing, and shear transformation processing, to obtain a second enhanced view corresponding to the original image.
[0122] In summary, in the embodiments of this application, by inputting the first and second enhanced views obtained from different perturbation intensities into the data processing model, the model can simultaneously encounter feature changes under multi-scale perturbations during the inference stage. This results in obtaining richer intermediate layer activation features and output results on unlabeled target domain data, providing a necessary diversity foundation for subsequent feature alignment and distribution constraints. Furthermore, the first whitening feature can be determined based on the intermediate layer activation features, ensuring that the edge statistics of the feature distribution remain consistent with the distribution edges of the corresponding enhanced view. Utilizing the local statistical alignment process, a more stable feature correspondence is established between different perturbed views, reducing the impact of local distribution shifts caused by changes in imaging conditions. Then, based on all the first... After projection mapping, the whitening features are used to determine the second whitening feature, making it present a hyperspherical uniform distribution. This achieves a more stable and structured feature representation at the global statistical level, effectively suppressing directional bias in the feature space. This suppresses single-point feature degradation while allowing the model to maintain high expression stability and discriminative ability even when facing complex distribution changes. Finally, a joint model loss is constructed based on the output results and the second whitening features, and the parameters of the target data layer are updated. This allows the model to adaptively adjust in a closed data space, relying only on unlabeled data in the target domain. The model balances semantic consistency and feature distribution stability during the update process, and improves the model's ability to perceive the data distribution of the target domain without accessing the statistical information of the source domain data. Therefore, based on the embodiments of this application, by introducing a two-stage feature whitening mechanism, features are effectively aligned at both the local statistical and global structural levels. Combined with the joint model loss based on the output results and whitening features, the model can obtain better adaptive ability in a closed data space, reducing the negative impact of distribution shift under data isolation conditions, thereby improving the model's generalization performance and inference stability in complex testing environments.
[0123] Reference Figure 6 The electronic device 500 may include one or more of the following components: processing component 502, memory 504, power supply component 506, multimedia component 508, audio component 510, input / output (I / O) interface 512, sensor component 514, and communication component 516.
[0124] Processing component 502 typically controls the overall operation of electronic device 500, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 502 may include one or more modules to facilitate interaction between processing component 502 and other components. For example, processing component 502 may include a multimedia module to facilitate interaction between multimedia component 508 and processing component 502.
[0125] Memory 504 is used to store various types of data to support the operation of electronic device 500. Examples of this data include instructions for any application or method operating on electronic device 500, contact data, phonebook data, messages, pictures, multimedia, etc. Memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0126] Power supply component 506 provides power to various components of electronic device 500. Power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 500.
[0127] Multimedia component 508 includes an interface that provides an output interface between electronic device 500 and user. In some embodiments, the interface may include a liquid crystal display (LCD) and a touch panel (TP). If the interface includes a touch panel, the interface may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 508 includes a front-facing camera and / or a rear-facing camera. When electronic device 500 is in an operating mode, such as shooting mode or multimedia mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0128] Audio component 510 is used to output and / or input audio signals. For example, audio component 510 includes a microphone (MIC) used to receive external audio signals when electronic device 500 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 504 or transmitted via communication component 516. In some embodiments, audio component 510 also includes a speaker for outputting audio signals.
[0129] Input / output (I / O) interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0130] Sensor assembly 514 includes one or more sensors for providing state assessments of various aspects of electronic device 500. For example, sensor assembly 514 may detect the on / off state of electronic device 500, the relative positioning of components such as the display and keypad of electronic device 500, changes in position of electronic device 500 or a component of electronic device 500, the presence or absence of user contact with electronic device 500, orientation or acceleration / deceleration of electronic device 500, and temperature changes of electronic device 500. Sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 514 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0131] Communication component 516 facilitates wired or wireless communication between electronic device 500 and other devices. Electronic device 500 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 516 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 516 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0132] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to implement the methods provided in the embodiments of this application.
[0133] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including instructions, which can be executed by a processor 520 of an electronic device 500 to perform the above-described method. For example, the non-transitory storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0134] In an exemplary embodiment, the electronic device 500 may also be provided as a server, including a processing component 502, which further includes one or more processors, and memory resources represented by memory 504 for storing instructions, such as applications, that can be executed by the processing component 502. The applications stored in memory 504 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 502 is configured to execute instructions to perform the methods provided in the embodiments of this application.
[0135] Electronic device 500 may also include a power supply component 506 configured to perform power management of electronic device 500, a wired or wireless communication component 516 configured to connect electronic device 500 to a network, and an input / output (I / O) interface 512. Electronic device 500 may operate on an operating system stored in memory 504, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0136] It should be noted that, for the sake of simplicity, the method embodiments of this application are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of this application.
[0137] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0138] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. An adaptive testing method for closed data space models based on two-stage feature whitening, characterized in that, include: Each augmented view in the augmented dataset, which consists of the first augmented view and the second augmented view, is input into the data processing model to obtain the intermediate layer activation features and output results corresponding to each augmented view. The first enhanced view is obtained based on the perturbation of the corresponding original image under a first perturbation intensity range; The second enhanced view is obtained based on the perturbation of the corresponding original image within the second perturbation intensity range; A first whitening feature is determined corresponding to each of the intermediate layer activation features, and a second whitening feature is determined corresponding to each of the first whitening features after projection mapping based on all the first whitening features; the distribution edges of the first whitening features are aligned with the distribution edges of the enhanced view; the distribution of the second whitening features is a hyperspherical uniform distribution; Based on the joint model loss constructed from the output and the second whitening feature, the parameters of the target data layer in the data processing model are updated; the target data layer is used to perceive the data distribution of the input data.
2. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 1, characterized in that, The determination of the first whitening feature corresponding to each of the intermediate layer activation features includes: Based on the intermediate layer activation features obtained by the enhanced view during each batch input of the data processing model, the batch mean and batch covariance matrix corresponding to each batch of the batch input are determined. Each batch whitening transformation matrix corresponding to each batch is determined based on the batch covariance matrix, and each intermediate layer activation feature is zero-mean processed based on the batch mean of the corresponding batch. Each of the intermediate layer activation features after zero-mean processing is linearly transformed according to the batch whitening transformation matrix of the corresponding batch to obtain the corresponding first whitening feature.
3. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 1, characterized in that, The step of determining the second whitening feature corresponding to each of the first whitening features based on all the first whitening features includes: Based on the whitening contrast loss constructed from the projection features of the first whitening feature in the projection mapping layer of the data processing model, the parameters of the projection mapping layer are updated, and the target projection features of each first whitening feature are obtained from the updated projection mapping layer. Determine the global mean and global covariance matrix of all the target projection features, and determine the global whitening transformation matrix of the target projection features based on the global covariance matrix; Each of the target projection features is offset according to the global mean and linearly transformed according to the global whitening transformation matrix to obtain the corresponding second whitening feature.
4. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 3, characterized in that, The parameter update of the projection mapping layer based on the whitening contrast loss constructed from the projection features of the first whitening feature in the projection mapping layer of the data processing model includes: A whitening contrast loss for the projection mapping layer is established based on a first constraint and a second constraint. The first constraint is used to prevent the feature distribution of the projection features from degenerating to a single-point distribution. The second constraint is used to ensure that the projection features corresponding to different enhanced views of the same original image satisfy a preset semantic aggregation relationship. When the whitening contrast loss reaches its minimum value, the adjustable parameters of the projection mapping layer are fixed.
5. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 1, characterized in that, The parameter update of the target data layer in the data processing model based on the joint model loss constructed from the output result and the second whitening feature includes: A joint model loss for the target data layer is established based on the third, fourth, and fifth constraints; the third constraint is used to reduce the interference of similar negative samples generated by the various enhanced views obtained based on the same perturbation on the data processing model; the fourth constraint is used to ensure that the output results of different enhanced views corresponding to the same original image satisfy a preset prediction consistency relationship; the fifth constraint is used to ensure that the second whitening features corresponding to different original images satisfy a preset whitening difference relationship. The parameters of the target data layer in the data processing model are updated based on the joint model loss.
6. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 5, characterized in that, The step of updating the parameters of the target data layer in the data processing model based on the joint model loss includes: Based on the relationship between the sensitivity parameters of each data layer in the data processing model and the preset data distribution change sensitivity threshold, at least one target data layer is determined; the sensitivity parameters are used to characterize at least one of the data gradient change, statistical change, and feature distribution change generated by the corresponding data layer during backpropagation based on the joint model loss. When the joint model loss reaches its minimum, the adjustable parameters of each of the target data layers are fixed.
7. The adaptive testing method for closed data space models based on two-stage feature whitening as described in claim 1, characterized in that, The adaptive testing method for closed data space models based on two-stage feature whitening also includes: A first enhancement is performed on each original image in the dataset to be enhanced to obtain a first enhanced view of each original image, and a second enhancement is performed on each original image in the dataset to be enhanced to obtain a second enhanced view of each original image; Each of the first enhanced view and each of the second enhanced views is integrated as an enhanced view to obtain the enhanced dataset.
8. An adaptive testing device for closed data space models based on two-stage feature whitening, characterized in that, include: The data acquisition module is used to input each enhanced view in the enhanced dataset consisting of the first enhanced view and the second enhanced view into the data processing model to obtain the intermediate layer activation features and output results corresponding to each enhanced view. The first enhanced view is obtained based on the perturbation of the corresponding original image under a first perturbation intensity range; The second enhanced view is obtained based on the perturbation of the corresponding original image within the second perturbation intensity range; A two-stage whitening module is used to determine a first whitening feature corresponding to each of the intermediate layer activation features, and to determine a second whitening feature corresponding to each of the first whitening features after projection mapping based on all the first whitening features; the distribution edges of the first whitening features are aligned with the distribution edges of the enhanced view; the distribution of the second whitening features is a hyperspherical uniform distribution; An adaptive module is used to update the parameters of the target data layer in the data processing model based on the joint model loss constructed from the output and the second whitening feature; the target data layer is used to perceive the data distribution of the input data.
9. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the adaptive method for testing a closed data space model based on two-stage feature whitening as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the adaptive method for testing a closed data space model based on two-stage feature whitening as described in any one of claims 1 to 7.
Citation Information
Patent Citations
A double-channel adaptive correction network optimizing system based on a feature generalization layer
CN108537324A
Parameter-extensible multi-modal task continuous learning method and device
CN120338045A
Hyperspectral image open set classification method and device based on fractional domain information enhancement and hypersphere prototype learning strategy
CN120339707A
Edge-end collaborative AI model construction system and method for energy consumption prediction
CN120974055A
Training a neural network using stochastic whitening batch normalization
US20220121909A1