Model architecture adaptive reconstruction method for data distribution shift

By extracting features layer by layer and calculating distribution offset scores, a hierarchical architecture reconstruction strategy is determined. Gradient-free forward propagation is used for adaptive adjustment of network layers, which solves the problems of general model transfer and high computational overhead between different network architectures and achieves efficient adaptive reconstruction of model architecture.

CN123180252APending Publication Date: 2026-11-27HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611511239.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-28
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies are difficult to universally migrate between different network architectures, and traditional domain adaptation methods have high computational overhead and high memory consumption, and cannot effectively cope with the performance degradation of models caused by data distribution shifts.

Method used

By extracting features from the source and target domains layer by layer, calculating and normalizing the distribution offset score, determining the hierarchical architecture reconstruction strategy, using gradient-free forward propagation for adaptive reconstruction of network layers, and inserting lightweight or deep feature distribution reconstruction modules to achieve feature distribution correction.

Benefits of technology

To achieve adaptive reconstruction and prediction of model architecture in unknown target environments, reduce computational and storage overhead, avoid underfitting or overfitting, and maintain the original expressive power of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180252A_ABST
    Figure CN123180252A_ABST
Patent Text Reader

Abstract

The application relates to a model architecture adaptive reconstruction method for data distribution deviation, which specifically comprises the following steps: loading a source domain data set and a pre-trained visual network, extracting intermediate features output by each network layer of the pre-trained visual network, and calculating source domain feature mean values and covariance matrices of each layer; receiving target domain input data, performing first gradient-free forward propagation, and extracting target domain features of each network layer; calculating source domain and target domain distribution deviation scores of each network layer, obtaining adaptive reconstruction weights of each network layer; determining a layered architecture reconstruction strategy of the pre-trained visual network; performing network architecture reconstruction, performing second gradient-free forward propagation on the target domain input data, and performing weighted fusion of original target domain features and reconstruction features on network layers performing the reconstruction strategy, and outputting a final prediction result of the target domain. The whole scheme can realize model architecture adaptive reconstruction and result prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of visual model technology, and in particular to a method, apparatus, computer device, storage medium and computer program product for adaptive reconstruction of model architecture oriented to data distribution offset. Background Technology

[0002] In practical applications such as intelligent sensing, industrial inspection, autonomous driving, and edge intelligence, visual models such as convolutional neural networks and visual Transformers are widely deployed. However, real-world operating environments are subject to factors such as changes in lighting, differences in acquisition equipment, noise interference, and task scene migration, causing a shift in the distribution of source domain data during model training compared to the distribution of target domain data after deployment. This data distribution shift causes the features extracted by each network layer of the model to gradually deviate from the source domain feature space, reducing inference performance. Therefore, it is necessary to adaptively adjust the model architecture to maintain the model's stability in dynamic environments.

[0003] Traditional domain adaptation methods are typically tied to specific backbone network architectures, such as designing adaptation modules separately for convolutional neural networks or visual Transformers, making it difficult to generalize and transfer between different network architectures. Furthermore, existing adaptive methods for testing often rely on backpropagation to update model parameters, resulting in high computational overhead and memory consumption. Pure forward-based adaptive methods, on the other hand, often require multiple inferences, making it difficult to meet low latency requirements. In addition, existing architecture adaptation methods generally employ a uniform parameter update or module adjustment strategy, ignoring the differences in the degree to which different network layers are affected by distribution shifts. This can easily lead to under-adaptation or over-adjustment of some network layers, resulting in a decrease in the original expressive power of the model.

[0004] Therefore, traditional techniques struggle to achieve adaptive reconstruction of model architectures to accommodate data distribution shifts. Summary of the Invention

[0005] Therefore, it is necessary to provide an effective method, apparatus, computer device, computer-readable storage medium, and computer program product for adaptive reconstruction of model architecture oriented towards data distribution offset, in response to the above-mentioned technical problems.

[0006] Firstly, this application provides an adaptive reconstruction method for model architecture oriented towards data distribution shifts. The method includes: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. Receive the target domain input data, perform the first gradient-free forward propagation, and extract the target domain features of each network layer; calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. Based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined. The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data. The original target domain features and reconstructed features are weighted and fused according to the adaptive reconstruction weights of the network layers that have implemented the reconstruction strategy, and the final prediction result of the target domain is output.

[0007] In one embodiment, determining the hierarchical architecture reconstruction strategy of the pre-trained visual network based on the distribution offset scores of each network layer includes: A hierarchical architecture reconstruction strategy is executed based on the distribution offset score of each network layer and the preset first offset threshold and second offset threshold, wherein the first offset threshold is less than the second offset threshold. Network layers whose distribution offset scores are lower than or equal to the first offset threshold are identified as low offset layers, and their original computation paths are maintained. Network layers with distribution offset scores higher than the first offset threshold and lower than the second offset threshold are defined as medium offset layers, and lightweight distribution offset adaptation modules are inserted into medium offset layers. Network layers with distribution offset scores higher than or equal to the second offset threshold are identified as high offset layers. A deep feature distribution reconstruction strategy is performed on high offset layers, and the target domain features are transferred to the source domain feature distribution through WCT whitening-coloring transformation.

[0008] In one embodiment, the network architecture is reconstructed according to a determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data, and the original target domain features and reconstructed features are weighted and fused according to adaptive reconstruction weights on the network layers implementing the reconstruction strategy. The final prediction result of the target domain is output, including: Generate K view samples based on the target domain input data; The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy, and a second gradient-free forward propagation is performed on the K view samples. For the network layer that executes the reconstruction strategy, the original target domain features and the reconstructed features are weighted and fused according to the adaptive reconstruction weights to obtain the prediction results corresponding to each view sample; The prediction results corresponding to K view samples are fused by mean fusion, and the final prediction result of the target domain is output.

[0009] In one embodiment, the distribution offset adaptation module includes at least one of a lightweight feature mapping unit, a feature transformation unit, and a fusion unit.

[0010] In one embodiment, target domain input data is received, a first gradient-free forward propagation is performed, and target domain features of each network layer are extracted. Based on the source domain hierarchical statistics library, the source domain to target domain distribution offset score of each network layer is calculated, and the distribution offset score is normalized to obtain the adaptive reconstruction weights of each network layer, including: Receive input data from the target domain; Perform the first gradient-free forward propagation to extract target domain features from each network layer; Based on the source domain hierarchical statistical database, the NAMMD (Normalized Adaptive Maximum Mean Discrepancy) method is used to calculate the source domain and target domain distribution offset scores for each network layer. The distribution offset score is normalized to obtain the adaptive reconstruction weights of each network layer; The calculation formula corresponding to the NAMMD method is as follows: in, The maximum mean difference is the standard deviation, and the upper bound of the bounded translation-invariant kernel is given. Represents the source domain feature distribution. Represents the distribution of features in the target domain. and denoted as the embedding norms of the source and target domains in the regenerated kernel Hilbert space RKHS, respectively.

[0011] In one embodiment, the above-described adaptive reconstruction method for model architecture oriented towards data distribution offset further includes: The target domain features extracted by the second gradient-free forward propagation are updated using the exponential moving average mechanism to update the target domain feature statistics. Calculate the prediction entropy based on the final prediction result of the target domain; When a sudden change in predicted entropy is detected that exceeds a preset change threshold, the target domain feature statistics are reset. Among them, the target domain feature statistics are the mean and covariance matrix of the target domain features of each network layer; when calculating the distribution offset score of the next target domain input data, the source domain feature statistics in the source domain hierarchical statistical library and the target domain feature statistics are used as input together.

[0012] In one embodiment, the prediction entropy is calculated based on the final prediction result of the target domain. When a sudden change in the prediction entropy is detected to exceed a preset change threshold, the target domain feature statistics are reset, including: Obtain the average prediction entropy statistic of historical records prior to the current target domain input data. ; Based on the final prediction result of the target domain corresponding to the input data of this target domain, calculate the average prediction entropy corresponding to the input data of this target domain. ; If the average prediction entropy Greater than the average prediction entropy statistic Compared with the preset entropy change threshold If the sum of these values ​​is used, a sudden distribution shift is determined, and the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the target domain input data.

[0013] Secondly, this application also provides an adaptive reconstruction device for model architecture oriented towards data distribution shift. The device includes: The initialization module is used to load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. The offset scoring module is used to receive the target domain input data, perform the first gradient-free forward propagation, extract the target domain features of each network layer, calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. The reconstruction strategy determination module is used to determine the hierarchical architecture reconstruction strategy of the pre-trained visual network based on the distribution offset scores of each network layer. The fusion prediction module is used to reconstruct the network architecture according to the determined hierarchical architecture reconstruction strategy. It performs a second gradient-free forward propagation on the target domain input data and weights the original target domain features and reconstructed features on the network layer that performs the reconstruction strategy according to the adaptive reconstruction weights, and outputs the final prediction result of the target domain.

[0014] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. Receive the target domain input data, perform the first gradient-free forward propagation, and extract the target domain features of each network layer; calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. Based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined. The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data. The original target domain features and reconstructed features are weighted and fused according to the adaptive reconstruction weights of the network layers that have implemented the reconstruction strategy, and the final prediction result of the target domain is output.

[0015] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. Receive the target domain input data, perform the first gradient-free forward propagation, and extract the target domain features of each network layer; calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. Based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined. The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data. The original target domain features and reconstructed features are weighted and fused according to the adaptive reconstruction weights of the network layers that have implemented the reconstruction strategy, and the final prediction result of the target domain is output.

[0016] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. Receive the target domain input data, perform the first gradient-free forward propagation, and extract the target domain features of each network layer; calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. Based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined. The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data. The original target domain features and reconstructed features are weighted and fused according to the adaptive reconstruction weights of the network layers that have implemented the reconstruction strategy, and the final prediction result of the target domain is output.

[0017] The aforementioned adaptive reconstruction method, apparatus, computer device, storage medium, and computer program product for model architecture oriented towards data distribution shifts quantifies the degree to which different network layers are affected by data distribution shifts by extracting source and target domain features layer by layer and calculating the distribution shift score of each network layer. Based on the shift score of each layer, a hierarchical architecture reconstruction strategy is determined, ensuring that network layers with lower shifts maintain their original computational paths while applying corresponding reconstruction processing to network layers with higher shifts. This achieves differentiated adaptive adjustment for different network layers, avoiding underfitting or overfitting caused by uniform adjustments. Simultaneously, during the second gradient-free forward propagation, the network layers implementing the reconstruction strategy are weighted and fused with the original target domain features and reconstructed features according to adaptive reconstruction weights, correcting feature distribution distortions while preserving the model's original expressive power. The entire reconstruction and inference process is completed through only two gradient-free forward propagations, eliminating the need for backpropagation and model retraining, enabling adaptive reconstruction and prediction of the model architecture in unknown target environments. Attached Figure Description

[0018] Figure 1 This is an application environment diagram of a model architecture adaptive reconstruction method oriented towards data distribution offset in one embodiment; Figure 2 This is a flowchart illustrating an adaptive reconstruction method for model architecture oriented towards data distribution offset in one embodiment. Figure 3 This is a flowchart illustrating an adaptive reconstruction method for model architecture oriented towards data distribution offset in another embodiment. Figure 4 This is a schematic diagram of a sub-process for determining the hierarchical architecture reconstruction strategy of a pre-trained visual network based on the distribution offset scores of each network layer in a specific application example. Figure 5 This is a structural block diagram of a model architecture adaptive reconstruction device oriented towards data distribution offset in one embodiment; Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0020] The adaptive reconstruction method for model architecture oriented by data distribution offset provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on another network server. Terminal 102 sends an adaptive reconstruction request for the model architecture based on data distribution offset to server 104. Server 104 responds to the request, loads the source domain dataset and the pre-trained visual network, performs layer-by-layer forward propagation on the source domain dataset, extracts intermediate features from the output of each network layer of the pre-trained visual network, calculates the mean and covariance matrix of the source domain features of each layer, and constructs a source domain hierarchical statistical library. It receives the target domain input data, performs the first gradient-free forward propagation, and extracts the target domain features of each network layer. Based on the source domain hierarchical statistical library, it calculates the source domain and target domain distribution offset scores for each network layer, normalizes the distribution offset scores, and obtains the adaptive reconstruction weights for each network layer. Based on the distribution offset scores of each network layer, it determines the hierarchical architecture reconstruction strategy for the pre-trained visual network. It completes the network architecture reconstruction according to the determined hierarchical architecture reconstruction strategy, performs a second gradient-free forward propagation on the target domain input data, and weights and fuses the original target domain features and reconstructed features for the network layers executing the reconstruction strategy according to the adaptive reconstruction weights, outputting the final prediction result for the target domain. Furthermore, server 104 can deploy the reconstructed model to terminal 102, and can also feed back the final prediction results of the target domain to terminal 102. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle systems, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0021] In one embodiment, such as Figure 2 As shown, an adaptive reconstruction method for model architecture oriented towards data distribution offset is provided, which is then applied to... Figure 1 Taking server 104 as an example, the following steps are included: S200: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library.

