Model test adaptive method and device, terminal and computer readable storage medium

The model testing adaptive method optimizes image batch predictions by iteratively updating and translating features using an entropy loss function, enhancing accuracy and efficiency in deep learning visual analysis tasks with distribution deviations.

CN119107522AActive Publication Date: 2024-12-10SOUTHERN UNIVERSITY OF SCIENCE AND TECHNOLOGY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411137137.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-10
Estimated Expiration
2044-08-19

AI Technical Summary

Technical Problem

Existing test-time adaptive methods for deep learning visual analysis fail to sufficiently optimize prediction results of current image batches due to insufficient model adaptation to dynamic changes in the environment, especially when distribution deviation occurs between training and test data.

Method used

A model testing adaptive method that iteratively updates a pre-trained source domain model using a preset entropy loss function, determines pre-update and post-update linear features, and translates these features to optimize batch predictions by inputting them into a frozen classifier, thereby improving accuracy without overfitting.

Benefits of technology

The method enhances the accuracy of image classification by adaptively optimizing each batch's prediction results, improving overall test performance and efficiency by avoiding overfitting and reducing the need for multiple iterative updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119107522A_ABST
    Figure CN119107522A_ABST
Patent Text Reader

Abstract

The invention provides a model test adaptive method and device, a terminal and a computer readable storage medium. The method comprises the following steps: acquiring a pre-trained source domain model and a test image batch sequence; updating the current model based on the current test image batch and a preset entropy loss function, and determining pre-updating linear features and post-updating linear features corresponding to the current test image batch; translating the updated linear features according to the linear features before updating and the linear features after updating to obtain optimization features of the current batch; and inputting the optimization features of the current batch into the frozen classifier in the source domain model to obtain a prediction result of the current test image batch. According to the method, the unsupervised entropy loss function is adopted, the updated linear features generated by the current model are translated, the classification prediction result of the current test image batch is optimized, and the prediction result of each batch is adaptively optimized, so that the test accuracy of overall image classification is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of deep learning and machine vision, and in particular to a model testing adaptive method, device, terminal and computer-readable storage medium. Background Art

[0002] For deep learning visual analysis tasks, due to the distribution deviation between the source domain data used for training and the target domain data used for testing, the model trained with the source domain data has low performance when directly testing and reasoning on the target domain data. Therefore, in the case of distribution deviation between training and test data, test-time adaptation has attracted much attention as an important technical strategy to improve model testing performance. Test-time adaptation aims to improve the flexibility of the model and optimize model performance by responding to dynamic changes in the environment during the model reasoning phase. In the actual testing process, the model may be sensitive to unknown data distribution and needs to be adjusted based on the target data. In real-world applications, due to insufficient storage, bandwidth limitations, and even privacy requirements, only pre-trained models can be distributed through communication, and training data cannot be transmitted.

[0003] Currently, the test-time adaptive method uses the current batch of images to update the model parameters. Once the model is updated, the new model will be directly used to predict the next batch of test images instead of the current batch of images. Intuitively, the model that has learned the knowledge of the current samples should be more adaptable to the current batch of images themselves. However, in the existing methods, when the updated new model is used to predict the batch of images itself, the test performance is not significantly improved. That is, the existing test-time adaptive methods do not fully optimize the prediction results of the current image batch.

[0004] Therefore, the prior art has defects and needs to be improved and developed. Summary of the invention

[0005] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a model testing adaptive method, device, terminal and computer-readable storage medium are provided, aiming to solve the problem that the adaptive method during testing in the prior art does not sufficiently optimize the prediction results of the current image batch.

[0006] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0007] A model testing adaptive method, wherein the method comprises:

[0008] Get a pre-trained source domain model and a batch sequence of test images;

[0009] When the source domain model is iteratively updated based on each test image batch in the test image batch sequence, the current model is updated based on the current test image batch and a preset entropy loss function, and the pre-update linear features and the post-update linear features corresponding to the current test image batch are determined;

[0010] According to the linear features before updating and the linear features after updating, translating the linear features after updating to obtain the optimized features of the current batch;

[0011] The optimized features of the current batch are input into the frozen classifier in the source domain model to obtain prediction results for the current test image batch.

[0012] In one implementation of the present application, the updating of the current model based on the current test image batch and the preset entropy loss function, and determining the pre-updated linear features and post-updated linear features corresponding to the current test image batch, includes:

[0013] The current model is updated based on the current test image batch and the preset entropy loss function to obtain an updated model;

[0014] Extracting linear features of the current test image batch using a feature extractor in the current model to obtain linear features before updating;

[0015] The linear features of the current test image batch are extracted using the feature extractor in the updated model to obtain updated linear features.

[0016] In one implementation of the present application, according to the pre-updated linear features and the post-updated linear features, the post-updated linear features are translated to obtain the current batch optimized features, including:

[0017] Obtaining a linear feature translation direction and a linear feature translation scale of a current test image batch according to the linear features before and after the update;

[0018] The updated linear features are translated based on the linear feature translation direction and the linear feature translation scale to obtain current batch optimization features.

[0019] In one implementation of the present application, obtaining the linear feature translation direction and the linear feature translation scale of the current test image batch according to the pre-updated linear features and the post-updated linear features includes:

[0020] Obtaining a linear feature translation direction of the current test image batch according to a feature change from the linear feature before the update to the linear feature after the update;

[0021] Calculate the relative feature change rate according to the linear feature before updating and the linear feature after updating;

[0022] Get the predetermined slope hyperparameters for the current batch of test images;

[0023] The linear feature translation scale is calculated based on the slope hyperparameter and the relative feature change rate.

[0024] In one implementation of the present application, the step of determining the slope hyperparameter includes:

[0025] Obtain the preset initial slope hyperparameters and randomly select sample images from the current test image batch to obtain a random sample set;

[0026] Based on the initial slope hyperparameter, linear feature translation is performed on the random sample set, and a first entropy value of the translated feature corresponding to the initial slope hyperparameter is calculated;

[0027] Obtaining a preset step size parameter, calculating a difference between the initial slope hyperparameter and the step size parameter to obtain a first slope hyperparameter, and calculating a sum of the initial slope hyperparameter and the step size parameter to obtain a second slope hyperparameter;

[0028] Calculating a second entropy value of the translated feature corresponding to the first slope hyperparameter, and calculating a third entropy value of the translated feature corresponding to the second slope hyperparameter;

[0029] Determine a minimum value among the first entropy value, the second entropy value, and the third entropy value, and use the slope hyperparameter corresponding to the minimum value as the slope hyperparameter of the current test image batch.

[0030] In one implementation of the present application, the linear feature translation scale is calculated according to the slope hyperparameter and the relative feature change rate, including:

[0031] Calculating the inverse of the relative characteristic change rate;

[0032] The product of the inverse and the slope hyperparameter is used as the linear feature translation scale.

[0033] In one implementation of the present application, translating the updated linear features based on the linear feature translation direction and the linear feature translation scale to obtain the current batch optimization features includes:

[0034] Calculating the product of the linear feature translation direction and the linear feature translation scale;

[0035] The sum of the product and the updated linear feature is calculated to obtain the current batch optimization feature.

[0036] The present application also provides a model test adaptive device, wherein the device comprises:

[0037] An acquisition module, used to acquire a pre-trained source domain model and a test image batch sequence;

[0038] An updating module, configured to update the current model based on the current test image batch and a preset entropy loss function when iteratively updating the source domain model based on each test image batch in the test image batch sequence, and determine the pre-update linear features and post-update linear features corresponding to the current model;

[0039] A translation module, used for translating the updated linear features according to the pre-updated linear features and the updated linear features to obtain the current batch optimized features;

[0040] The prediction module is used to input the current batch optimization features into the frozen classifier in the source domain model to obtain the prediction results for the current test image batch.

[0041] The present application also provides a terminal, which includes: a memory, a processor, and a model test adaptation program stored in the memory and executable on the processor, wherein the model test adaptation program implements the steps of the model test adaptation method described above when executed by the processor.

[0042] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the model testing adaptive method as described above.

