Flexible and lightweight deep neural network model generalization method
By layering the deep neural network model and modulating it using probability output, the problem of difficult to modulate the model without retraining or changing the model architecture in the prior art is solved, and the flexible adaptation and efficient resource utilization of the model are achieved.
Patent Information
- Application Number
- CN202411962284.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is difficult to flexibly modulate deep neural network models to adapt to different needs and user preferences without retraining or changing the model architecture, resulting in limitations in meeting diverse needs.
By layering the deep neural network model into a feature extractor and probability mapper, the probabilistic output is used for modulation, including utility modulation and focus modulation, and the model output is adjusted by adding controlled Gaussian noise or constrained noise to achieve flexible modulation of the model.
It realizes flexible modulation of models to adapt to different needs and user preferences without retraining or changing the model architecture, enhances the adaptability and practicality of the model, and reduces resource utilization and deployment and maintenance costs.
Smart Images

Figure CN119886257A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep neural network model generalization, and specifically to a flexible and lightweight deep neural network model generalization method. Background Art
[0002] Deep neural networks have made significant breakthroughs in tasks such as image recognition, semantic segmentation, and language translation, sparking changes in various industries such as healthcare, finance, autonomous driving, and natural language processing. Despite its great success in various fields, the training of high-quality models requires a lot of computing resources, massive data sets, and huge capital investment. This makes it so that only organizations with sufficient resources can afford the huge overhead of large-scale training. For example, the model GPT-3 developed and trained by OpenAI contains 175 billion parameters, and a single training run requires 355 GPUs / year and $4.6 million.
[0003] In the process of continuously pushing the performance boundaries of complex task models in the field of artificial intelligence, a key challenge facing artificial intelligence in the new era is how to manage the intellectual property rights of existing models and adapt them to the diverse needs of downstream tasks. Specifically, it is crucial for model owners to maintain control over the models, and they need to deploy and customize the models according to different market segments and different business goals. For model users, they expect the models to be adaptable and adjust their behavior according to personal preferences and contextual needs. Specifically, model owners need to provide different service tiers. Free tier users get lower-quality outputs, such as reduced resolution or only basic code suggestions; while premium users can enjoy enhanced results with higher quality and additional features. Real-world examples include cutout.pro and together.ai, which provide models with free low-utility options or different features at different price points. For model users, such as users of driver assistance platforms, they usually want the model's behavior to adapt to their preferences. For example, one driver may want to pay more attention to vehicles on the road, while another driver may be more concerned with pedestrian detection. This personalization is already reflected in advanced driver assistance systems, which can match different personal driving styles, such as aggressive driving or defensive driving, thereby improving user comfort and acceptance.
[0004] Traditional techniques such as early exit and fine-tuning can be used to control model utility or adapt an already trained model to a specific task or constraint. Early exit terminates the inference process early by introducing intermediate exit points at different layers of a deep neural network, resulting in faster but potentially less accurate predictions. However, implementing early exit requires architectural modifications, which is not always feasible due to limited model accessibility and can complicate integration and maintenance. Fine-tuning adapts a pre-trained model to a new task by retraining on a smaller task-specific dataset. However, fine-tuning requires specific training data and involves retraining and additional optimization steps. Although both techniques are capable of generating multiple customized versions, managing these versions across a large user base is impractical because it is too expensive to maintain consistency across versions and apply updates. These limitations highlight the urgent need for a flexible and lightweight approach that can modulate the use of a model without retraining or changing the model architecture. To this end, a flexible and lightweight approach to generalizing deep neural network models is designed. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and to provide a flexible and lightweight deep neural network model generalization method that can modulate the model to produce models with various effects and different preferences without retraining or changing the model architecture.
[0006] The present invention is implemented by the following technical solution: a flexible and lightweight deep neural network model generalization method, the method comprising the following steps:
[0007] 1) Stratification according to the model;
[0008] 2) Obtain model probability output;
[0009] 3) Select the modulation mode according to user needs;
[0010] 4) Obtain model output;
[0011] 5) Determine the model modulation level.
[0012] Preferably, in step 1), for the deep neural network model to be processed, the modulation control point is determined by dividing the neural network into a feature extractor before the probability output and a probability mapper after the probability output. The probability output between the two parts becomes the most direct and effective point of modulation. In form, let f1 represent the mapping of input x to probability output function, indicating that f2 will The function mapped to the final output y. The entire network can be expressed as in and
[0013] Preferably, in step 2), the feature extractor f1 obtained in step 1 is subjected to the inference step to obtain the probability of its output Used for model modulation.
[0014] Preferably, the step 3) is specifically as follows:
[0015] The utility modulation mode should be selected when you want to provide different service levels or control the utility of the model output, and the focus modulation mode should be selected when you need to adjust the responsiveness of the model to specific characteristics of the input.
[0016] Preferably, in step 4), for the probability mapper f2 obtained in step 1, the original probability output Replaced with the modulated probability output The inference process is performed as input to obtain the final output of the modulated model.
[0017] Preferably, in step 5), in order to obtain the optimal noise level, the noise level σ is increased in increments of 0.2 so as to finely control the modulation process. During utility modulation, the output utility of the model decreases as the noise level increases. During focus modulation, the response of the model to a specific category becomes stronger as the noise level increases. When the requirements are met, the noise level is stopped from being increased.
[0018] Preferably, in step 5), in order to correctly evaluate the output quality and user preference of the semantic segmentation model, the mean intersection over union (mIoU) index is used to measure the output quality of the model, and the accuracy index of the target category is used to measure the degree of user preference response, and the calculation methods are as follows:
[0019] The intersection over union (IoU) calculates the ratio of the intersection and union of the predicted segmentation result to the true segmentation result. Assuming that the predicted result for a certain category is P (indicating the set of pixels predicted to be of that category) and the true result is G (indicating the set of pixels that actually belong to that category), the IoU calculation formula for that category is:
[0020]
[0021] In semantic segmentation tasks, images usually contain multiple categories, and mIoU is the average IoU of all categories.
[0022]
[0023] Where n is the number of categories and is the IoU i The intersection-over-union ratio of the i-th category;
[0024] The calculation of accuracy is based on the comparison between the model's prediction results and the true labels. The calculation formula for the accuracy of the target category is:
[0025]
[0026] Where N is the number of all samples of the target category, I(·) is the indicator function, if the condition in the brackets holds (i.e. the category predicted by the model is the same as the true category), then I(·) = 1; otherwise I(·) = 0.
[0027] Preferably, the utility modulation is performed by outputting the probability of all models Add controlled Gaussian noise ∈ with zero mean and different standard deviations σ to apply utility modulation to obtain the modulated noise output The specific description is as follows:
[0028]
[0029] Preferably, the focus modulation adjusts the responsiveness of the model to a specific feature by adding restricted noise, so that the model pays more attention to or ignores the specific feature to obtain the modulated noise output. The specific description is as follows:
[0030]
[0031] As a preference, for utility modulation, a direct mapping between model utility and noise variance is established through the following formula, so that the model owner can precisely adjust the model performance according to needs:
[0032]
[0033] in Φ(·) is the cumulative distribution function of the standard normal distribution;
[0034] At the same time, the following formula analyzes the rate of change of probability to noise variance, providing a theoretical basis and effect evaluation reference for utility modulation:
[0035]
[0036] where φ(·) is the probability density function of the standard normal distribution;
[0037] For focus modulation, the following formula is used to analyze the probability that affects the model prediction when a specific probability output is adjusted, providing users with a basis for controlling the model's attention to specific features through noise levels, allowing users to enhance adaptability without modifying the model structure, while improving the accuracy of target classes (such as "person", "traffic light", "bicycle", "car", etc.) while maintaining overall model performance:
[0038] Given and noise ε~N(0,σ 2 ), there is the following relationship:
[0039]
[0040] The beneficial effects of the present invention are as follows:
[0041] 1) Meet diverse needs, provide utility control for model owners, provide feature focus adjustment for users, accurately meet different needs, effectively solve the limitations of traditional methods in meeting diverse needs, and enhance the practicality and adaptability of models; 2) Flexible modulation mode, this method intervenes based on probability output, which has a significant impact on model decision-making and is easy to fine-tune, bringing more possibilities for model application; 3) Wide applicability, relying on the commonality of probability distribution in the deep neural network architecture, the method proposed in the present invention can be seamlessly integrated into a variety of tasks and models, with strong versatility, and can be effectively applied in different application scenarios, strongly supporting the wide application of deep neural networks in multiple fields and reducing customized development work; 4) High resource utilization, the method proposed in the present invention runs in a way that is independent of training data and does not require retraining, saving computing resources and data access costs, realizing multiple behaviors through a single model, reducing model version maintenance overhead, optimizing resource utilization, reducing deployment and maintenance costs, and improving overall efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of the deep neural network model generalization method of the present invention;
[0043] Figure 2 This is an application flow chart of the deep neural network model generalization method of the present invention. DETAILED DESCRIPTION
[0044] In order to enable those skilled in the art to more clearly understand the objectives, technical solutions and advantages of the present invention, the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0045] In the description of the present invention, it is necessary to understand that the orientation or position relationship indicated by the terms such as "up", "down", "left", "right", "inside", "outside", "horizontal" and "vertical" is based on the orientation or position relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention, rather than indicating or implying that the device or original referred to must have a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0046] The present invention will be described in detail below with reference to the accompanying drawings: Figure 1 As shown, a flexible and lightweight deep neural network model generalization method comprises the following steps:
[0047] 1) Stratification according to the model;
[0048] 2) Obtain model probability output;
[0049] 3) Select the modulation mode according to user needs;
[0050] 4) Obtain model output;
[0051] 5) Determine the model modulation level.
[0052] In step 1), for the deep neural network model to be processed, the modulation control point is determined by dividing the neural network into a feature extractor before the probability output and a probability mapper after the probability output. The probability output between the two parts becomes the most direct and effective point of modulation. In form, let f1 represent the mapping of input x to probability output function, indicating that f2 will The function mapped to the final output y. The entire network can be expressed as in and
[0053] Step 2) performs the inference step for the feature extractor f1 obtained in step 1 to obtain the probability of its output Used for model modulation.
[0054] The step 3) is specifically as follows:
[0055] The utility modulation mode should be selected when you want to provide different service levels or control the utility of the model output, and the focus modulation mode should be selected when you need to adjust the responsiveness of the model to specific characteristics of the input.
[0056] Step 4) converts the original probability output to the probability mapper f2 obtained in step 1 Replaced with the modulated probability output The inference process is performed as input to obtain the final output of the modulated model.
[0057] In step 5), in order to obtain the optimal noise level, the noise level σ is increased in increments of 0.2 so as to finely control the modulation process. During utility modulation, the output utility of the model decreases as the noise level increases. During focus modulation, the response of the model to a specific category becomes stronger as the noise level increases. When the requirements are met, the noise level is stopped from being increased.
[0058] In step 5), in order to correctly evaluate the output quality and user preference of the semantic segmentation model, the mean intersection over union (mIoU) indicator is used to measure the output quality of the model, and the accuracy indicator of the target category is used to measure the degree of user preference response. The calculation methods are as follows:
[0059] The intersection over union (IoU) calculates the ratio of the intersection and union of the predicted segmentation result to the true segmentation result. Assuming that the predicted result for a certain category is P (indicating the set of pixels predicted to be of that category) and the true result is G (indicating the set of pixels that actually belong to that category), the IoU calculation formula for that category is:
[0060]
[0061] In semantic segmentation tasks, images usually contain multiple categories, and mloU is the average IoU of all categories.
[0062]
[0063] Where n is the number of categories and is the IoU i The intersection-over-union ratio of the i-th category;
[0064] The calculation of accuracy is based on the comparison between the model's prediction results and the true labels. The calculation formula for the accuracy of the target category is:
[0065]
[0066] Where N is the number of all samples of the target category, I(·) is the indicator function, if the condition in the brackets holds (i.e. the category predicted by the model is the same as the true category), then I(·) = 1; otherwise I(·) = 0.
[0067] Preferably, the utility modulation is performed by outputting the probability of all models Add controlled Gaussian noise ∈ with zero mean and different standard deviations σ to apply utility modulation to obtain the modulated noise output The specific description is as follows:
[0068]
[0069] The focus modulation adjusts the responsiveness of the model to a specific feature by adding restricted noise, so that the model pays more attention to or ignores the specific feature to obtain the modulated noise output. The specific description is as follows:
[0070]
[0071] For utility modulation, a direct mapping between model utility and noise variance is established through the following formula, allowing model owners to precisely adjust model performance according to their needs:
[0072]
[0073] in Φ(·) is the cumulative distribution function of the standard normal distribution;
[0074] At the same time, the following formula analyzes the rate of change of probability to noise variance, providing a theoretical basis and effect evaluation reference for utility modulation:
[0075]
[0076] where φ(·) is the probability density function of the standard normal distribution;
[0077] For focus modulation, the following formula is used to analyze the probability that affects the model prediction when a specific probability output is adjusted, providing users with a basis for controlling the model's attention to specific features through noise levels, allowing users to enhance adaptability without modifying the model structure, while improving the accuracy of target classes (such as "person", "traffic light", "bicycle", "car", etc.) while maintaining overall model performance:
[0078] Given and noise ε~N(0,σ 2 ), there is the following relationship:
[0079]
[0080] Utility modulation allows the model output to deviate from the original output, which is extremely useful in scenarios that require constrained responses. Focus modulation aims to make the model more sensitive to specific areas of interest, which is important for predicting specific potential harm categories. For model owners seeking controllability, it is critical to ensure that utility modulation preserves the core knowledge of the model so that the output remains meaningful even when the output quality is reduced (for example, a large language model should always provide coherent output at different utility levels) and does not compromise the integrity of the model. For users who desire adaptability, it is critical to balance the trade-off between emphasizing specific inputs (such as prioritizing certain features in an advanced replica driving system) and maintaining overall performance in focus modulation, as over-intervention will affect the effectiveness of the model in other areas. By supporting two types of model modulation, utility and focus modulation, it is possible to modulate the model without retraining or changing the model architecture.
[0081] In step 1 of the above method, the feature extractor is responsible for extracting representative feature information from the input data. This feature information is the basis for subsequent decision-making and prediction, and contains key patterns, structures, and attributes in the input data. In the image semantic segmentation task, the feature extractor will identify features such as edges, textures, and shapes from image pixels; the feature extractor gradually transforms the original input data into a more abstract and informative feature representation through a series of complex calculations and transformation operations. This process involves multiple hidden layers of neuron calculations, and each hidden layer is constantly abstracting and transforming the data to dig out deeper information.
[0082] The probability mapper maps the extracted feature information to the final probability output based on the feature extractor. It further processes and analyzes the features output by the feature extractor, and calculates the normalized confidence level of each possible output result based on the pre-learned model parameters and algorithm logic. For example, in multi-classification tasks, the softmax function and other methods are usually used to map features to probability values of each category. These results reflect the model's confidence level in different output results.
[0083] The probability output between these two parts, that is, the stage where the feature extractor outputs and has not yet been processed by the probability mapper, becomes the most direct and effective point for modulation. This is because at this stage, the data has been preliminarily processed by the feature extractor and contains rich feature information, but has not yet been finalized as a specific output result. Modulating it at this time can flexibly change the decision tendency of the model without destroying the underlying feature learning structure of the model.
[0084] In step 3 of the above method, the model modulation method to be used is automatically selected according to the task objectives and deployment scenarios. In the scenario where the model owner produces multiple models, utility modulation is used, and in the scenario where the model user is personalized, focus modulation is used.
[0085] In step 5 of the above method, in order to correctly evaluate the output quality and user preference of the semantic segmentation model, the present invention uses the mean intersection over union (mIoU) indicator to measure the output quality of the model, and uses the accuracy (acCuracy) indicator of the target category to measure the degree of user preference response. The calculation methods are as follows:
[0086] The intersection over union (IoU) calculates the ratio of the intersection and union of the predicted segmentation result to the true segmentation result. Assuming that the predicted result for a certain category is P (indicating the set of pixels predicted to be of that category) and the true result is G (indicating the set of pixels that actually belong to that category), the IoU calculation formula for that category is:
[0087]
[0088] In semantic segmentation tasks, images usually contain multiple categories, and mIoU is the average IoU of all categories.
[0089]
[0090] Where n is the number of categories and is the IoU i The intersection-over-union ratio of the ith category.
[0091] The accuracy is calculated based on the comparison between the model's prediction results and the true label. The accuracy calculation formula for the target category is:
[0092]
[0093] Where N is the number of all samples of the target category, I(·) is the indicator function, if the condition in the brackets holds (i.e. the category predicted by the model is the same as the true category), then I(·) = 1; otherwise I(·) = 0.
[0094] The method of the present invention is used for multi-version and personalized model modulation of image semantic segmentation, and can produce deep neural network models of different qualities and different user preferences without retraining or changing the model architecture.
[0095] The embodiments of the present invention are described in further detail below.
[0096] An embodiment of the present invention provides a model generalization method, which is a method for generalizing a semantic segmentation model, and can enable a model user or model user to automatically provide corresponding model generalization services according to their needs.
[0097] like Figure 2 As shown, the model generalization method of the present invention is divided into two application scenarios: model owner and model user. In the usage scenario oriented to model users, the model user is allowed to select a type preference to complete personalized model modulation.
[0098] In the utility modulation scenario for the model owner, the method of the present invention comprises the following steps:
[0099] (11) Layering according to the model: For the deep neural network model to be processed, the present invention determines the modulation control point by dividing the neural network into a feature extractor before the probability output and a probability mapper after it. The probability output between the two parts becomes the most direct and effective point of modulation. Formally, let f1 represent the mapping of input x to probability output function, indicating that f2 will The function mapped to the final output y. The entire network can be expressed as in and
[0100] (12) Obtain model probability output: For the feature extractor f1 obtained in step 1, execute its inference step to obtain the probability of its output For model modulation;
[0101] (13) Utility modulation of model probability output: by modulating the probability output of all models Add controlled Gaussian noise ∈ with zero mean and different standard deviations σ to apply utility modulation to obtain the modulated noise output The specific description is as follows
[0102]
[0103] (14) Obtain model output: For the probability mapper f2 obtained in step 1, the original probability output Replaced with the modulated probability output Perform the inference process as input to obtain the final output of the modulated model;
[0104] (15) Determine the model modulation level: In order to obtain the optimal noise level, the noise level σ is increased in increments of 0.2 to finely control the modulation process. As the noise level increases, the output utility of the model decreases. When the requirements of the model owner are met, the noise level is stopped. When the variance of the model probability output is small (for example, due to the Llama model with normalization in the last layer), the process is stopped earlier based on the mean and standard deviation of the probability output to ensure effective modulation and stability.
[0105] In the focus modulation scenario for the model user, the method of the present invention comprises the following steps:
[0106] (21) Layering according to the model: For the deep neural network model to be processed, the present invention determines the modulation control point by dividing the neural network into a feature extractor before the probability output and a probability mapper after it. The probability output between the two parts becomes the most direct and effective point of modulation. Formally, let f1 represent the mapping of input x to probability output function, indicating that f2 will The function mapped to the final output y. The entire network can be expressed as in Head
[0107] (22) Obtain model probability output: For the feature extractor f1 obtained in step 1, execute its inference step to obtain the probability of its output For model modulation;
[0108] (23) The user selects a preferred category and performs focus modulation on the model probability output: by adding restricted noise to adjust the model's responsiveness to specific features, the model pays more attention to or ignores specific features to obtain a modulated noise output The specific description is as follows
[0109]
[0110] (24) Obtain model output: For the probability mapper f2 obtained in step 1, the original probability output Replaced with the modulated probability output Perform the inference process as input to obtain the final output of the modulated model;
[0111] (25) Determine the model modulation level: In order to obtain the optimal noise level, the noise level σ is increased in increments of 0.2 so that the modulation process can be finely controlled. As the noise level increases, the model output becomes more responsive to specific categories. When the model user requirements are met, the noise level is stopped from increasing.
[0112] The advantages of the privacy protection method of the present invention are:
[0113] 1) Meet diverse needs, provide utility control for model owners, provide feature focus adjustment for users, accurately meet different needs, effectively solve the limitations of traditional methods in meeting diverse needs, and enhance the practicality and adaptability of models; 2) Flexible modulation mode, this method intervenes based on probability output, which has a significant impact on model decision-making and is easy to fine-tune, bringing more possibilities for model application; 3) Wide applicability, relying on the commonality of probability distribution in the deep neural network architecture, the method proposed in the present invention can be seamlessly integrated into a variety of tasks and models, with strong versatility, and can be effectively applied in different application scenarios, strongly supporting the wide application of deep neural networks in multiple fields and reducing customized development work; 4) High resource utilization, the method proposed in the present invention runs in a way that is independent of training data and does not require retraining, saving computing resources and data access costs, realizing multiple behaviors through a single model, reducing model version maintenance overhead, optimizing resource utilization, reducing deployment and maintenance costs, and improving overall efficiency.
[0114] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0115] Anyone familiar with the technology may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A flexible and lightweight deep neural network model generalization method, characterized in that: The method comprises the following steps: 1) Stratification according to the model; 2) Obtain model probability output; 3) Select the modulation mode according to user needs; 4) Obtain model output; 5) Determine the model modulation level.
2. The flexible and lightweight deep neural network model generalization method according to claim 1, characterized in that: In step 1), for the deep neural network model to be processed, the modulation control point is determined by dividing the neural network into a feature extractor before the probability output and a probability mapper after the probability output. The probability output between the two parts becomes the most direct and effective point of modulation. In form, let f1 represent the mapping of input x to probability output function, indicating that f2 will The function mapped to the final output y. The entire network can be expressed as in and 3. The flexible and lightweight deep neural network model generalization method according to claim 1, characterized in that: Step 2) performs the inference step for the feature extractor f1 obtained in step 1 to obtain the probability of its output Used for model modulation.
4. The flexible and lightweight deep neural network model generalization method according to claim 1, characterized in that: The step 3) is specifically as follows: The utility modulation mode should be selected when you want to provide different service levels or control the utility of the model output, and the focus modulation mode should be selected when you need to adjust the responsiveness of the model to specific characteristics of the input.
5. The flexible and lightweight deep neural network model generalization method according to claim 1, characterized in that: The step 4) converts the original probability output to the probability mapper f2 obtained in step 1 Replaced with the modulated probability output The inference process is performed as input to obtain the final output of the modulated model.
6. The flexible and lightweight deep neural network model generalization method according to claim 1, characterized in that: In step 5), in order to obtain the optimal noise level, the noise level σ is increased in increments of 0.2 so as to finely control the modulation process. During utility modulation, the output utility of the model decreases as the noise level increases. During focus modulation, the response of the model to a specific category becomes stronger as the noise level increases. When the requirements are met, the noise level is stopped from being increased.
7. The flexible and lightweight deep neural network model generalization method according to claim 1 or 6, characterized in that: In step 5), in order to correctly evaluate the output quality and user preference of the semantic segmentation model, the average intersection-over-union ratio indicator is used to measure the output quality of the model, and the accuracy indicator of the target category is used to measure the degree of user preference response. The calculation methods are as follows: The intersection-over-union ratio calculates the ratio of the intersection and union of the predicted segmentation result and the true segmentation result. Assuming that the predicted result for a certain category is P, which represents the set of pixels predicted to be in this category, and the true result is G, which represents the set of pixels that actually belong to this category, then the IoU calculation formula for this category is: In semantic segmentation tasks, images usually contain multiple categories, and mIoU is the average IoU of all categories. Where n is the number of categories and is the IoU i The intersection-over-union ratio of the i-th category; The calculation of accuracy is based on the comparison between the model's prediction results and the true labels. The calculation formula for the accuracy of the target category is: Where N is the number of all samples of the target category, I(·) is the indicator function, if the condition in the brackets holds (i.e. the category predicted by the model is the same as the true category), then I(·) = 1; otherwise I(·) = 0.
8. The flexible and lightweight deep neural network model generalization method according to claim 1 or 4, characterized in that: The utility modulation is achieved by giving all models the probability output Add controlled Gaussian noise ∈ with zero mean and different standard deviations σ to apply utility modulation to obtain the modulated noise output The specific description is as follows:
9. The flexible and lightweight deep neural network model generalization method according to claim 1 or 4, characterized in that: The focus modulation adjusts the responsiveness of the model to a specific feature by adding restricted noise, so that the model pays more attention to or ignores the specific feature to obtain the modulated noise output. The specific description is as follows:
10. The flexible and lightweight deep neural network model generalization method according to claim 9, characterized in that: For utility modulation, a direct mapping between model utility and noise variance is established through the following formula, allowing model owners to precisely adjust model performance according to their needs: in Φ(·) is the cumulative distribution function of the standard normal distribution; At the same time, the following formula analyzes the rate of change of probability to noise variance, providing a theoretical basis and effect evaluation reference for utility modulation: where φ(·) is the probability density function of the standard normal distribution; For focus modulation, the following formula is used to analyze the probability of affecting model prediction when a specific probability output is adjusted, providing users with a basis for controlling the model's attention to specific features through noise levels, allowing users to enhance adaptability without modifying the model structure, and maintain overall model performance while improving the accuracy of the target class: Given and noise∈~N(0,σ 2 ), there is the following relationship: