A hierarchical activation selection target recognition model optimization method
By employing a hierarchical activation selection method, precision sensitivity evaluation and activation function allocation are performed on the convolutional module, solving the inference latency and accuracy loss problems of target recognition models on edge hardware platforms, and achieving efficient inference and accuracy preservation on edge hardware platforms.
Patent Information
- Application Number
- CN202611435007.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-27
AI Technical Summary
The existing target recognition models suffer from high inference latency and significant accuracy loss on edge hardware platforms, mainly because the globally uniformly configured activation function cannot simultaneously meet the differentiated accuracy requirements of each layer of the network and the actual operator efficiency of the edge hardware.
By employing a hierarchical activation selection method, the accuracy sensitivity of convolutional modules is evaluated layer by layer, and activation functions with increasing computational complexity are assigned to ensure that shallow modules have low computational complexity and deep modules have high computational complexity. Inference time is estimated and iteratively optimized by combining the activation operator efficiency of the edge hardware platform.
While ensuring detection accuracy, the overall computational overhead of the model is effectively reduced, achieving acceleration on edge hardware platforms. Furthermore, the activation configuration is adjusted through real-time accuracy feedback to ensure continuous optimization of the model in actual deployment.
Smart Images

Figure CN123181963A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning model optimization technology, and in particular to a method for optimizing a target recognition model using hierarchical activation selection. Background Technology
[0002] Target recognition technology is one of the core tasks in the field of computer vision, and it is widely used in scenarios such as autonomous driving, intelligent security monitoring, industrial quality inspection, drone inspection, smart retail, and medical image analysis. With the rapid development of the Internet of Things and edge intelligence technologies, more and more target recognition tasks need to be inferred in real time on resource-constrained edge hardware platforms. These edge hardware platforms are usually characterized by limited computing power, limited memory bandwidth, and strict power consumption budgets, which places extremely high demands on the computational efficiency of each operator in the model.
[0003] Activation functions, as core operators introducing nonlinear mappings in deep neural networks, directly impact the inference latency and energy efficiency of models on edge hardware due to their computational complexity. Different activation functions exhibit significant differences in computational overhead. On edge hardware platforms, these activation operators, which involve exponential operations and hyperbolic functions, are often not efficiently supported by hardware acceleration units, becoming one of the bottlenecks to inference latency.
[0004] In existing target recognition models, the most classic approach is to use a uniform activation function throughout the entire network. However, this globally uniform configuration cannot distinguish the different requirements of different layers of the network for nonlinear expression capabilities, resulting in unnecessary computational overhead in shallow layers and sacrifice of detection accuracy in deeper layers. Similarly, simply replacing the activation function of the modules in the network structure globally cannot achieve the optimal trade-off between accuracy and efficiency layer by layer. Summary of the Invention
[0005] Based on the above analysis, the embodiments of the present invention aim to provide a hierarchical activation selection target recognition model optimization method to solve the problem that existing globally unified activation function configuration or module-level simple replacement activation function cannot take into account the differentiated accuracy requirements of each layer of the network and the actual operator efficiency of edge hardware, resulting in high inference latency and large accuracy loss of the target recognition model on the edge hardware platform.
[0006] The objective of this invention is mainly achieved through the following technical solutions: On the one hand, the present invention provides a method for optimizing a target recognition model using hierarchical activation selection, comprising the following steps: The activation functions of each convolutional module in the target recognition model to be optimized are uniformly set as the initial activation functions, and pre-training is performed to obtain the baseline model and baseline accuracy index. The initial activation functions in the baseline model are replaced by the first activation function, and inference evaluation is performed on the validation set. Based on the evaluation results and the baseline accuracy index, the comprehensive accuracy sensitivity score of each convolutional module is obtained. Based on the comprehensive accuracy sensitivity scores and the activation operator efficiency of the edge hardware platform, a matching activation function is assigned to each of the convolutional modules to obtain the initial optimized target recognition model; The initial optimized target recognition model is fine-tuned to obtain an optimized target recognition model.
[0007] Furthermore, the process of obtaining the comprehensive accuracy sensitivity score for each convolutional module includes: Inference was performed on each target recognition model after the activation function was replaced using the validation set, and the accuracy index of each convolutional module was obtained. Based on the baseline accuracy index and the accuracy index corresponding to each convolutional module, the accuracy sensitivity value of each convolutional module is obtained. The validation set is used to perform forward propagation on the baseline model to obtain the loss value of the baseline model; Based on the loss value of the baseline model and the output feature map of each convolutional module, the gradient norm of each convolutional module is obtained. Based on the accuracy sensitivity value and the gradient norm, the comprehensive accuracy sensitivity score of each convolutional module is obtained.
[0008] Furthermore, the accuracy sensitivity value is the difference between the baseline accuracy index and the accuracy index; The gradient norm of each convolutional module is obtained from the loss value of the baseline model and the output feature maps of each convolutional module of the baseline model, including: The gradient norm of each convolutional module in the baseline model is obtained using the following formula: ; in, This represents the gradient norm of the i-th convolutional module in the baseline model; This represents the loss value of the baseline model; This represents the output feature map of the i-th convolutional module of the baseline model; This represents the Frobenius norm.
[0009] Furthermore, the comprehensive accuracy sensitivity score of each convolutional module is obtained based on the accuracy sensitivity value and the gradient norm, including: The precision sensitivity values of each convolutional module are subjected to maximum and minimum normalization to obtain normalized precision sensitivity values. The gradient norm of each convolutional module is subjected to minimax normalization to obtain the normalized gradient norm. The normalized accuracy sensitivity value and the normalized gradient norm are weighted and summed to obtain the comprehensive accuracy sensitivity score of each convolution module.
[0010] Furthermore, based on the comprehensive accuracy sensitivity scores and the activation operator efficiency of the edge hardware platform, a matching activation function is assigned to each of the convolutional modules to obtain an initial optimized target recognition model, including: Based on the comprehensive accuracy sensitivity score, low accuracy sensitivity threshold and high accuracy sensitivity threshold, the convolutional modules are divided into accuracy-sensitive categories, and the activation function matching each convolutional module is set based on the division results to obtain the candidate target recognition model. Based on the efficiency of the activation operator, the inference time estimate of the candidate target recognition model is obtained; If the ratio of the estimated inference time to the total inference time of the baseline model does not meet the preset speedup constraint, the high-precision sensitivity threshold is increased, and each convolutional module is re-divided into precision-sensitive categories based on the low-precision sensitivity threshold and the increased high-precision sensitivity threshold. Based on the new partitioning results, the activation function of each convolutional module is set and the estimated inference time is calculated until the ratio of the estimated inference time to the total inference time of the baseline model meets the preset speedup constraint. An initial optimized target recognition model is obtained based on the activation functions of each convolutional module that satisfy the preset speedup constraint.
[0011] Furthermore, the step of performing precision-sensitive partitioning on each of the convolutional modules and setting activation functions matching each of the convolutional modules based on the partitioning results includes: When the overall accuracy sensitivity score is less than or equal to the low accuracy sensitivity threshold, the convolution module is set as a low accuracy sensitive module, and the activation function in the convolution module is replaced with the first activation function; When the overall accuracy sensitivity score is greater than the low accuracy sensitivity threshold and less than or equal to the high accuracy sensitivity threshold, the convolution module is set as a medium accuracy sensitivity module, and the activation function in the convolution module is replaced with a second activation function. When the overall accuracy sensitivity score is greater than the high accuracy sensitivity threshold, the convolution module is set as a high accuracy sensitive module, and the activation function in the convolution module is replaced with a third activation function; wherein, the computational complexity of the first activation function is lower than that of the second activation function; and the computational complexity of the second activation function is lower than that of the third activation function.
[0012] Furthermore, the inference time estimate of the candidate target recognition model is obtained using the following formula: ; ; Where N represents the number of convolutional modules; This represents the activation function used in the i-th convolutional module; This represents the inference time of the i-th convolutional module; This represents the single-element floating-point computation cost of the activation function used in the i-th convolutional module; , and These represent the height, width, and number of channels of the output feature map of the i-th convolutional module, respectively. This represents the effective computational throughput of the activation function used in the i-th convolutional module; This represents the memory access overhead of the activation function used in the i-th convolutional module.
[0013] Furthermore, the step of fine-tuning the initial optimized target recognition model to obtain an optimized target recognition model includes: freezing the parameters of the low-precision sensitive modules in the initial optimized target recognition model, using a learning rate lower than that in the pre-training stage, and fine-tuning the initial optimized target recognition model until convergence to obtain an optimized target recognition model.
[0014] Furthermore, it also includes: The optimized target recognition model is evaluated by inference on the validation set to obtain offline accuracy data; wherein, the offline accuracy data includes offline global accuracy index, offline classification accuracy index and offline regional accuracy index; The optimized target recognition model is deployed to an edge hardware platform to perform target recognition tasks, and inference accuracy feedback data and inference latency data are collected periodically; wherein, the inference accuracy feedback data includes global inference accuracy index, inference category accuracy index, and inference region accuracy index; When the decrease in the inference accuracy feedback data relative to the offline accuracy data exceeds a preset threshold, the activation functions of each convolutional module in the target recognition model are adjusted until the joint accuracy-efficiency constraint condition is met.
[0015] Furthermore, when the decrease in the inference accuracy feedback data relative to the offline accuracy data exceeds a preset threshold, the activation functions of each convolutional module in the target recognition model are adjusted, including: When any item in the inference accuracy feedback data decreases more than the corresponding preset decrease threshold relative to the offline accuracy data, the activation functions of the medium-precision sensitive module and the low-precision sensitive module in the target recognition model are upgraded sequentially until the accuracy requirements are met. After the accuracy adjustment is performed, if the inference delay index exceeds the preset delay threshold, the activation functions of the low-precision sensitive module and the medium-precision sensitive module in the target recognition model are downgraded in sequence, provided that the accuracy requirements are met, until the delay requirements are met or all downgradeable modules have been downgraded.
[0016] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects: 1. This invention evaluates the accuracy sensitivity of each convolutional module in the target recognition model layer by layer, dividing each convolutional module into three levels: low-precision sensitive module, medium-precision sensitive module, and high-precision sensitive module. It then assigns a first activation function, a second activation function, and a third activation function with increasing computational complexity to each module. This ensures that activation functions with low computational complexity are placed in shallow modules with minimal impact on accuracy, while activation functions with high computational complexity are placed in deep modules with significant impact on accuracy. This effectively reduces the overall computational cost of the model while maintaining detection accuracy.
[0017] 2. This invention uses two indicators: the accuracy loss after replacing the activation function module by module and the gradient contribution of the activation output of each module to the detection loss. After normalization, these indicators are weighted and fused to obtain a comprehensive accuracy sensitivity score. This avoids the bias that may be caused by a single indicator evaluation and makes the hierarchical division results more accurate and reliable.
[0018] 3. This invention incorporates the actual computational efficiency of each activation operator on the edge hardware platform into the activation function allocation decision. By constructing an activation operator efficiency calculation, the inference time estimate under the hierarchical activation configuration is calculated. The allocation scheme is iteratively corrected with speedup constraints to ensure that the optimization scheme produces a real acceleration effect in actual edge deployment.
[0019] 4. This invention deploys the target recognition model to an edge hardware platform and periodically collects inference accuracy feedback data and inference latency data from the edge hardware platform. These data are then compared with offline accuracy data. When the accuracy decreases or the latency exceeds the standard, the activation functions of each module are upgraded or downgraded, enabling the model to continuously optimize the activation configuration based on the accuracy performance in the actual deployment environment.
[0020] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0021] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0022] Figure 1 This is a flowchart illustrating a target recognition model optimization method for hierarchical activation selection in an embodiment of the present invention. Detailed Implementation
[0023] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0024] A specific embodiment of the present invention discloses a method for optimizing a target recognition model using hierarchical activation selection, such as... Figure 1 As shown, it includes the following steps S1-S2: Step S1: Set the activation functions of each convolutional module in the target recognition model to be optimized as the initial activation functions and perform pre-training to obtain the baseline model and baseline accuracy index.
[0025] Specifically, the target recognition model to be optimized is a deep learning target detection network, which includes multiple convolutional modules. Each convolutional module is a combination of convolutional layers, batch normalization layers, and activation function layers in the target recognition model to be optimized, and is sequentially numbered from the 1st to the Nth convolutional module according to the forward propagation order, where N represents the total number of convolutional modules included in the target recognition model.
[0026] In this embodiment, the activation functions of all convolutional modules in the target recognition model to be optimized are uniformly set as the initial activation functions. The SiLU function or the Swish function can be used. The target recognition model with the replaced activation functions is pre-trained using the training dataset used to train the target recognition model until the model converges and the baseline model is obtained.
[0027] For the baseline model, inference evaluation is performed using the validation set. Following the commonly used mAP@0.5 calculation method in the object detection field, the mean accuracy (mAP@0.5) of the baseline model on the validation set when the intersection-union ratio threshold is 0.5 is obtained, which serves as the baseline accuracy index. .
[0028] Step S2: Replace each of the initial activation functions in the baseline model with the first activation function, and perform inference evaluation on the validation set respectively. Based on the evaluation results and the baseline accuracy index, obtain the comprehensive accuracy sensitivity score of each convolutional module.
[0029] Specifically, the first activation function uses the simplest activation function, which can be regarded as reducing the complexity of the activation function to the minimum, thereby determining the nonlinear expressive power requirements of each convolution module for the activation function.
[0030] In this embodiment, the first activation function is LeakyReLU. LeakyReLU is a piecewise linear activation function. Its single forward computation requires only one comparison operation and one multiplication operation, without any exponential, logarithmic, or hyperbolic function operations. At the same time, unlike standard ReLU which directly sets negative values to 0, LeakyReLU retains a small linear gradient in the negative value range, avoiding the problem of neuron death. This allows the replaced model to still maintain basic gradient flow and prevents the model from completely failing due to the replacement of the activation function, thus enabling the evaluation results to reflect the true differences between modules.
[0031] Furthermore, obtaining the comprehensive accuracy sensitivity score for each convolutional module includes steps S21-S25: Step S21: Use the validation set to perform inference on each target recognition model after replacing the activation function, and obtain the accuracy index corresponding to each convolutional module.
[0032] Specifically, for the i-th convolutional module in the baseline model, its activation function is replaced by the first activation function, while keeping the activation functions of all other convolutional modules unchanged, resulting in a target recognition model with a replaced activation function.
[0033] The target recognition model with the replaced activation function was evaluated using the validation set. The accuracy index of this model on the validation set was obtained according to the calculation method of mAP@0.5. Each convolutional module in the baseline model is replaced and evaluated using inference to obtain the accuracy metrics for each convolutional module: .
[0034] Understandably, by replacing the activation function of each convolutional module one by one and performing inference evaluation separately to obtain the corresponding accuracy metric, the dependence of each convolutional module on the nonlinear expressive power of the initial activation function can be independently measured, and the resulting accuracy metric for each convolutional module can be evaluated. It can accurately reflect the first The impact of replacing each convolutional module with the first activation function on the overall accuracy of the baseline model.
[0035] Step S22: Based on the baseline accuracy index and the accuracy index corresponding to each convolutional module, obtain the accuracy sensitivity value of each convolutional module.
[0036] Specifically, the accuracy sensitivity value is the difference between the baseline accuracy index and the accuracy index, and its formula is: ; in, This represents the precision sensitivity value of the i-th convolutional module; Baseline accuracy index; This is the accuracy metric after replacing the activation function of the i-th convolutional module with the first activation function.
[0037] It should be noted that if the precision sensitivity value of the convolution module is negative, the precision sensitivity value should be set to 0.
[0038] Understandably, the higher the precision sensitivity value, the stronger the dependence of the convolutional module on the initial activation function, that is, the higher the precision sensitivity of the convolutional module.
[0039] Step S23: Perform forward propagation on the baseline model using the validation set to obtain the loss value of the baseline model.
[0040] Specifically, the validation set is input into the baseline model, and the detection prediction results are obtained after layer-by-layer forward propagation. The detection prediction results and the real results in the validation set are calculated using the same loss function as during pre-training to obtain the loss value of the baseline model.
[0041] For example, the loss function can be a weighted sum of classification loss, bounding box regression loss, and confidence loss.
[0042] Step S24: Based on the loss value of the baseline model and the output feature map of each convolutional module, obtain the gradient norm of each convolutional module.
[0043] Specifically, using the loss value of the baseline model, backpropagation is performed on the baseline model, and the partial derivative of the loss value with respect to the output feature map of each convolutional module of the baseline model is calculated using the following formula to obtain the gradient tensor corresponding to each convolutional module with the same shape as the output feature map.
[0044] Furthermore, the gradient norm of each convolutional module of the baseline model is obtained using the following formula: ; in, This represents the gradient norm of the i-th convolutional module in the baseline model; This represents the loss value of the baseline model; This represents the output feature map of the i-th convolutional module of the baseline model; This represents the Frobenius norm.
[0045] Understandable, gradient norm The larger the value, the greater the impact of the output feature map of the i-th convolutional module in the baseline model on the final detection loss, that is, the greater the contribution of this module to the final detection accuracy and the higher the accuracy sensitivity. The smaller the value, the smaller the impact of the module on the final detection loss, and the lower the accuracy sensitivity.
[0046] Step S25: Based on the accuracy sensitivity value and the gradient norm, obtain the comprehensive accuracy sensitivity score for each convolutional module, including: The precision sensitivity values of each convolution module are subjected to maximum and minimum normalization to obtain normalized precision sensitivity values.
[0047] Specifically, the precision sensitivity values of each convolutional module are normalized using the following formula to obtain the normalized precision sensitivity values of each convolutional module: ; in, This represents the normalized precision sensitivity value of the i-th convolutional module; and These represent the minimum and maximum precision sensitivity values among all convolutional modules, respectively.
[0048] The gradient norm of each convolutional module is subjected to minimax normalization to obtain the normalized gradient norm.
[0049] Specifically, the gradient norm of each convolutional module is normalized using the following formula to obtain the normalized gradient norm of each convolutional module: ; in, Let represent the normalized gradient norm of the i-th convolutional module; and These represent the minimum and maximum values of the gradient norms of all convolutional modules, respectively.
[0050] The normalized accuracy sensitivity value and the normalized gradient norm are weighted and summed to obtain the comprehensive accuracy sensitivity score of each convolution module.
[0051] Specifically, the overall accuracy sensitivity score of each convolutional module is obtained using the following formula: ; in, This represents the overall accuracy sensitivity score of the i-th convolutional module; and Represent the weights of the precision sensitivity value and the gradient norm, respectively, satisfying... In this embodiment, we take , .
[0052] Understandably, the higher the overall accuracy sensitivity score of a convolutional module, the larger the value, indicating that the convolutional module is more dependent on the non-linear expressive power of the activation function and has higher accuracy sensitivity; the lower the overall accuracy sensitivity score, the smaller the value, indicating that the convolutional module is less sensitive to the type of activation function.
[0053] Step S3: Based on the comprehensive accuracy sensitivity score and the activation operator efficiency of the edge hardware platform, assign a matching activation function to each convolutional module to obtain the initial optimized target recognition model, including steps S31-S35: Step S31: Based on the comprehensive accuracy sensitivity score, low accuracy sensitivity threshold and high accuracy sensitivity threshold, perform accuracy sensitivity division on each convolutional module, and set the activation function matching each convolutional module based on the division result to obtain the candidate target recognition model.
[0054] Furthermore, the step of performing precision-sensitive partitioning on each of the convolutional modules and setting activation functions matching each of the convolutional modules based on the partitioning results includes: When the overall accuracy sensitivity score is less than or equal to the low accuracy sensitivity threshold, the convolution module is set as a low accuracy sensitive module, and the activation function in the convolution module is replaced with the first activation function; When the overall accuracy sensitivity score is greater than the low accuracy sensitivity threshold and less than or equal to the high accuracy sensitivity threshold, the convolution module is set as a medium accuracy sensitivity module, and the activation function in the convolution module is replaced with a second activation function. When the overall accuracy sensitivity score is greater than the high accuracy sensitivity threshold, the convolution module is set as a high accuracy sensitive module, and the activation function in the convolution module is replaced with a third activation function; wherein, the computational complexity of the first activation function is lower than that of the second activation function; and the computational complexity of the second activation function is lower than that of the third activation function.
[0055] Specifically, based on the comprehensive accuracy sensitivity score of each convolutional module, a low-precision sensitivity threshold is set. and high-precision sensitivity threshold Each of the convolutional modules is divided into three levels; among them, for The convolutional module has low requirements for the nonlinear expressive power of the activation function. When it is set to a simple activation function, the accuracy loss is minimal. This type of convolutional module is classified as a low-precision sensitive module.
[0056] for The convolutional module has certain requirements for the activation function, but does not require the strongest nonlinear expression. This type of convolutional module is classified as a medium-precision sensitive module.
[0057] for The convolutional module has high requirements for the non-linear smoothness and expressive power of the activation function. Replacing it with a simple activation function results in a significant loss of accuracy. Therefore, this type of convolutional module is classified as a high-precision sensitive module.
[0058] It should be noted that the low-precision sensitivity threshold and high-precision sensitivity threshold The relationship is: In this embodiment, the low-precision sensitivity threshold and the high-precision sensitivity threshold used in the first division are set to 0.35 and 0.7, respectively.
[0059] Furthermore, activation functions of corresponding levels are assigned to the low-precision sensitive module, the medium-precision sensitive module, and the high-precision sensitive module, namely a first activation function, a second activation function, and a third activation function. In this embodiment, the first activation function is the LeakyReLU activation function; the second activation function is the Mish activation function; and the third activation function is the Swish activation function.
[0060] Based on the above settings, the candidate target recognition model is obtained. Its structure is consistent with the baseline model, except that the activation functions of each convolutional module are configured differently according to the hierarchical division results.
[0061] Preferably, the low-precision sensitivity threshold and high-precision sensitivity threshold It can also be determined adaptively using the following methods, including: a comprehensive accuracy sensitivity score for all convolutional modules. Sort in ascending order; use K-Means clustering (K=3) for... Clustering yielded three cluster centers. These correspond to the center positions of the low-precision, medium-precision, and high-precision sensitive modules, respectively; take ; That is, the midpoint between two adjacent cluster centers is used as the threshold for hierarchical division.
[0062] The method described above, which automatically determines the threshold based on the actual distribution of sensitivity scores for each convolutional module, can adapt to the differences in different model structures and datasets, thereby improving the rationality and robustness of hierarchical partitioning.
[0063] Step S32: Based on the efficiency of the activation operator, the inference time estimate of the candidate target recognition model is obtained using the following formula: ; ; Where N represents the number of convolutional modules; This represents the activation function used in the i-th convolutional module; This represents the inference time of the i-th convolutional module; This represents the number of single-element floating-point operations (FLOPs / element) of the activation function used in the i-th convolutional module. , and These represent the height, width, and number of channels of the output feature map of the i-th convolutional module, respectively. This represents the effective computational throughput (FLOPs / s) of the activation function used in the i-th convolutional module. This represents the memory access overhead of the activation function used in the i-th convolutional module.
[0064] Specifically, the actual execution efficiency differences of different activation functions on the same hardware platform are not consistent with their theoretical computational complexity. Edge hardware platforms typically employ heterogeneous computing architectures. Dedicated acceleration units such as NPUs natively support linear piecewise functions like LeakyReLU, which only involve comparison and multiplication operations, resulting in extremely high execution efficiency. However, exponential, logarithmic, and hyperbolic function operations in Swish and Mish are mostly not natively supported by NPUs and must be executed on the CPU or general-purpose computing units, leading to actual execution times far exceeding theoretical values. Furthermore, the actual execution efficiency of the same activation function varies significantly across different edge hardware platforms. On GPU platforms, the efficiency gap between Swish and Mish and LeakyReLU is relatively small due to the good acceleration support for exponential operations provided by CUDA cores. This gap is dramatically amplified on NPU platforms. Therefore, only by obtaining the effective computational throughput and memory access overhead of each activation operator on the target deployment platform through actual measurements can the inference time estimate of the candidate target recognition model be accurately calculated. This ensures the speedup verification results are truly effective and allows the optimization scheme to produce real acceleration effects in actual deployment.
[0065] More specifically, in the process of calculating the estimated inference time, the single-element floating-point operation volume... The activation function in the convolution module is directly determined by its mathematical definition and is a pre-known static quantity. In this embodiment, the first activation function uses LeakyReLU, whose single-element floating-point computation is... FLOPs / element, the second activation function uses Mish, whose single-element floating-point computation is approximately equal to FLOPs / element, the third type of activation function uses Swish, whose single-element floating-point operation complexity is approximately equal to FLOPs / elements.
[0066] The effective computational throughput was obtained through offline single-operator benchmark testing. The calibration method was as follows: on the target edge hardware platform, multiple sets of feature tensors of different sizes were constructed for each activation function to perform single-operator testing. Hardware performance profiling tools were used to collect the measured total time of each activation operator. The measured total time was decoupled into pure computation time and memory access overhead. The effective computational throughput was obtained by dividing the total theoretical floating-point operation volume of each activation operator by the pure computation time.
[0067] The memory access overhead, along with the effective computational throughput, was obtained through offline single-operator benchmark testing. Specifically, the memory access overhead, including the time consumed by operator scheduling, DMA transfer, intermediate tensor read / write operations, etc., is obtained by subtracting the pure computation time from the total measured time.
[0068] Step S33: If the ratio of the estimated inference time to the total inference time of the baseline model does not meet the preset speedup constraint, increase the high-precision sensitivity threshold, and re-divide each convolutional module based on the low-precision sensitivity threshold and the increased high-precision sensitivity threshold.
[0069] Specifically, following the calculation method in step S32 above, the inference time of the baseline model is also calculated. Use the following formula to determine whether the speedup ratio constraint is met: ; in, For the preset acceleration ratio, this embodiment can take... This means that the inference time of the candidate target recognition model should not exceed approximately 76.9% of the inference time of the baseline model. If this condition is met, the current precision-sensitive level partitioning result and activation function allocation scheme are accepted; if not, it indicates that the current scheme has too many activation functions with high computational complexity, resulting in the total inference time failing to reach the target level, and the precision-sensitive level partitioning result needs to be adjusted.
[0070] At this point, the high-precision sensitivity threshold is increased. The value is increased to raise the entry threshold for high-precision sensitive layers, thereby degrading more convolutional modules from high-precision sensitive modules to medium-precision sensitive modules. In this embodiment, the current high-precision sensitivity threshold is increased by a preset step size. This yields a new high-precision sensitivity threshold. It should be noted that the increase in the high-precision sensitivity threshold should not be too large, otherwise a single adjustment may span the scoring intervals of too many modules, causing oscillations in the iteration process; nor should it be too small, otherwise the number of iterations will be too high, leading to low efficiency. In this embodiment, [the threshold is set to...]. Setting it to 0.05 can ensure convergence speed while avoiding over-adjustment.
[0071] Understandably, in this embodiment, the reason for adjusting only the high-precision sensitivity threshold and not the low-precision sensitivity threshold is that although increasing the low-precision sensitivity threshold will reclassify more convolutional modules that originally belonged to the medium-precision sensitive modules into the low-precision sensitive modules, which can further reduce inference time, it may lead to a loss of precision because these modules have certain requirements for the expressive power of activation functions. Therefore, this embodiment only adjusts the high-precision sensitivity threshold to reduce the number of high-complexity activation functions allocated, thereby improving the speedup ratio under the premise that the loss of precision is controllable.
[0072] Step S34: Based on the new partitioning results, set the activation function of each convolutional module and calculate the estimated inference time until the ratio of the estimated inference time to the total inference time of the baseline model meets the preset speedup constraint.
[0073] Specifically, based on the low-precision sensitivity threshold and the adjusted high-precision sensitivity threshold, step S31 is re-executed to perform precision-sensitive partitioning of each convolutional module and assign corresponding activation functions to obtain a new candidate target recognition model. For the new candidate target recognition model, the inference time estimate is recalculated and the speedup constraint is judged again. As the high-precision sensitivity threshold increases, the number of high-precision sensitive modules gradually decreases, the total inference time of the model gradually decreases, and the speedup gradually increases. When the high-precision sensitivity threshold increases to a certain value, the speedup meets the preset speedup requirement. When the iteration ends, the iteration is terminated.
[0074] If the speedup ratio still does not meet the constraint when the high-precision sensitivity threshold is increased to the preset upper limit, it means that under the current model structure and target hardware platform conditions, the target speedup ratio cannot be achieved by simply adjusting the activation function allocation. In this case, the current activation function allocation result can be taken as the best allocation result or a prompt can be made to adjust the preset speedup ratio constraint value.
[0075] Step S35: Based on the activation functions of each convolutional module that satisfy the preset speedup constraint, an initial optimized target recognition model is obtained.
[0076] Specifically, based on the activation functions of each convolutional module that satisfy the speedup constraint, an initial optimized target recognition model is obtained. Its structure is consistent with the baseline model, except that the activation functions of each convolutional module have been differentiated according to the hierarchical activation configuration scheme.
[0077] It should be noted that the activation function configuration of the initial optimized target recognition model has passed the speedup verification and meets the efficiency constraints on the edge hardware platform, but the weight parameters of the model are still the weight parameters of the baseline model.
[0078] Step S4: Fine-tuning the initial optimized target recognition model to obtain an optimized target recognition model includes: freezing the parameters of the low-precision sensitive modules in the initial optimized target recognition model, using a learning rate lower than that in the pre-training stage, and fine-tuning the initial optimized target recognition model until convergence to obtain an optimized target recognition model.
[0079] Specifically, since the output distribution and gradient characteristics of different activation functions differ, if the weights of the baseline model are directly used for the new activation function configuration, the input distribution of each layer of the model will shift, which may lead to a decrease in detection accuracy. Therefore, the initial optimized target recognition model is fine-tuned using the same dataset as in the pre-training stage, so that the weights of the initial optimized target recognition model are adapted to the new hierarchical activation function configuration.
[0080] During the fine-tuning process, the weight parameters of some convolutional modules in the initial optimized target recognition model are frozen. In this embodiment, the weight parameters of the low-precision sensitive modules are frozen because the computational characteristics of the first activation function LeakyReLU used by the low-precision sensitive modules are relatively similar to those of the initial activation function, and the feature extraction layer in which the low-precision sensitive modules are located is less sensitive to weight changes. Therefore, freezing the weights of these layers can reduce the number of parameters that need to be updated while ensuring the fine-tuning effect, accelerate fine-tuning convergence, and prevent overfitting under limited training data.
[0081] More specifically, the initial optimized target recognition model is fine-tuned using a learning rate lower than that used in the pre-training phase. In this embodiment, the initial learning rate in the fine-tuning phase can be set to one-tenth of that used in the pre-training phase. This is because the purpose of fine-tuning is to make small adjustments to the weights based on the baseline model, adapting the weights to the new activation function configuration, rather than retraining from scratch. A larger learning rate may cause drastic changes in the weights, destroying the feature representation capabilities already learned by the baseline model and thus reducing detection accuracy. The loss function used in the fine-tuning phase remains consistent with that used in the pre-training phase.
[0082] After fine-tuning, the initial optimized target recognition model is evaluated using a validation set to obtain its accuracy index. And it is required that: ;in, To account for the maximum allowable loss of accuracy, this embodiment takes... ,Right now .
[0083] If the above accuracy constraints are met, the fine-tuned initial optimized target recognition model is the optimized target recognition model. If the accuracy constraints are not met, it means that the current allocation of activation function has caused too much accuracy loss. It is necessary to increase the high-precision sensitivity threshold, re-divide the convolutional modules so that more convolutional modules are divided into high-precision sensitive modules, and assign a third activation function. Then, the inference time estimation and speedup verification are performed again, and fine-tuning training is performed again until the fine-tuned accuracy meets the above conditions.
[0084] Furthermore, the target recognition model optimization method further includes: performing inference evaluation on a validation set to obtain offline accuracy data; wherein, the offline accuracy data includes offline global accuracy indicators, offline classification accuracy indicators, and offline regional accuracy indicators.
[0085] Specifically, the offline global accuracy index is obtained by calculating mAP@0.5 to perform inference on the validation set using the optimized target recognition model.
[0086] The offline classification accuracy index is obtained by separately calculating the recall rate of each type of target in the validation set, which is used as the offline classification accuracy index for each category.
[0087] The offline region segmentation accuracy metric is the offline edge region accuracy metric. Specifically, the validation set image is divided into a central region and edge regions, and the average accuracy (AP) of each region is calculated as the accuracy metric; where the central region is the area in the center of the image. In this embodiment, r is set to 0.5; the edge region is the annular region surrounding the center region after deducting the entire map; when determining the region to which the target belongs, the determination is made based on the coordinates of the center point of the actual bounding box; the average accuracy AP of targets whose center point falls within the edge region is calculated.
[0088] It's important to note that the division between the central and edge regions corresponds to the differences in feature representation of the target at different locations in the image. Targets in edge regions are typically smaller, occluded, or truncated, requiring a higher degree of non-linearity in the activation function. When the accuracy of edge regions decreases, it indicates that the model's ability to represent the features of small or difficult targets in these regions is insufficient, necessitating an upgrade of the activation function in the low-precision sensitive module to enhance the extraction of underlying texture features.
[0089] Furthermore, the optimized target recognition model is deployed to an edge hardware platform to perform target recognition tasks, and inference accuracy feedback data and inference latency data are collected periodically; wherein, the inference accuracy feedback data includes global inference accuracy indicators, inference category accuracy indicators, and inference region accuracy indicators.
[0090] Specifically, there are differences in data distribution, scene changes, and target category distribution between the offline validation set and the deployment environment, which may cause the accuracy of the model in actual deployment to be inconsistent with the offline evaluation results. Therefore, the optimized target recognition model is deployed to the edge hardware platform, and its accuracy and latency are obtained for the target recognition task to determine whether the target recognition model needs to adjust the activation function.
[0091] More specifically, the global inference accuracy index is obtained by calculating the current model's mAP@0.5 on online data, which is used as the global inference accuracy index.
[0092] The reasoning classification accuracy index is obtained by calculating the detection recall rate of each target category.
[0093] The inference regional accuracy index is obtained, which is the average accuracy AP of the edge region of the statistical online data, and is used as the inference edge region accuracy index of the inference regional accuracy index.
[0094] The inference latency data includes the end-to-end inference latency of each frame and the average execution time of each activation operator; wherein, the end-to-end inference latency is used to determine whether the model as a whole meets the real-time requirements, and its calculation method is as follows: the application inference interface layer uses high-precision timestamps to record the complete time from the start of sending a single frame image into preprocessing, through inference operations, post-processing decoding until the output of the detection result.
[0095] The execution time of each activation operator is used to determine whether the execution time of the activation operator of a specific convolutional module exceeds the latency budget of that module. The calculation method is as follows: the inference performance profiler tool that comes with the edge hardware is used to collect data. After the operator performance collection is enabled, multiple frames of inference tasks are run to output the execution time of each layer operator. The activation operators of the corresponding network layer are selected and the average execution time under multiple inferences is calculated to obtain the execution time of each activation operator.
[0096] Furthermore, when the decrease in inference accuracy feedback data relative to the offline accuracy data exceeds a preset threshold, the activation functions of each convolutional module in the target recognition model are adjusted until the joint accuracy-efficiency constraint is met, including: When any item in the inference accuracy feedback data decreases more than the corresponding preset decrease threshold relative to the offline accuracy data, the activation functions of the medium-precision sensitive module and the low-precision sensitive module in the target recognition model are upgraded sequentially until the accuracy requirements are met.
[0097] Specifically, when any of the following accuracy conditions are met: the decrease in the inference global accuracy metric relative to the offline global accuracy metric exceeds a preset global accuracy decrease threshold; the decrease in the recall rate of any target category relative to the recall rate of the corresponding category in the offline classification recall exceeds a preset classification accuracy decrease threshold; and the decrease in the inference region accuracy metric relative to the offline region accuracy metric exceeds a preset region accuracy decrease threshold, the activation function of the convolution module is adjusted as follows: The overall accuracy sensitivity scores of each convolutional module in the accuracy-sensitive module are sorted in descending order. The activation functions of the top-ranked convolutional modules are upgraded from the second activation function to the third activation function. After each upgrade, the adjusted model is incrementally fine-tuned, and inference accuracy feedback data is collected again to determine whether the accuracy meets the requirements. It should be noted that the number of upgraded convolutional modules was obtained through experiments.
[0098] If the accuracy still does not meet the requirements, the activation function in the remaining convolutional modules in the medium-precision sensitive module will be upgraded from the second activation function to the third activation function, until all upgradable modules in the medium-precision sensitive module have been upgraded.
[0099] If the accuracy still does not meet the requirements, the same upgrade strategy as the accuracy-sensitive module is used to upgrade its activation function from the first activation function to the second activation function, until the accuracy requirement is met or all upgradeable modules have been upgraded.
[0100] In this embodiment, the global precision decline threshold is 0.3% of the offline global precision index, that is, whether the decline of the inference global precision index relative to the offline global precision index exceeds 0.3%; the classification precision decline threshold is 2% of the offline classification precision index, that is, whether the decline of the recall rate of any target category relative to the recall rate of the corresponding category in the offline classification recall exceeds 2%; and the regional precision decline threshold is 1.5% of the offline regional precision index, that is, whether the decline of the inference regional precision index relative to the offline regional precision index exceeds 1.5%.
[0101] Furthermore, after the precision adjustment is performed, if the inference delay index exceeds the preset delay threshold, the activation functions of the low-precision sensitive module and the medium-precision sensitive module in the target recognition model are downgraded in sequence, provided that the precision requirements are met, until the delay requirements are met or all downgradeable modules have been downgraded.
[0102] Specifically, after performing the above precision adjustment, the inference latency time is judged. If the inference latency index exceeds a preset total latency threshold, that is, the end-to-end inference latency of each frame exceeds a preset overall latency threshold or the execution time of any activation operator exceeds a preset execution time threshold of the activation operator, then the following adjustments are made: For the low-precision sensitive modules that were upgraded during the precision adjustment phase, the module with the lowest overall precision sensitivity score is downgraded, and its activation type is reduced back to the first activation function. After each downgrade, the inference latency is tested to determine whether the latency meets the requirements.
[0103] If the delay still does not meet the requirements, continue to downgrade the remaining low-precision sensitive modules with the lowest overall precision sensitivity score that were upgraded during the precision adjustment phase, until the delay requirements are met or all downgradeable modules in the low-precision sensitive modules have been downgraded.
[0104] If all degradable modules in the low-precision sensitive module have been degraded and the latency still does not meet the requirements, then, following the same principle as the low-precision sensitive module, several convolutional modules with the lowest overall precision sensitivity score in the medium-precision sensitive module will be degraded, and their activation type will be downgraded from the second activation function to the first activation function, until the latency requirement is met or all degradable modules have been degraded.
[0105] It should be noted that when accuracy requirements and latency requirements cannot be met simultaneously, the upgrade operation is performed first to meet the accuracy requirements. After the accuracy requirements are met, the downgrade operation is performed to reduce inference latency. However, the adjustment of inference latency must be carried out on the premise of ensuring accuracy.
[0106] Furthermore, after each upgrade or downgrade operation, lightweight fine-tuning training is performed, including: unfreezing the adjusted convolutional module and its adjacent convolutional modules, wherein the adjacent convolutional modules are one convolutional module before and after the adjusted convolutional module, and fine-tuning is performed using the most recently collected online data, with 10 to 20 training rounds for fine-tuning.
[0107] Repeat the above steps until the current model satisfies the preset accuracy-efficiency joint constraint condition; wherein the accuracy-efficiency joint constraint condition is: ; in, This indicates the accuracy metric of the current model; This represents the total inference latency of the current model; Indicates the total delay threshold; This represents the execution time of the i-th convolutional module; This represents the execution time threshold of the activation operator for the i-th convolutional module; This indicates that subsequent judgments are performed on each convolutional module.
[0108] If the changes in accuracy and delay are all less than the preset change threshold after three consecutive adjustments, convergence is determined, the adjustment is terminated, and the final optimized target recognition model is output.
[0109] In summary, the hierarchical activation selection target recognition model optimization method of this invention has the following beneficial effects: 1. In this embodiment of the invention, the accuracy sensitivity of each convolutional module of the target recognition model is evaluated layer by layer. Each convolutional module is divided into three levels: low-precision sensitive module, medium-precision sensitive module, and high-precision sensitive module. The first activation function, the second activation function, and the third activation function with increasing computational complexity are assigned to each of them. The activation function with low computational complexity is configured in the shallow module with little impact on accuracy, while the activation function with high computational complexity is configured in the deep module with a large impact on accuracy. This effectively reduces the overall computational cost of the model while ensuring detection accuracy.
[0110] 2. In this embodiment of the invention, two indicators are used: the accuracy loss after replacing the activation function module by module and the gradient contribution of the activation output of each module to the detection loss. After normalization, they are weighted and fused to obtain a comprehensive accuracy sensitivity score, which avoids the bias that may be caused by a single indicator evaluation and makes the hierarchical division results more accurate and reliable.
[0111] 3. In this embodiment of the invention, the actual computational efficiency of each activation operator on the edge hardware platform is incorporated into the activation function allocation decision. By constructing the activation operator efficiency calculation, the inference time estimate under the hierarchical activation configuration is calculated, and the allocation scheme is iteratively corrected with speedup ratio constraints to ensure that the optimization scheme produces a real acceleration effect in actual edge deployment.
[0112] 4. In this embodiment of the invention, the target recognition model is deployed to the edge hardware platform, and the inference accuracy feedback data and inference latency data of the edge hardware platform are collected periodically and compared with the offline accuracy data. When the accuracy decreases or the latency exceeds the standard, the activation function of each module is upgraded or downgraded, so that the model can continuously optimize the activation configuration according to the accuracy performance in the actual deployment environment.
[0113] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0114] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for optimizing a target recognition model using hierarchical activation selection, characterized in that, Includes the following steps: The activation functions of each convolutional module in the target recognition model to be optimized are uniformly set as the initial activation functions, and pre-training is performed to obtain the baseline model and baseline accuracy index. The initial activation functions in the baseline model are replaced by the first activation function, and inference evaluation is performed on the validation set. Based on the evaluation results and the baseline accuracy index, the comprehensive accuracy sensitivity score of each convolutional module is obtained. Based on the comprehensive accuracy sensitivity scores and the activation operator efficiency of the edge hardware platform, a matching activation function is assigned to each of the convolutional modules to obtain the initial optimized target recognition model; The initial optimized target recognition model is fine-tuned to obtain an optimized target recognition model.
2. The method according to claim 1, characterized in that, The obtained comprehensive accuracy sensitivity score for each convolutional module includes: Inference was performed on each target recognition model after the activation function was replaced using the validation set, and the accuracy index of each convolutional module was obtained. Based on the baseline accuracy index and the accuracy index corresponding to each convolutional module, the accuracy sensitivity value of each convolutional module is obtained. The validation set is used to perform forward propagation on the baseline model to obtain the loss value of the baseline model; Based on the loss value of the baseline model and the output feature map of each convolutional module, the gradient norm of each convolutional module is obtained. Based on the accuracy sensitivity value and the gradient norm, the comprehensive accuracy sensitivity score of each convolutional module is obtained.
3. The method according to claim 2, characterized in that, The accuracy sensitivity value is the difference between the baseline accuracy index and the accuracy index. The gradient norm of each convolutional module is obtained from the loss value of the baseline model and the output feature maps of each convolutional module of the baseline model, including: The gradient norm of each convolutional module in the baseline model is obtained using the following formula: ; in, This represents the gradient norm of the i-th convolutional module in the baseline model; This represents the loss value of the baseline model; This represents the output feature map of the i-th convolutional module of the baseline model; This represents the Frobenius norm.
4. The method according to any one of claims 2-3, characterized in that, The comprehensive accuracy sensitivity score for each convolutional module is obtained based on the accuracy sensitivity value and the gradient norm, including: The precision sensitivity values of each convolutional module are subjected to maximum and minimum normalization to obtain normalized precision sensitivity values. The gradient norm of each convolutional module is subjected to minimax normalization to obtain the normalized gradient norm. The normalized accuracy sensitivity value and the normalized gradient norm are weighted and summed to obtain the comprehensive accuracy sensitivity score of each convolution module.
5. The method according to claim 1, characterized in that, The method involves assigning matching activation functions to each convolutional module based on the comprehensive accuracy sensitivity scores and the activation operator efficiency of the edge hardware platform, thereby obtaining an initial optimized target recognition model, including: Based on the comprehensive accuracy sensitivity score, low accuracy sensitivity threshold and high accuracy sensitivity threshold, the convolutional modules are divided into accuracy-sensitive categories, and the activation function matching each convolutional module is set based on the division results to obtain the candidate target recognition model. Based on the efficiency of the activation operator, the inference time estimate of the candidate target recognition model is obtained; If the ratio of the estimated inference time to the total inference time of the baseline model does not meet the preset speedup constraint, the high-precision sensitivity threshold is increased, and each convolutional module is re-divided into precision-sensitive categories based on the low-precision sensitivity threshold and the increased high-precision sensitivity threshold. Based on the new partitioning results, the activation function of each convolutional module is set and the estimated inference time is calculated until the ratio of the estimated inference time to the total inference time of the baseline model meets the preset speedup constraint. An initial optimized target recognition model is obtained based on the activation functions of each convolutional module that satisfy the preset speedup constraint.
6. The method according to claim 5, characterized in that, The step of performing precision-sensitive partitioning of each convolutional module and setting activation functions matching each convolutional module based on the partitioning results includes: When the overall accuracy sensitivity score is less than or equal to the low accuracy sensitivity threshold, the convolution module is set as a low accuracy sensitive module, and the activation function in the convolution module is replaced with the first activation function; When the overall accuracy sensitivity score is greater than the low accuracy sensitivity threshold and less than or equal to the high accuracy sensitivity threshold, the convolution module is set as a medium accuracy sensitivity module, and the activation function in the convolution module is replaced with a second activation function. When the overall accuracy sensitivity score is greater than the high accuracy sensitivity threshold, the convolution module is set as a high accuracy sensitive module, and the activation function in the convolution module is replaced with a third activation function; wherein, the computational complexity of the first activation function is lower than that of the second activation function; and the computational complexity of the second activation function is lower than that of the third activation function.
7. The method according to claim 5, characterized in that, The inference time estimate of the candidate target recognition model is obtained using the following formula: ; ; Where N represents the number of convolutional modules; This represents the activation function used in the i-th convolutional module; This represents the inference time of the i-th convolutional module; This represents the single-element floating-point computation cost of the activation function used in the i-th convolutional module; , and These represent the height, width, and number of channels of the output feature map of the i-th convolutional module, respectively. This represents the effective computational throughput of the activation function used in the i-th convolutional module; This represents the memory access overhead of the activation function used in the i-th convolutional module.
8. The method according to claim 1, characterized in that, The step of fine-tuning the initial optimized target recognition model to obtain an optimized target recognition model includes: freezing the parameters of the low-precision sensitive modules in the initial optimized target recognition model, using a learning rate lower than that in the pre-training stage, and fine-tuning the initial optimized target recognition model until convergence to obtain an optimized target recognition model.
9. The method according to claim 1, characterized in that, Also includes: The optimized target recognition model is evaluated by inference on the validation set to obtain offline accuracy data; wherein, the offline accuracy data includes offline global accuracy index, offline classification accuracy index and offline regional accuracy index; The optimized target recognition model is deployed to an edge hardware platform to perform target recognition tasks, and inference accuracy feedback data and inference latency data are collected periodically; wherein, the inference accuracy feedback data includes global inference accuracy index, inference category accuracy index, and inference region accuracy index; When the decrease in the inference accuracy feedback data relative to the offline accuracy data exceeds a preset threshold, the activation functions of each convolutional module in the target recognition model are adjusted until the joint accuracy-efficiency constraint condition is met.
10. The method according to claim 9, characterized in that, When the decrease in inference accuracy feedback data relative to offline accuracy data exceeds a preset threshold, the activation functions of each convolutional module in the target recognition model are adjusted, including: When any item in the inference accuracy feedback data decreases more than the corresponding preset decrease threshold relative to the offline accuracy data, the activation functions of the medium-precision sensitive module and the low-precision sensitive module in the target recognition model are upgraded sequentially until the accuracy requirements are met. After the accuracy adjustment is performed, if the inference delay index exceeds the preset delay threshold, the activation functions of the low-precision sensitive module and the medium-precision sensitive module in the target recognition model are downgraded in sequence, provided that the accuracy requirements are met, until the delay requirements are met or all downgradeable modules have been downgraded.