[0043] The present invention provides a model test adaptive method, device, terminal and computer-readable storage medium, the method comprising: obtaining a pre-trained source domain model and a test image batch sequence; when iteratively updating the source domain model based on each test image batch in the test image batch sequence, updating the current model based on the current test image batch and a preset entropy loss function, and determining the pre-update linear features and post-update linear features corresponding to the current test image batch; translating the post-update linear features according to the pre-update linear features and post-update linear features to obtain the current batch optimized features; inputting the current batch optimized features into the frozen classifier in the source domain model to obtain the prediction results for the current test image batch. The present invention optimizes the classification prediction results for the current test image batch by translating the post-update linear features generated by the current model using an unsupervised entropy loss function, and each batch prediction result is adaptively optimized, thereby improving the test accuracy of the overall image classification. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is the basic process of self-adaptation during testing;

[0045] Figure 2 It is a flow chart of a preferred embodiment of the model testing adaptive method of the present invention;

[0046] Figure 3 Schematic diagram of linear feature translation algorithm of a preferred embodiment of the model test adaptive method of the present invention;

[0047] Figure 4 The relationship between the feature translation scale and the average entropy loss in each test sample batch of the preferred embodiment of the model test adaptive method of the present invention;

[0048] Figure 5 It is an algorithm logic diagram of predictive feature shifting of a preferred embodiment of the model testing adaptive method of the present invention;

[0049] Figure 6 It is an algorithm logic diagram of calculating the slope hyperparameter of a preferred embodiment of the model test adaptive method of the present invention;

[0050] Figure 7 is the relationship between the optimal feature translation scale and the inverse of the feature relative change rate of the preferred embodiment of the model test adaptive method of the present invention;

[0051] Figure 8 It is a functional principle block diagram of a preferred embodiment of the model test adaptive device of the present invention;

[0052] Fig. 9 It is a functional principle block diagram of a preferred embodiment of the terminal in the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0054] For deep learning visual analysis tasks, due to the distribution deviation between the source domain data used for training and the target domain data used for testing, the model trained with source domain data has low performance when directly testing and reasoning on the target domain data. In order to improve the test performance of the model, during the test phase, the target domain data will be used to further update the trained model, and the updated model will be used for sample prediction in real time. This process is called online test-time adaptation. The basic process is as follows: Figure 1 shown.

[0055] That is to say, when there is a data distribution offset between the source domain of model training and the target domain of test, the test performance of the network model will be significantly reduced. In order to improve the test performance of the model, it is crucial to use the test data to further update the model so that it is more adaptable to the test data. However, in actual application scenarios, due to privacy restrictions, the test end cannot access the training data of the training end and can only access the trained source domain neural network model; at the same time, the actual test samples are completely unsupervised, that is, the test sample labels are unknown; in addition, in the actual test process, the test samples appear in the form of online data streams, that is, each test sample can only be accessed once.

[0056] In response to the above-mentioned defects, an embodiment of the present application provides a model testing adaptive method, which, without accessing training data, only uses unlabeled test samples to adjust the intermediate features generated by the model in real time and unsupervisedly, thereby giving more accurate prediction results for each batch of test images, further improving the accuracy of image classification in the testing phase.

[0057] See also Figure 2 , Figure 2 : is a flow chart of the model testing adaptive method in the present invention. Figure 2 As shown, the model test adaptive method described in the embodiment of the present invention includes:

[0058] Step S100: Obtain a pre-trained source domain model and a test image batch sequence.

[0059] The source domain model is a model trained by source domain data, and the test image batch sequence is the test sample of the target domain. In view of the setting that the test end cannot access the training data of the training end in actual applications, the requirement that the actual test sample labels are unknown, and the special setting that each test sample in the online test data stream can only be accessed once, the embodiment of the present application only uses the target domain test samples, that is, the test images in the test image batch sequence, in the test phase, which meets the requirement of not accessing the training data of the training end.

[0060] Specifically, given a pre-trained source domain model, it consists of a feature extractor model Θ s and the classifier model Φ s Composition. Given N t Test data Contains unknown tags Where P t (x,y)≠P s (x,y), that is, the target domain data distribution is different from the source domain data distribution. Figure 1 As shown, for the adaptation of the inference process during online testing, let the sequence of the test image batch be denoted by {x 0 ,x 1 ,…,xJ-1}, where J is the total number of data batches. The weights of the network model are Adjust to Only use the jth test sample batch x j The model adjusted by the current j-th batch will be passed to the next batch and further adjusted by the test images of the next batch, that is, In the first batch, With the source model Θ s The weights of are the same. M is usually set to 1 to avoid overfitting the model on the current mini-batch samples; C represents the number of categories.