[0022] A source domain dataset refers to the data set used to train a pre-trained visual network or to extract source domain feature distribution information. The pre-trained visual network can be any visual model, such as a convolutional neural network or a visual Transformer. Here, performing layer-by-layer forward propagation on the source domain dataset means inputting the source domain data into the pre-trained visual network and obtaining the intermediate features output by each network layer during the forward propagation process. Since visual networks typically contain multiple network layers, and the features output by different network layers have different semantic levels and statistical properties, layer-by-layer extraction is necessary.

[0023] For each network layer, the mean and covariance matrix of its output features are calculated as statistical descriptions of the source domain feature distribution for that layer. The mean reflects the average response level of the layer's features across each dimension, while the covariance matrix reflects the correlation and dispersion among the dimensions of the layer's features. The mean and covariance matrices of each network layer are organized and stored according to the network hierarchy, thus constructing a source domain-level statistical library. This library can be pre-calculated and saved offline and directly accessed during deployment, eliminating the need to access the original source domain samples, thereby reducing storage overhead and improving data security. During subsequent online inference, the statistics in the source domain-level statistical library will serve as a benchmark for comparative analysis with the target domain feature distribution.

[0024] S400: Receives target domain input data, performs the first gradient-free forward propagation, extracts target domain features of each network layer; calculates the source domain and target domain distribution offset score of each network layer according to the source domain hierarchical statistics library, and normalizes the distribution offset score to obtain the adaptive reconstruction weights of each network layer.

[0025] The target domain input data can be actual image data received after model deployment, such as road images captured by vehicle cameras in autonomous driving scenarios, product surface images captured by industrial cameras in industrial inspection scenarios, or video frame images captured by fixed cameras in security monitoring scenarios. Due to factors such as acquisition equipment, lighting conditions, shooting angle, and environmental noise, the data distribution of these image data may differ from the source domain image data used during model training, resulting in data distribution shift. In this step, after receiving the target domain input data, the first gradient-free forward propagation is performed. Gradient-free forward propagation means that gradients are not calculated during the forward computation; only feature extraction and forward propagation are performed, thus avoiding the need to save intermediate activation values ​​and gradient information, reducing computational load and GPU memory usage. During the first gradient-free forward propagation, target domain features of each network layer are extracted. Then, based on the source domain hierarchical statistical library constructed in S100, the source domain and target domain distribution shift score for each network layer is calculated. This shift score quantifies the degree of deviation of the target domain feature distribution of each layer from the source domain feature distribution; a larger score indicates a more severe impact of distribution shift on that layer. The offset score can be calculated using any suitable distribution difference metric, such as maximum mean difference, KL divergence, Wasserstein distance, etc. In one embodiment, normalized maximum mean difference (NAMMD) can be used as the offset score to enhance the comparability between different feature layers. After obtaining the distribution offset scores for each network layer, the scores are normalized to obtain the adaptive reconstruction weights corresponding to each network layer. Normalization can be performed using softmax, min-max, or other methods to ensure that the weights of each layer fall within a specific interval. The adaptive reconstruction weights are used to control the fusion ratio between the original target domain features and the reconstructed features in subsequent steps; a larger weight indicates that the layer requires stronger reconstruction adjustments.

[0026] S600: Determine the hierarchical architecture reconstruction strategy of the pre-trained visual network based on the distribution offset score of each network layer.

[0027] Based on the distribution offset scores of each network layer, a hierarchical architecture reconstruction strategy for the pre-trained visual network is determined. Since different network layers have varying sensitivities to and degrees of influence from distribution offsets, a separate decision needs to be made for each layer, selecting whether to adjust and the strength of the adjustment. The hierarchical architecture reconstruction strategy can be categorized based on preset offset thresholds. For example, the offset score can be compared with one or more thresholds to classify network layers into different offset levels, and different adjustment measures can be taken for network layers of different levels. For instance, for network layers with low offset scores, their original computational paths can be kept unchanged; for network layers with intermediate offset scores, lightweight adaptation modules can be inserted for moderate adjustments; and for network layers with high offset scores, deeper feature distribution reconstruction is required. The specific number of thresholds and the classification method can be set according to actual needs. The results of the hierarchical architecture reconstruction strategy can be recorded as reconstruction strategy identifiers for each network layer, used to guide subsequent network architecture reconstruction operations. Simultaneously, the adaptive reconstruction weights obtained in S200 can be further used to determine the fusion ratio between the original features and reconstructed features of that layer, achieving gradual adjustment.

[0028] S800: Completes network architecture reconstruction according to the determined hierarchical architecture reconstruction strategy, performs a second gradient-free forward propagation on the target domain input data, and weights and fuses the original target domain features and reconstructed features on the network layers that have implemented the reconstruction strategy according to the adaptive reconstruction weights, and outputs the final prediction result of the target domain.

[0029] In step S600, the hierarchical architecture reconstruction strategy for each network layer has been determined based on the distribution offset score of each network layer. This includes determining which network layers maintain their original computation paths, which layers require the insertion of lightweight distribution offset adaptation modules, and which layers need to perform deep feature distribution reconstruction. Here, the pre-trained visual network is adjusted at the architectural level according to the determined strategies to form a dynamically reconstructed network that adapts to the current target domain data distribution. This dynamically reconstructed network is obtained by inserting or configuring corresponding modules layer by layer based on the original pre-trained visual network structure. It is a temporary network structure for the current target domain input data and does not change the parameters of the pre-trained visual network itself.

[0030] After the network architecture reconstruction is completed, a second gradient-free forward propagation is performed on the target domain input data. The difference between this second and first gradient-free forward propagation is that the first propagation is performed on the original network structure to extract target domain features from each layer and calculate offset scores; while the second propagation is performed on the reconstructed network structure. Its purpose is to simultaneously correct the feature distribution during feature extraction, thereby obtaining output features adapted to the current target domain distribution and ultimately obtaining the target domain prediction result. Since the entire process does not involve gradient calculation, there is no need to save intermediate activation values ​​and gradient information, reducing computational and storage overhead. During the second gradient-free forward propagation, for network layers determined to implement the reconstruction strategy, such as medium-offset and high-offset layers, their output features do not directly adopt the original target domain features. Instead, the original target domain features and the reconstructed features are weighted and fused according to the adaptive reconstruction weights corresponding to that network layer. Here, the original target domain features refer to the features directly calculated by the network layer during the second forward propagation; the reconstructed features refer to the features obtained after processing by the network layer through its corresponding reconstruction module. This reconstruction module can be a lightweight distribution offset adaptation module or a deep feature distribution reconstruction module, etc., specifically determined by the reconstruction strategy corresponding to the network layer. The weights used in the weighted fusion are the adaptive reconstruction weights obtained in step S400 based on the distribution offset score normalization. These weights reflect the degree to which the corresponding network layer is affected by the target domain data distribution offset; a larger weight indicates that the network layer requires stronger reconstruction adjustments.