[0061] like Figure 2 As shown, the model test adaptive method described in this embodiment also includes:

[0062] Step S200: When the source domain model is iteratively updated based on each test image batch in the test image batch sequence, the current model is updated based on the current test image batch and a preset entropy loss function, and the pre-update linear features and post-update linear features corresponding to the current test image batch are determined.

[0063] Specifically, the entropy loss function is used to update the model of the current test image batch in one step. The formula of the entropy loss function is:

[0064]

[0065] In the formula, represents the loss value, j represents the jth batch, N j represents the total number of sample batches, C represents the number of categories, c represents the cth category, i represents the i-th sample in the batch, and p represents the probability distribution. Represents the model's prediction results for the batch of data.

[0066] The embodiment of the present application adopts an unsupervised entropy loss function to adjust and update the model and the intermediate features generated by the model, thereby providing more accurate prediction results for each batch of test images, further improving the accuracy of image classification in the testing phase.

[0067] In an embodiment of the present application, the current model is updated based on the current test image batch and a preset entropy loss function, and the pre-update linear features and post-update linear features corresponding to the current test image batch are determined, including: updating the current model based on the current test image batch and a preset entropy loss function to obtain an updated model; using a feature extractor in the current model to extract the linear features of the current test image batch to obtain the pre-update linear features; using a feature extractor in the updated model to extract the linear features of the current test image batch to obtain the updated linear features.

[0068] Specifically, the existing online test-time adaptive methods update the model parameters in the test phase and then make predictions. This method is feasible in dynamic streaming data scenarios. The knowledge obtained by the model from the previously tested small batches can be continuously accumulated and then used for the next batch prediction. Existing methods mainly focus on updating the model parameters or the model input in the test phase. In terms of model parameter update, other network layers are frozen, and only the parameters of the normalization layer in the model network are updated, and domain-specific knowledge is encoded into the statistical information and affine parameters of the batch data to improve the predictive adaptability to the target domain test data. In terms of model input update, the input is adjusted in the test phase so that the input adapts to the fixed pre-trained model to improve the inference performance. However, the existing methods use each batch of test samples to perform only one round of iterative updates on the model, and the model cannot fully learn the knowledge in the test samples. For each batch of online test images, if the number of model iteration updates is increased, the model will overfit to the current small batch data, resulting in a decrease in the test accuracy of subsequent batch samples, resulting in a decrease in overall test performance. It will also take more time to perform multiple gradient backpropagation operations, reducing the model inference efficiency.

[0069] The embodiment of the present application only requires one round of model parameter update to obtain the information required for feature adjustment and perform feature update, without the need for multiple rounds of iterative model parameter update. This can avoid the problem of overfitting of the model on small-scale samples, reduce the time required for reasoning in the test phase, and improve test efficiency.

[0070] like Figure 2 As shown, the model test adaptive method described in this embodiment also includes:

[0071] Step S300: According to the pre-updated linear features and the post-updated linear features, the post-updated linear features are translated to obtain current batch optimized features.

[0072] The embodiment of the present application further reduces the classification entropy loss of each batch of test images by directly modifying the intermediate features generated by the model, while avoiding the overfitting problem of the model on small-scale samples, thereby further improving the accuracy of image classification in the testing phase.

[0073] like Figure 3 As shown, for the current test image batch x j , the current model The linear features before updating with the current test image batch can be expressed as Using entropy loss function The model is updated in one step for the current j-th test sample batch. The model updated by the current test image batch is expressed as The updated linear feature is

[0074] The embodiment of the present application aims to solve the problem that the prior art does not sufficiently optimize the prediction results of the current test image batch, and adjusts the intermediate features generated by the model based on the feedback of feature change information before and after the model update. In this way, for each batch of test images, the adjusted features have a lower classification entropy loss, and using them for the classification prediction of the current batch can obtain better prediction results. Each batch prediction result is adaptively optimized, thereby improving the test accuracy of the overall image classification.

[0075] In the embodiment of the present application, the step S300 specifically includes:

[0076] Step S310, obtaining a linear feature translation direction and a linear feature translation scale of a current test image batch according to the linear features before and after the update;

[0077] Step S320: translating the updated linear features based on the linear feature translation direction and the linear feature translation scale to obtain current batch optimization features.

[0078] Specifically, the feature change from the linear feature f0 before updating to the linear feature f1 after updating guides the effective entropy loss function reduction direction for the current batch feature. Therefore, the embodiment of the present application allows the current feature to be translated along this direction, thereby generating a feature with a lower corresponding entropy loss function value, which is used to obtain a more accurate classification prediction.

[0079] The embodiment of the present application performs linear translation on the features of the test image based on the information fed back by the model update to directly optimize the features.

[0080] In one embodiment of the present application, step S310 specifically includes:

[0081] Step S311, obtaining a linear feature translation direction of the current test image batch according to a feature change from the linear feature before the update to the linear feature after the update;

[0082] Step S312, calculating a relative feature change rate according to the linear feature before updating and the linear feature after updating;

[0083] Step S313, obtaining a predetermined slope hyperparameter of the current test image batch;

[0084] Step S314: Calculate the linear feature translation scale according to the slope hyperparameter and the relative feature change rate.

[0085] Specifically, the linear feature translation direction is Δ f =f1-f0. Figure 4 It can be seen that as the translation scale λ increases, that is, the greater the degree of feature translation in the translation direction, the entropy loss function first reaches a local minimum. This means that there is an optimal translation scale

[0086] Since λ is directly located by numerical search * It is very time-consuming. To solve this problem, the present application proposes an adaptive linear feature translation scale calculation method. Define the relative feature change rate between features f1 and f0 in the jth batch as v j :

[0087]

[0088] where ||·|| is the L1 norm, N j is the total number of sample batches.

[0089] according to Figure 4 As shown, the invention is based on the optimal translation scale λ * The inverse of the relative rate of change of each batch feature The high correlation of , the linear feature translation scale is modeled and calculated:

[0090]

[0091] Here, α is the slope hyperparameter.

[0092] The specific algorithm of predictive feature translation is as follows Figure 5 As shown. The embodiment of the present application can reduce the target entropy loss of the model update to the local minimum along the linear feature translation direction, which is conducive to more accurate prediction. At the same time, the linear feature translation scale is also modeled and calculated, so that the feature can be translated to the minimum loss value, thereby improving the prediction accuracy.

[0093] In the embodiment of the present application, the step of determining the slope hyperparameter includes:

[0094] Obtain the preset initial slope hyperparameters and randomly select sample images from the current test image batch to obtain a random sample set;

[0095] Based on the initial slope hyperparameter, linear feature translation is performed on the random sample set, and a first entropy value of the translated feature corresponding to the initial slope hyperparameter is calculated;

[0096] Obtaining a preset step size parameter, calculating a difference between the initial slope hyperparameter and the step size parameter to obtain a first slope hyperparameter, and calculating a sum of the initial slope hyperparameter and the step size parameter to obtain a second slope hyperparameter;

[0097] Calculating a second entropy value of the translated feature corresponding to the first slope hyperparameter, and calculating a third entropy value of the translated feature corresponding to the second slope hyperparameter;

[0098] Determine a minimum value among the first entropy value, the second entropy value, and the third entropy value, and use the slope hyperparameter corresponding to the minimum value as the slope hyperparameter of the current test image batch.

[0099] Specifically, for online test-time adaptation tasks, the dataset cannot be fully accessed to calculate the exact slope. To solve this problem, the embodiment of the present application uses several samples in each batch to estimate the α hyperparameter before applying the linear feature translation method to the current real-time batch data. Specifically, for each batch, a linear feature translation is first applied to a very small randomly selected sample set x based on an initial slope hyperparameter α=0.2. sub (e.g., 5 samples). Then, the value of α is increased and decreased by a step size parameter δ, i.e., δ+α and δ-α, and the entropy values ​​of the corresponding translated features are calculated respectively. The embodiment of the present application selects the one among α, δ+α or δ-α that can minimize the entropy as the final slope hyperparameter. The specific algorithm of the slope hyperparameter is as follows: Figure 6 shown.

[0100] In the embodiment of the present application, the step S314 specifically includes:

[0101] Step S3141, calculating the inverse of the relative characteristic change rate;

[0102] Step S3142: taking the product of the reciprocal and the slope hyperparameter as the linear feature translation scale.