[0031] The aforementioned adaptive reconstruction method for model architecture oriented towards data distribution shifts quantifies the degree to which different network layers are affected by data distribution shifts by extracting source and target domain features layer by layer and calculating the distribution shift score for each network layer. Based on the shift score of each layer, a hierarchical architecture reconstruction strategy is determined, ensuring that network layers with lower shifts maintain their original computational paths while applying corresponding reconstruction processing to network layers with higher shifts. This achieves differentiated adaptive adjustment for different network layers, avoiding underfitting or overfitting caused by uniform adjustments. Simultaneously, during the second gradient-free forward propagation, the network layers implementing the reconstruction strategy are weighted and fused with the original target domain features and reconstructed features according to adaptive reconstruction weights, correcting feature distribution distortions while preserving the model's original expressive power. The entire reconstruction and inference process is completed through only two gradient-free forward propagations, eliminating the need for backpropagation and model retraining, enabling adaptive reconstruction and prediction of the model architecture in unknown target environments.

[0032] In one embodiment, such as Figure 3 As shown, based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined as follows: S610: Execute a hierarchical architecture reconstruction strategy based on the distribution offset score of each network layer and the preset first offset threshold and second offset threshold, where the first offset threshold is less than the second offset threshold; The distribution offset score, previously calculated, characterizes the degree to which each network layer is affected by the distribution offset of the target domain data. The first offset threshold and the second offset threshold are pre-set judgment thresholds used to classify each network layer into different levels according to the degree of offset. The first offset threshold is lower than the second offset threshold, and together they define three intervals: low offset, medium offset, and high offset. The specific values ​​of the thresholds can be set according to the actual application scenario, model structure, and historical experience, or they can be adaptively determined based on the statistical results of the source domain data distribution on the validation set.

[0033] S620: Network layers with distribution offset scores lower than or equal to the first offset threshold are identified as low offset layers, and their original computation paths are maintained.

[0034] When the distribution offset score of a network layer is less than or equal to the first offset threshold, it indicates that the target domain features output by that network layer have a high consistency with the source domain feature distribution and are less affected by the target domain distribution offset. In this case, the network layer is identified as a low-offset layer. For low-offset layers, their original computation path remains unchanged; that is, the original feature transformation method of that network layer in the pre-trained visual network continues to process the input features without inserting additional adaptation or reconstruction modules. This maximizes the preservation of the model's original feature representation ability and inference efficiency without significant shift in feature distribution, avoiding performance degradation caused by unnecessary structural adjustments.

[0035] S630: Network layers with distribution offset scores higher than the first offset threshold and lower than the second offset threshold are identified as medium offset layers, and lightweight distribution offset adaptation modules are inserted into medium offset layers.

[0036] When the distribution offset score of a network layer is higher than the first offset threshold but lower than the second offset threshold, it indicates that the network layer is affected by the target domain distribution offset to a certain extent, but the offset degree has not yet reached the level requiring deep reconstruction. This network layer is identified as a medium offset layer. For medium offset layers, a lightweight distribution offset adaptation module is inserted into its original computation path. By adding fewer parameters and less computation, the distribution of the features output by the network layer is moderately corrected, making it closer to the feature distribution of the source domain. The lightweight distribution offset adaptation module can be implemented using various structures, as long as it can adjust the feature distribution with a small computational overhead. Specifically, the distribution offset adaptation module can include at least one of a lightweight feature mapping unit, a feature transformation unit, and a fusion unit. The lightweight feature mapping unit can perform nonlinear mapping of features using a small number of convolutional kernels or fully connected layers; the feature transformation unit can adjust the statistical properties of the features, such as the mean and variance; and the fusion unit is used to fuse the adjusted features with the original features. Optionally, the feature transformation unit can be implemented using lightweight structures such as depthwise separable convolutions or bottleneck mapping structures to reduce additional computational overhead.

[0037] S640: Network layers with distribution offset scores higher than or equal to the second offset threshold are identified as high offset layers. A deep feature distribution reconstruction strategy is performed on high offset layers, and the target domain features are transferred to the source domain feature distribution through WCT whitening-coloring transformation.

[0038] When the distribution offset score of a network layer is higher than or equal to the second offset threshold, it indicates that the network layer is severely affected by the target domain distribution offset, and the original feature transformation path can no longer adequately adapt to the current target domain environment. This network layer is identified as a high-offset layer. For high-offset layers, a deep feature distribution reconstruction strategy is executed to perform more in-depth distribution correction on the target domain features. This deep feature distribution reconstruction strategy can be implemented using WCT (Whitening and Coloring Transform). The basic principle of WCT is: first, the target domain features are whitened to remove the correlation between channels and normalize the feature variance; then, the whitened features are colored according to the covariance structure of the source domain features, re-attributing the target domain features to the statistical properties of the source domain features. Through whitening and coloring transformation, the reconstructed target domain features can migrate towards the source domain feature distribution in terms of mean, variance, and feature correlation structure, thereby effectively eliminating feature distortion caused by severe offset.

[0039] In practical applications, two offset thresholds are preset. and According to the offset score The relationship with the threshold divides the network layer into low-offset, medium-offset, and high-offset levels, such as... Figure 4 As shown: For low-offset level network layers, i.e. For the network layer with a high degree of offset, it is assumed that the feature distribution of this network layer maintains a high consistency with the source domain. Therefore, the original network structure is kept unchanged, and the original feature representation ability of the pre-trained model is directly utilized to avoid unnecessary structural adjustments that could degrade model performance. For the mid-offset level network layer, i.e. The network layer is considered to have a certain degree of target domain distribution variation, therefore a lightweight architecture reconstruction operation is performed. A distribution offset adaptation module is inserted into the original network module to achieve feature compensation by adding a small number of parameters. The distribution offset adaptation module includes at least one of a feature mapping unit, a feature transformation unit, and an adaptive fusion unit, used to extract feature change information related to the target domain and adjust it according to the adaptive reconstruction weights of the current network layer. The fusion ratio between the original and adapted features is dynamically adjusted. Feature transformation units can be implemented using depthwise separable convolutions, bottleneck mapping structures, or other lightweight feature transformation structures to reduce additional computational overhead. For high-offset network layers, i.e. The network layer indicates that its feature space is severely affected by domain shift, thus requiring a deep feature distribution reconstruction operation. Specifically, by introducing a distribution correction mechanism based on whitening-coloring transform (WCT), the mean, scale, and feature-related structure of the target domain features are adjusted, enabling the target domain feature representation to gradually migrate towards the source domain feature distribution space.

[0040] Through the above-mentioned dynamic adjustment mechanism of network structure based on the degree of hierarchical data distribution offset, this application can implement differentiated adjustments according to the degree of influence of the target domain data distribution offset on different network layers. While avoiding overfitting or underfitting, it can retain the existing feature expression ability of the pre-trained model to the greatest extent and improve the model's adaptability and inference stability in unknown target domain environments.

[0041] Overall, in this embodiment, to achieve continuous feature adjustment under different offset levels, this application designs a unified hierarchical data distribution offset-aware progressive fusion mechanism for medium-offset network layers and high-offset network layers. For the first... Each network block is adaptively reconstructed based on its corresponding weights. The original target domain features are weighted and fused with the features processed by the corresponding reconstruction module, specifically as follows: in, Indicates the first The original target domain features corresponding to each network layer This represents the output characteristics after adaptive distribution correction. Indicates the first The adaptive reconstruction weights corresponding to each network layer This indicates the reconstruction strategy selected based on the offset level of the network layer distribution.

[0042] For medium offset network layers: This indicates the distribution offset adaptation module.

[0043] For high offset network layers: in, and Let these represent the mean and covariance matrices of the source domain features stored offline. and This represents the target domain feature statistics obtained through online updates using the Exponential Moving Average (EMA) mechanism.

[0044] In one embodiment, K view samples are generated based on the target domain input data. The network architecture is reconstructed according to a determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the K view samples. The original target domain features and reconstructed features are weighted and fused on the network layers implementing the reconstruction strategy to obtain the prediction results corresponding to each view sample, including: Step 4-1: Generate K view samples based on the target domain input data.

[0045] The target domain input data is the actual data to be inferred received after model deployment, such as image data. To improve the stability and robustness of prediction, this step performs multi-view augmentation on the target domain input data, generating K view samples. Multi-view augmentation refers to generating multiple different view versions through one or more data augmentation operations without changing the semantic information of the target domain input data, thereby increasing sample diversity. K is a positive integer representing the number of generated view samples, and its value can be flexibly set according to the actual application scenario and computing resources, such as 2, 4, 8, etc.

[0046] There are various specific operational methods that can be used for multi-view enhancement. For example, these can include, but are not limited to, lightweight enhancement operations at the geometric or pixel level such as random horizontal flipping, small random rotation, random cropping, size scaling, color dithering, and brightness adjustment. These enhancement operations can be used individually or in combination. Since the enhancement operations only slightly perturb the input data and do not destroy the semantic information of the original data, the semantics of each view sample remain consistent, but their representations in the feature space may differ to some extent. By subsequently processing and fusing these differentiated view samples, the prediction fluctuations caused by local noise or random perturbations affecting the input samples of a single target domain can be effectively reduced.

[0047] Step 4-2: Complete the network architecture reconstruction according to the determined hierarchical architecture reconstruction strategy, and perform a second gradient-free forward propagation on the K view samples.

[0048] In step S600, the hierarchical architecture reconstruction strategy for each network layer has been determined, such as which network layers retain the original computation path, which network layers insert lightweight distribution offset adaptation modules, and which network layers configure deep feature distribution reconstruction modules. Here, the pre-trained visual network is adjusted at the architectural level according to the above-determined strategy to form a reconstructed network architecture adapted to the current target domain distribution. This reconstructed network architecture can be obtained by inserting or configuring corresponding modules layer by layer on the basis of the original network structure. It is a temporary network structure for the current target domain input data and does not change the parameters of the pre-trained visual network itself.

[0049] After reconstructing the network architecture, the K view samples generated in step 4-1 are input into the reconstructed network, and a second gradient-free forward propagation is performed. The difference between the second and first gradient-free forward propagation is that the network structure traversed in the second forward propagation has been adaptively adjusted based on the offset scores of each layer, rather than the original pre-trained network structure. Since this forward propagation process is performed on all K view samples, each view sample will generate a corresponding prediction result. The entire forward propagation process does not involve gradient calculation, and there is no need to save the intermediate activation values ​​and gradient information required for backpropagation, thus resulting in lower computational overhead and storage usage.

[0050] Step 4-3: For the network layer implementing the reconstruction strategy, the original target domain features and the reconstructed features are weighted and fused according to the adaptive reconstruction weights to obtain the prediction results corresponding to each view sample.

[0051] During the second gradient-free forward propagation, for network layers that have implemented reconstruction strategies (such as medium-offset and high-offset layers), their output features are not solely based on the original target domain features, nor solely on the reconstructed features. Instead, they are weighted and fused according to the adaptive reconstruction weights obtained in step S200 based on the distribution offset score normalization. The original target domain features refer to the features directly calculated by the network layer during the second forward propagation; the reconstructed features refer to the features obtained after processing by the corresponding reconstruction module. This reconstruction module can be a lightweight distribution offset adaptation module or a deep feature distribution reconstruction module, depending on the reconstruction strategy of the network layer. The weights used for weighted fusion are the adaptive reconstruction weights corresponding to the network layer, reflecting the degree to which the network layer is affected by the target domain data distribution offset. A larger weight indicates that the network layer requires stronger reconstruction adjustments.

[0052] Step 4-4: Perform mean fusion on the prediction results corresponding to the K view samples, and output the final prediction result for the target domain.

[0053] After obtaining the prediction results for K view samples, the K prediction results are then fused using mean fusion. Mean fusion involves adding the K prediction results together and dividing by K to obtain the average prediction result. Since different views undergo different geometric enhancements, their prediction results may differ to some extent. Mean fusion can suppress noise and bias in single views, improving the accuracy and robustness of the final prediction.

[0054] In practical applications, the generated K (enhanced) view samples are input into the dynamically reconstructed network model for forward inference to obtain the prediction results corresponding to each enhanced view. The prediction results from the K views are then fused by mean fusion to obtain the final classification output. The calculation process is as follows: in, This represents the (classification) prediction result corresponding to the k-th augmented view. This represents the final prediction result after fusion. By integrating the prediction results corresponding to multiple enhanced views, the influence of local noise, random perturbations, and short-term distribution changes on single target domain input samples can be reduced, thereby improving the prediction stability and robustness of the model under small-batch input, continuous streaming input, and dynamic environments.

[0055] During the second gradient-free forward propagation, for network layers that have implemented reconstruction strategies (such as medium-offset and high-offset layers), their output features are not solely based on the original target domain features, nor solely on the reconstructed features. Instead, they are weighted and fused according to the fusion ratio dynamically adjusted based on the adaptive reconstruction weights. The original target domain features refer to the features directly calculated by the network layer during forward propagation; the reconstructed features refer to the features obtained after processing by the corresponding reconstruction module (such as a lightweight distribution offset adaptation module or a deep feature distribution reconstruction module). The weighted fusion can be implemented by multiplying the original target domain features and the reconstructed features by their respective weights and then summing them. The sum of the two weights can be 1, thus achieving a smooth transition between the two. For example, for the l-th network layer, the fusion process can be represented as: in, Indicates the first The original target domain features corresponding to each network layer This represents the output characteristics after adaptive distribution correction. Indicates the first The adaptive reconstruction weights corresponding to each network layer This indicates the reconstruction strategy selected based on the offset level of the network layer distribution.