[0103] like Figure 7 The relationship between the optimal translation scale and the inverse of the feature relative change rate is shown in FIG. 1. The embodiment of the present application uses a formula to calculate the linear feature translation scale, thereby avoiding the problem that it is very time-consuming to locate the linear feature translation scale directly by numerical search.

[0104] In one embodiment of the present application, step S320 specifically includes:

[0105] Step S321, calculating the product of the linear feature translation direction and the linear feature translation scale;

[0106] Step S322: Calculate the sum of the product and the updated linear feature to obtain the current batch optimization feature.

[0107] Specifically, along the linear feature translation direction, the current batch optimization feature f can be obtained after translation adjustment: PFS =f1+λ·Δ f , where λ is the feature translation scale.

[0108] The embodiment of the present application obtains the optimized features of the current batch by translating the updated features. There is no need to iterate the model parameters in multiple steps, and the prediction results of the real-time test data batches can be further optimized. At the same time, overfitting of the model is avoided and the efficiency of model reasoning is effectively improved.

[0109] like Figure 2 As shown, the model test adaptive method described in this embodiment also includes:

[0110] Step S400: input the optimized features of the current batch into the frozen classifier in the source domain model to obtain prediction results for the current test image batch.

[0111] Specifically, the optimized features of the current batch are input into the frozen classifier Φ s Get the final prediction result.

[0112] The embodiment of the present application utilizes each test image batch to iteratively update the source domain model, and further translates the updated features. This improves the accuracy of visual tasks such as image classification in the presence of data distribution shift without increasing the number of iterative updates. This not only improves the model's reasoning ability for test data when there is a difference between the source domain data distribution and the target domain data distribution, but also effectively copes with uncertainty and variability in actual scenarios.

[0113] In one embodiment, if Figure 8 As shown, based on the above model test adaptive method, the present invention also provides a model test adaptive device, including:

[0114] An acquisition module 100 is used to acquire a pre-trained source domain model and a test image batch sequence;

[0115] An updating module 200, configured to update the current model based on the current test image batch and a preset entropy loss function when iteratively updating the source domain model based on each test image batch in the test image batch sequence, and determine the pre-update linear features and post-update linear features corresponding to the current model;

[0116] A translation module 300, configured to translate the updated linear features according to the pre-updated linear features and the updated linear features to obtain current batch optimized features;

[0117] The prediction module 400 is used to input the current batch of optimized features into the frozen classifier in the source domain model to obtain the prediction results for the current test image batch.

[0118] Fig. 9 A schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal may include:

[0119] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .

[0120] When the processor 502 executes the program, the model testing adaptive method provided in the above embodiment is implemented.

[0121] Furthermore, the terminal further includes:

[0122] The communication interface 503 is used for communication between the memory 501 and the processor 502 .

[0123] The memory 501 is used to store computer programs that can be executed on the processor 502 .

[0124] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0125] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0126] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.

[0127] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.

[0128] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above model test adaptation method is implemented.

[0129] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0130] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0131] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes additional implementations, in which the order shown or discussed may not be followed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0132] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can read instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary and then storing it in a computer memory.

[0133] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0134] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0135] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0136] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.

[0137] In summary, the present invention discloses a model test adaptive method, device, terminal and computer-readable storage medium, the method comprising: obtaining a pre-trained source domain model and a test image batch sequence; when iteratively updating the source domain model based on each test image batch in the test image batch sequence, updating the current model based on the current test image batch and a preset entropy loss function, and determining the pre-update linear features and post-update linear features corresponding to the current test image batch; translating the post-update linear features according to the pre-update linear features and post-update linear features to obtain the current batch optimized features; inputting the current batch optimized features into the frozen classifier in the source domain model to obtain the prediction results for the current test image batch. The present invention optimizes the classification prediction results for the current test image batch by translating the updated linear features generated by the current model using an unsupervised entropy loss function, and each batch prediction result is adaptively optimized, thereby improving the test accuracy of the overall image classification.

[0138] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A model testing adaptive method, characterized in that: The method comprises: Get a pre-trained source domain model and a batch sequence of test images; When the source domain model is iteratively updated based on each test image batch in the test image batch sequence, the current model is updated based on the current test image batch and a preset entropy loss function, and the pre-update linear features and the post-update linear features corresponding to the current test image batch are determined; According to the linear features before updating and the linear features after updating, translating the linear features after updating to obtain the optimized features of the current batch; The optimized features of the current batch are input into the frozen classifier in the source domain model to obtain prediction results for the current test image batch.