[0056] When the adaptive reconstruction weights are small, the fused features are closer to the original target domain features; when the adaptive reconstruction weights are large, the fused features are closer to the reconstructed features. This achieves progressive feature correction for network layers with different offsets. For low-offset layers that maintain the original computation path, since they do not perform the reconstruction strategy, the above weighted fusion operation is not performed, and the original target domain features are directly output.

[0057] In one embodiment, target domain input data is received, a first gradient-free forward propagation is performed, and target domain features of each network layer are extracted. Based on the source domain hierarchical statistics library, the source domain to target domain distribution offset score of each network layer is calculated, and the distribution offset score is normalized to obtain the adaptive reconstruction weights of each network layer, including: Step 2-1: Receive input data from the target domain.

[0058] Target domain input data refers to the actual data to be inferred received after the model is deployed. Taking image processing scenarios as an example, target domain input data can be road images captured by vehicle-mounted cameras in autonomous driving scenarios, product surface images captured by industrial cameras in industrial inspection scenarios, or video frame images captured by fixed cameras in security monitoring scenarios, etc.

[0059] Step 2-2: Perform the first gradient-free forward propagation to extract the target domain features of each network layer.

[0060] After receiving the target domain input data, the data is fed into the pre-trained visual network to perform the first gradient-free forward propagation. Gradient-free forward propagation refers to extracting features from the input data layer by layer by utilizing the existing transformation relationships of each network layer without calculating gradients or updating network parameters during the forward computation. Since the pre-trained visual network typically contains multiple network layers, and different network layers extract features from the input data at different granularities, it is necessary to obtain the target domain features output by each network layer during the first gradient-free forward propagation as the basis for subsequent distribution offset analysis.

[0061] Steps 2-3: Based on the source domain hierarchical statistics library, use the NAMMD method to calculate the source domain and target domain distribution offset scores for each network layer; After obtaining the target domain features of each network layer, for each network layer, the distribution of the target domain features of that layer is compared with the source domain feature statistics stored in the source domain level statistics library, and the distribution offset score between the two is calculated. The distribution offset score is used to quantify the degree to which the network layer is affected by the distribution offset of the target domain data; the larger the score, the more serious the deviation of the target domain feature distribution of that layer from the source domain feature distribution. In this embodiment, the NAMMD method is specifically used to calculate the distribution offset score of each network layer. The NAMMD method is obtained by normalizing the traditional maximum mean difference (MMD) metric. By introducing the feature embedding norm in the regenerating kernel Hilbert space (RKHS) to normalize the MMD, the comparability and discriminative power of the offset scores between different network layers are improved.

[0062] Specifically, the calculation formula corresponding to the NAMMD method is: in, The maximum mean difference is the standard deviation, and the upper bound of the bounded translation-invariant kernel is given. Represents the source domain feature distribution. Represents the distribution of features in the target domain. and denoted as the embedding norms of the source and target domains in the regenerated kernel Hilbert space RKHS, respectively.

[0063] Steps 2-4: Normalize the distribution offset score to obtain the adaptive reconstruction weights of each network layer.

[0064] After obtaining the distribution offset scores of each network layer through steps 2-3, the scores of each layer are further normalized to obtain the adaptive reconstruction weights corresponding to each network layer. The purpose of normalization is to map the offset scores of different network layers to a unified numerical range, which facilitates the determination of the fusion ratio between the original target domain features and the reconstructed features in subsequent steps based on these weights. Normalization can be implemented in various ways. For example, softmax normalization, min-max normalization, or dividing the offset score of each layer by the sum of the offset scores of all layers can be used; this application does not impose specific limitations on these methods. After normalization, the adaptive reconstruction weights of each network layer fall within a set range. The larger the weight, the more severely the network layer is affected by the distribution offset, and the stronger the subsequent reconstruction adjustment is required.

[0065] In one embodiment, the above-described adaptive reconstruction method for model architecture oriented towards data distribution offset further includes: Step 5-1: Utilize the target domain features extracted by the second gradient-free forward propagation, and update the target domain feature statistics through an exponential moving average mechanism.

[0066] In the previous processing, target domain features were extracted from each network layer during the second gradient-free forward propagation. In this step, these target domain features are used to update the target domain feature statistics online. The target domain feature statistics consist of the mean and covariance matrix of the target domain features at each network layer, representing the current distribution of target domain data across each layer. The Exponential Moving Average (EMA) mechanism is a method for smoothing time series data. Its core idea is to integrate historical and current batch statistics with certain weights, thereby maintaining the overall stability of the statistics while allowing them to gradually reflect changes in the latest data distribution. Updating the target domain feature statistics through the EMA mechanism can reduce statistical fluctuations caused by small-batch or streaming inputs, improving the stability of target domain feature distribution estimation during continuous inference.

[0067] Step 5-2: Calculate the prediction entropy based on the final prediction result of the target domain.

[0068] Prediction entropy is a measure of uncertainty calculated based on the model's output. A higher prediction entropy indicates greater uncertainty about the model's prediction of the current input data; a lower prediction entropy indicates greater confidence in the prediction. By calculating the prediction entropy of the final prediction result in the target domain, we can monitor changes in the model's confidence level within the current target domain environment. Prediction entropy can be calculated using any suitable entropy metric. Specifically, prediction entropy can be calculated based on the probability distribution of each prediction category in the final prediction result.

[0069] Step 5-3: When a sudden change in prediction entropy is detected to exceed a preset change threshold, the target domain feature statistics are reset. The target domain feature statistics are the mean and covariance matrix of the target domain features of each network layer. When calculating the distribution offset score of the next target domain input data, the source domain feature statistics in the source domain level statistics library and the target domain feature statistics are used as input.

[0070] During continuous inference, the changes in the prediction entropy corresponding to each batch of input data can be continuously monitored. When a significant change in the prediction entropy corresponding to the current target domain input data is detected compared to the historical prediction entropy, and the magnitude of the change exceeds a preset change threshold, it indicates that a sudden distribution switch may have occurred in the current target domain environment. At this time, the target domain feature statistics are reset to enable the model to quickly adapt to the new target domain distribution.

[0071] Target domain feature statistics reset refers to discarding or replacing previously accumulated target domain feature statistics accumulated through the EMA mechanism with statistics recalculated based on the current batch of target domain features. Since the old target domain feature statistics may no longer accurately reflect the data distribution under the new environment, resetting them avoids interference from the old statistics in subsequent offset score calculations, enabling the model to respond more quickly to environmental changes. In practical applications, when a sudden change in prediction entropy is detected exceeding a preset threshold, the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the current target domain input data.

[0072] In one embodiment, the prediction entropy is calculated based on the final prediction result of the target domain. When a sudden change in the prediction entropy is detected to exceed a preset change threshold, the target domain feature statistics are reset, including: Step 5-3-1: Obtain the average prediction entropy statistic of the historical records before the current target domain input data. .

[0073] Average prediction entropy statistic The historical average prediction entropy is calculated based on the prediction results of historical target domain input data prior to the current target domain input data. It is used to characterize the average level of uncertainty in the model's prediction of the target domain input data during historical inference. This average prediction entropy statistic can be continuously maintained and updated during online inference to serve as a benchmark for comparison in subsequent detections. Specifically, this average prediction entropy statistic can be obtained by averaging or exponentially moving average the prediction entropies of each historical prediction result.

[0074] Step 5-3-2: Based on the final prediction result of the target domain corresponding to the input data of this target domain, calculate the average prediction entropy corresponding to the input data of this target domain. .

[0075] After the input data in the target domain has undergone the aforementioned steps to complete inference and output the final prediction result for the target domain, the average prediction entropy corresponding to the input data in this target domain is calculated based on the final prediction result. The average prediction entropy reflects the degree of uncertainty of the model's prediction result under the input data in this target domain. The larger the prediction entropy, the more uncertain the model's prediction for this input data. For a single sample input, the average prediction entropy is the prediction entropy of the final prediction result for that sample; for a batch input containing multiple samples, the average prediction entropy can be the average of the prediction entropies of each sample in that batch.

[0076] Step 5-3-3: If the average prediction entropy Greater than the average prediction entropy statistic Compared with the preset entropy change threshold If the sum of these values ​​is used, a sudden distribution shift is determined, and the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the target domain input data.

[0077] After obtaining the average predicted entropy corresponding to the current target domain input data, it is compared with the historical average predicted entropy statistic obtained in step 5-3-1. Specifically, it is determined whether the current average predicted entropy is greater than the sum of the historical average predicted entropy statistic and the preset entropy change threshold. The preset entropy change threshold is a pre-set value used to measure the significance of changes in predicted entropy, avoiding frequent reset operations due to small fluctuations in predicted entropy. The specific value of this threshold can be set according to the actual application scenario and model characteristics, for example, based on the variance of historical predicted entropy or empirical values.

[0078] When the current average predicted entropy exceeds the sum of the historical average predicted entropy statistics and the preset entropy change threshold, it indicates that the model's prediction uncertainty for the current input data is significantly higher than the historical average, meaning a sudden change in predicted entropy has occurred. At this point, it can be determined that a sudden distribution shift has occurred in the current target domain environment, such as a sudden change in environment, switching of acquisition equipment, or change in data source. After determining that a sudden distribution shift has occurred, the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the current target domain input data. Resetting the target domain feature statistics means discarding the historical statistics accumulated through the exponential moving average mechanism and directly replacing them with the current batch of target domain feature statistics. This allows the target domain feature statistics to quickly reflect the new target domain data distribution state, improving the model's responsiveness to sudden domain changes.

[0079] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0080] Based on the same inventive concept, this application also provides a data distribution offset-oriented model architecture adaptive reconstruction apparatus for implementing the above-described data distribution offset-oriented model architecture adaptive reconstruction method. The solution provided by this apparatus is similar to the implementation described in the above-described method. Therefore, the specific limitations of one or more data distribution offset-oriented model architecture adaptive reconstruction apparatus embodiments provided below can be found in the limitations of the data distribution offset-oriented model architecture adaptive reconstruction method described above, and will not be repeated here.

[0081] In one embodiment, such as Figure 5 As shown, an adaptive reconstruction device for model architecture oriented towards data distribution offset is provided, comprising: Initialization module 200 is used to load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. The offset scoring module 400 is used to receive the target domain input data, perform the first gradient-free forward propagation, extract the target domain features of each network layer, calculate the source domain and target domain distribution offset scores of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset scores to obtain the adaptive reconstruction weights of each network layer. The reconstruction strategy determination module 600 is used to determine the hierarchical architecture reconstruction strategy of the pre-trained visual network based on the distribution offset scores of each network layer. The fusion prediction module 800 is used to complete the network architecture reconstruction according to the determined hierarchical architecture reconstruction strategy. It performs a second gradient-free forward propagation on the target domain input data and weights the original target domain features and reconstructed features on the network layer that performs the reconstruction strategy according to the adaptive reconstruction weights, and outputs the final prediction result of the target domain.

[0082] In one embodiment, the reconstruction strategy determination module 600 is further configured to perform a hierarchical architecture reconstruction strategy based on the distribution offset scores of each network layer and a preset first offset threshold and a second offset threshold, wherein the first offset threshold is less than the second offset threshold; network layers with distribution offset scores lower than or equal to the first offset threshold are determined as low offset layers, and the original computation path is maintained; network layers with distribution offset scores higher than the first offset threshold and lower than the second offset threshold are determined as medium offset layers, and a lightweight distribution offset adaptation module is inserted into the medium offset layers; network layers with distribution offset scores higher than or equal to the second offset threshold are determined as high offset layers, and a deep feature distribution reconstruction strategy is performed on the high offset layers, thereby achieving the migration of target domain features to source domain feature distribution through WCT whitening-coloring transformation.

[0083] In one embodiment, the fusion prediction module 800 is further configured to generate K view samples based on the target domain input data; complete network architecture reconstruction according to the determined hierarchical architecture reconstruction strategy; perform a second gradient-free forward propagation on the K view samples; for the network layer executing the reconstruction strategy, weightedly fuse the original target domain features and the reconstructed features according to the adaptive reconstruction weights; weightedly fuse the original target domain features and the reconstructed features on the network layer executing the reconstruction strategy to obtain the prediction results corresponding to each view sample; and perform mean fusion on the prediction results corresponding to the K view samples to output the final prediction result of the target domain.

[0084] In one embodiment, the distribution offset adaptation module includes at least one of a lightweight feature mapping unit, a feature transformation unit, and a fusion unit. In one embodiment, the offset scoring module 400 is also used to receive target domain input data; perform the first gradient-free forward propagation to extract target domain features of each network layer; and calculate the source domain and target domain distribution offset scores of each network layer using the NAMMD method based on the source domain hierarchical statistics library. The distribution offset score is normalized to obtain the adaptive reconstruction weights of each network layer; The calculation formula corresponding to the NAMMD method is as follows: in, The maximum mean difference is the standard deviation, and the upper bound of the bounded translation-invariant kernel is given. Represents the source domain feature distribution. Represents the distribution of features in the target domain. and denoted as the embedding norms of the source and target domains in the regenerated kernel Hilbert space RKHS, respectively.