2. The model testing adaptive method according to claim 1, characterized in that: The updating of the current model based on the current test image batch and a preset entropy loss function, and determining the pre-updated linear features and the post-updated linear features corresponding to the current test image batch, includes: The current model is updated based on the current test image batch and the preset entropy loss function to obtain an updated model; Extracting linear features of the current test image batch using a feature extractor in the current model to obtain linear features before updating; The linear features of the current test image batch are extracted using the feature extractor in the updated model to obtain updated linear features.

3. The model testing adaptive method according to claim 1, characterized in that: According to the linear features before updating and the linear features after updating, translating the linear features after updating to obtain the current batch optimization features, including: Obtaining a linear feature translation direction and a linear feature translation scale of a current test image batch according to the linear features before and after the update; The updated linear features are translated based on the linear feature translation direction and the linear feature translation scale to obtain current batch optimization features.

4. The model testing adaptive method according to claim 3, characterized in that: Obtaining the linear feature translation direction and the linear feature translation scale of the current test image batch according to the linear features before and after the update, including: Obtaining a linear feature translation direction of the current test image batch according to a feature change from the linear feature before the update to the linear feature after the update; Calculate the relative feature change rate according to the linear feature before updating and the linear feature after updating; Get the predetermined slope hyperparameters for the current batch of test images; The linear feature translation scale is calculated based on the slope hyperparameter and the relative feature change rate.

5. The model testing adaptive method according to claim 4, characterized in that: The steps of determining the slope hyperparameter include: Obtain the preset initial slope hyperparameters and randomly select sample images from the current test image batch to obtain a random sample set; Based on the initial slope hyperparameter, linear feature translation is performed on the random sample set, and a first entropy value of the translated feature corresponding to the initial slope hyperparameter is calculated; Obtaining a preset step size parameter, calculating a difference between the initial slope hyperparameter and the step size parameter to obtain a first slope hyperparameter, and calculating a sum of the initial slope hyperparameter and the step size parameter to obtain a second slope hyperparameter; Calculating a second entropy value of the translated feature corresponding to the first slope hyperparameter, and calculating a third entropy value of the translated feature corresponding to the second slope hyperparameter; Determine a minimum value among the first entropy value, the second entropy value, and the third entropy value, and use the slope hyperparameter corresponding to the minimum value as the slope hyperparameter of the current test image batch.

6. The model testing adaptive method according to claim 4, characterized in that: The linear feature translation scale is calculated according to the slope hyperparameter and the relative feature change rate, including: Calculating the inverse of the relative characteristic change rate; The product of the inverse and the slope hyperparameter is used as the linear feature translation scale.

7. The model testing adaptive method according to claim 3, characterized in that: The updated linear features are translated based on the linear feature translation direction and the linear feature translation scale to obtain the current batch optimization features, including: Calculating the product of the linear feature translation direction and the linear feature translation scale; The sum of the product and the updated linear feature is calculated to obtain the current batch optimization feature.

8. A model test adaptive device, characterized in that: The device comprises: An acquisition module, used to acquire a pre-trained source domain model and a test image batch sequence; An updating module, configured to update the current model based on the current test image batch and a preset entropy loss function when iteratively updating the source domain model based on each test image batch in the test image batch sequence, and determine the pre-update linear features and post-update linear features corresponding to the current model; A translation module, used for translating the updated linear features according to the pre-updated linear features and the updated linear features to obtain the current batch optimized features; The prediction module is used to input the current batch optimization features into the frozen classifier in the source domain model to obtain the prediction results for the current test image batch.

9. A terminal, characterized in that: include: A memory, a processor, and a model test adaptation program stored in the memory and executable on the processor, wherein the model test adaptation program, when executed by the processor, implements the steps of the model test adaptation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the model testing adaptation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Self-adaptive sight line estimation method and system, electronic equipment and storage medium

    CN115862095A

  • Feature alignment-based test stage adaptive learning method, device and equipment

    CN117079070A

  • Model training method, image classification method, image classification device and storage medium

    CN117422942A