[0085] In one embodiment, the aforementioned adaptive reconstruction device for model architecture oriented towards data distribution offset further includes a reset optimization module, which is used to update the target domain feature statistics by using the target domain features extracted in the second gradient-free forward propagation through an exponential moving average mechanism; calculate the prediction entropy based on the final prediction result of the target domain; and trigger the reset of the target domain feature statistics when a sudden change in prediction entropy is detected to exceed a preset change threshold. The target domain feature statistics are the mean and covariance matrix of the target domain features of each network layer. When calculating the distribution offset score of the next target domain input data, the source domain feature statistics in the source domain hierarchical statistical library and the target domain feature statistics are used together as input.

[0086] In one embodiment, the reset optimization module is further configured to obtain the average prediction entropy statistic of historical records prior to the current target domain input data. Based on the final prediction result of the target domain corresponding to the input data of this target domain, calculate the average prediction entropy corresponding to the input data of this target domain. If the average prediction entropy Greater than the average prediction entropy statistic Compared with the preset entropy change threshold If the sum of these values ​​is used, a sudden distribution shift is determined, and the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the target domain input data.

[0087] The modules in the aforementioned adaptive reconstruction device for data distribution offset model architecture can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0088] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores preset data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements an adaptive reconstruction method for a model architecture oriented towards data distribution offset.

[0089] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0090] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described adaptive reconstruction method for model architecture oriented towards data distribution offset.

[0091] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described adaptive reconstruction method for model architecture oriented towards data distribution offset.

[0092] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described adaptive reconfiguration method for model architecture oriented towards data distribution offset.

[0093] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0094] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0095] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A model architecture adaptive reconstruction method oriented towards data distribution shift, characterized in that, The method includes: Load the source domain dataset and the pre-trained visual network, perform layer-by-layer forward propagation on the source domain dataset, extract the intermediate features of each network layer output of the pre-trained visual network, calculate the mean and covariance matrix of the source domain features of each layer, and construct the source domain hierarchical statistical library. Receive the target domain input data, perform the first gradient-free forward propagation, and extract the target domain features of each network layer; calculate the source domain and target domain distribution offset score of each network layer according to the source domain hierarchical statistics library, and normalize the distribution offset score to obtain the adaptive reconstruction weight of each network layer. Based on the distribution offset scores of each network layer, the hierarchical architecture reconstruction strategy of the pre-trained visual network is determined; The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy. A second gradient-free forward propagation is performed on the target domain input data. The original target domain features and reconstructed features are weighted and fused according to the adaptive reconstruction weights of the network layer implementing the reconstruction strategy, and the final prediction result of the target domain is output.

2. The method according to claim 1, characterized in that, The step of determining the hierarchical architecture reconstruction strategy of the pre-trained visual network based on the distribution offset scores of each network layer includes: A hierarchical architecture reconstruction strategy is executed based on the distribution offset score of each network layer and a preset first offset threshold and second offset threshold, wherein the first offset threshold is less than the second offset threshold. Network layers whose distribution offset scores are lower than or equal to the first offset threshold are identified as low offset layers, and their original computation paths are maintained. The network layer whose distribution offset score is higher than the first offset threshold and lower than the second offset threshold is determined as a medium offset layer, and a lightweight distribution offset adaptation module is inserted into the medium offset layer. Network layers whose distribution offset scores are higher than or equal to the second offset threshold are identified as high offset layers. A deep feature distribution reconstruction strategy is performed on high offset layers, and the target domain features are transferred to the source domain feature distribution through WCT whitening-coloring transformation.

3. The method according to claim 1, characterized in that, The process involves reconstructing the network architecture according to the determined hierarchical architecture reconstruction strategy, performing a second gradient-free forward propagation on the target domain input data, and weighting and fusing the original target domain features and reconstructed features on the network layers implementing the reconstruction strategy according to the adaptive reconstruction weights. The final prediction result for the target domain output includes: K view samples are generated based on the target domain input data; The network architecture is reconstructed according to the determined hierarchical architecture reconstruction strategy, and a second gradient-free forward propagation is performed on the K view samples. For the network layer that executes the reconstruction strategy, the original target domain features and the reconstructed features are weighted and fused according to the adaptive reconstruction weights to obtain the prediction results corresponding to each view sample; The prediction results corresponding to the K view samples are fused by mean fusion to output the final prediction result of the target domain.

4. The method according to claim 2, characterized in that, The distribution offset adaptation module includes at least one of a lightweight feature mapping unit, a feature transformation unit, and a fusion unit.

5. The method according to claim 1, characterized in that, The process involves receiving target domain input data, performing a first gradient-free forward propagation, and extracting target domain features from each network layer. Based on the source domain hierarchical statistics library, the source domain to target domain distribution offset score for each network layer is calculated, and the distribution offset score is normalized to obtain the adaptive reconstruction weights for each network layer, including: Receive input data from the target domain; Perform the first gradient-free forward propagation to extract target domain features from each network layer; Based on the source domain hierarchical statistics library, the NAMMD method is used to calculate the source domain and target domain distribution offset scores for each network layer. The distribution offset score is normalized to obtain the adaptive reconstruction weights of each network layer; The calculation formula corresponding to the NAMMD method is as follows: ; in, The maximum mean difference is the standard deviation, and the upper bound of the bounded translation-invariant kernel is given. Represents the source domain feature distribution. Represents the distribution of features in the target domain. and denoted as the embedding norms of the source and target domains in the regenerated kernel Hilbert space RKHS, respectively.

6. The method according to claim 1, characterized in that, Also includes: The target domain features extracted by the second gradient-free forward propagation are updated using the exponential moving average mechanism to update the target domain feature statistics. Calculate the prediction entropy based on the final prediction result of the target domain; When a sudden change in predicted entropy is detected that exceeds a preset change threshold, the target domain feature statistics are reset. The target domain feature statistics are the mean and covariance matrix of the target domain features of each network layer. When calculating the distribution offset score of the next target domain input data, the source domain feature statistics in the source domain hierarchical statistical library and the target domain feature statistics are used as input together.

7. The method according to claim 6, characterized in that, The step of calculating the prediction entropy based on the final prediction result of the target domain, and triggering the reset of the target domain feature statistics when a sudden change in prediction entropy is detected exceeding a preset change threshold, includes: The average prediction entropy statistic of historical records prior to the target domain input data obtained in this study. ; Based on the final prediction result of the target domain corresponding to the target domain input data, calculate the average prediction entropy corresponding to the target domain input data. ; If the average prediction entropy Greater than the average prediction entropy statistic Compared with the preset entropy change threshold If the sum of these values ​​is calculated, a sudden distribution shift is determined, and the target domain feature statistics are reset to the mean and covariance matrix calculated based on the target domain features of each network layer using the current target domain input data.