Cooperative deduction model pruning segmentation method and device for dynamic adaptation of transfer calculation resources
By using reinforcement learning models to perform dynamic pruning and segmentation of the recognition model between the drone and the edge server, the problem of deducing high time delay in traditional methods is solved, and more efficient recognition efficiency is achieved.
Patent Information
- Application Number
- CN202411432844.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-28
AI Technical Summary
The existing model pruning and segmentation methods cannot flexibly adjust the pruning and segmentation decision results based on the actual transmission resources and computing resources provided by the drone, resulting in a high deduction delay for identifying models in an emergency environment.
The reinforcement learning model is used to make pruning and segmentation decisions on the recognition model. By obtaining the transmission rate between edge and end nodes, edge and end node computing power ratio and preset minimum recognition accuracy, dynamically adapting the transfer resources to optimize the pruning and segmentation strategy.
By dynamically adapting computing resources, the pruning segmentation strategy is optimized, which reduces the deduction delay of the recognition model and improves the recognition efficiency in emergency environments.
Smart Images

Figure CN119539009A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a collaborative deduction model pruning and segmentation method and device for dynamic adaptation of computing resources. Background Art
[0002] At emergency rescue sites, it is often necessary to deploy drones to complete disaster situation awareness tasks. Combined with artificial intelligence (AI) technology, the efficiency of perception tasks can be effectively improved.
[0003] However, artificial intelligence technology often relies on complex deep neural network (DNN) models, which have extremely high computing resource overhead. Due to the limited payload of drones, they can only carry lightweight equipment, and the lightweight equipment has insufficient computing power, which usually makes it difficult to complete the calculation of complex DNN models in a timely manner. At the same time, emergency sites often lack public networks due to the retirement of infrastructure. The temporarily constructed private network links are unstable and have low transmission rates. The image data collected by drones in real time is also difficult to be quickly transmitted to the servers located in the rear for processing, and the traditional cloud computing architecture that relies on public network communication cannot be applied. In addition, different drone devices are heterogeneous, and drones in different application scenarios have differentiated transmission and computing resources, resulting in large differences in transmission and computing resources. Based on this, how to efficiently adapt and utilize limited transmission and computing resources to provide low-latency, highly reliable intelligent perception services has become a technical problem that needs to be solved urgently.
[0004] Traditional methods rely on pruning, distillation, quantization and other operations to compress the DNN model deployed on a single device, achieving model lightweighting. However, due to the computing power of a single device, the lightweight model still has a high deduction latency. Based on this, in some related technologies, an edge collaborative deduction framework is proposed, in which the low-computing power terminal device deployed on site and the high-computing power edge server deployed in the back jointly complete the model deduction: first, the DNN model is divided into two parts, and the deduction of the first part of the DNN model is completed on the terminal device (such as a drone), and then the intermediate results are transmitted to the edge server to continue to complete the deduction of the second part of the DNN model; in order to further improve the calculation speed of the model and reduce the deduction latency, the model can also be pruned on both sides of the edge. Under the edge collaborative deduction framework, how to prune and split the recognition model at the emergency support site has become a technical problem that needs to be solved.
[0005] In the prior art, a model specifically used for pruning and segmentation can be trained under the condition of a predetermined transmission rate and edge device computing power, and the existing recognition model can be pruned and segmented through the model.
[0006] However, the existing model pruning and segmentation methods cannot flexibly adjust the pruning and segmentation decision results according to the actual transmission resources and computing resources of the UAV, and are difficult to adapt to the complex emergency environment with heterogeneous UAV equipment and dynamically changing communication links. Therefore, the pruning and segmentation strategy generated by the model is not good, resulting in high deduction delay of the recognition model after pruning and segmentation. Summary of the invention
[0007] The present invention provides a collaborative deduction model pruning and segmentation method and device with dynamic adaptation of computing resources, which is used to solve the technical problem that the pruning and segmentation strategy of model generation in the existing technology is poor, resulting in high deduction delay of the recognition model after pruning and segmentation.
[0008] The present invention provides a collaborative deduction model pruning and segmentation method with dynamic adaptation of transmission and computing resources, including: obtaining the transmission rate between edge nodes, the edge node computing power ratio, and a preset minimum recognition accuracy, and loading a pre-trained recognition model; the transmission rate between edge nodes is the data transmission rate between a drone and an edge server, the edge node computing power ratio is the ratio of the deduction delay of the recognition model deployed on the drone to the deduction delay of the recognition model deployed on the edge server, and the preset minimum recognition accuracy is the minimum deduction accuracy of the recognition model set according to actual business needs; the transmission rate, the edge node computing power ratio and the preset minimum recognition accuracy are input into a pre-trained reinforcement learning model, a pruning and segmentation decision is made on the recognition model, and a pruning and segmentation decision result output by the reinforcement learning model is obtained.
[0009] According to a collaborative deduction model pruning and segmentation method with dynamic adaptation of computing resources provided by the present invention, the recognition model includes multiple convolutional layers, the pruning and segmentation decision results include the pruning rate of each convolutional layer of the recognition model, and the reinforcement learning model includes a Critic network and an Actor network; the Critic network is used to predict the cumulative reward ultimately obtained in the overall decision-making process; the cumulative reward is the reward calculated based on the deduction delay and deduction accuracy of the recognition model after executing the recognition model segmentation and pruning of each convolutional layer; the Actor network is used to decide the pruning rate of each convolutional layer of the recognition model.
[0010] According to a collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention, the critic network is trained using a first preset loss function; the first preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network, and Return is the cumulative reward of the reinforcement learning model.
[0011] According to a collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention, the Actor network is trained using a second preset loss function; the second preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network.
[0012] According to a collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention, the state of the decision-making process of the reinforcement learning model is: ; in, is the transmission rate, is the edge node computing power ratio, To preset the minimum recognition accuracy, The computational effort of each convolutional layer and the remaining layers of the recognition model in each decision-making process. is the number of channels of each convolutional layer of the recognition model in each decision process, To identify the amount of data transmitted for each optional segmentation position of the model, is the position of the pruned convolutional layer in each decision process, is the pruning rate of each convolutional layer of the recognition model.
[0013] According to a collaborative deduction model pruning and segmentation method with dynamic adaptation of computing resources provided by the present invention, the action of the reinforcement learning model includes identifying the pruning rate of each convolutional layer of the model.
[0014] According to a collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention, the reward of the reinforcement learning model is: ; in, For the deduction delay on the drone side, is the deduced delay on the edge server side, is the transmission delay, To identify the deduction accuracy of the model, is the preset minimum recognition accuracy, O is the segmentation point position set of the recognition model, To identify the current segmentation position of the model.
[0015] The present invention also provides a collaborative deduction model pruning and segmentation device with dynamic adaptation of transmission and computing resources, including: an acquisition module, used to obtain the transmission rate between edge nodes, the edge node computing power ratio, and a preset minimum recognition accuracy, and load a pre-trained recognition model; the transmission rate between edge nodes is the data transmission rate between the drone and the edge server, the edge node computing power ratio is the ratio of the deduction delay of the recognition model deployed on the drone to the deduction delay deployed on the edge server, and the preset minimum recognition accuracy is the minimum deduction accuracy of the recognition model set according to actual business needs; a decision module, used to input the transmission rate, the edge node computing power ratio and the preset minimum recognition accuracy into the pre-trained reinforcement learning model, perform pruning and segmentation decisions on the recognition model, and obtain the pruning and segmentation decision results output by the reinforcement learning model.
[0016] The collaborative deduction model pruning and segmentation method and device with dynamic adaptation of transmission and computing resources provided by the present invention uses a reinforcement learning model to make pruning and segmentation decisions on the recognition model according to the transmission rate between edge nodes, the computing power ratio of edge nodes, and the preset minimum recognition accuracy, and obtains the pruning and segmentation decision results. In the above manner, the transmission rate between edge nodes, the computing power ratio of edge nodes, and the minimum accuracy of the recognition model are comprehensively considered in the pruning and segmentation decision of the reinforcement learning model, so that the pruning and segmentation decision results finally generated can dynamically adapt to the transmission resources, computing resources, and accuracy requirements on both sides of the edge, optimize the pruning and segmentation strategy, and thus reduce the deduction delay of the recognition model after pruning and segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 It is a flow chart of the collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention.
[0019] Figure 2 It is a schematic diagram of an application scenario of the edge-end collaborative deduction framework provided by the present invention.
[0020] Figure 3 It is a structural schematic diagram of the reinforcement learning model provided by the present invention.
[0021] Figure 4 It is a structural diagram of the collaborative deduction model pruning and segmentation device for dynamic adaptation of computing resources provided by the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] See also Figure 1 , Figure 1 1 is a flow chart of the collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources provided by the present invention. In this embodiment, the collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources includes steps S110 to S120, and each step is specifically as follows: S110: Obtain the transmission rate between edge nodes, edge node computing power ratio, preset minimum recognition accuracy, and load the pre-trained recognition model.
[0024] The transmission rate between edge nodes is the data transmission rate between the drone and the edge server. The edge node computing power ratio is the ratio of the inference delay of the recognition model deployed on the drone to the inference delay deployed on the edge server. The preset minimum recognition accuracy is the minimum inference accuracy of the recognition model set according to actual business needs.
[0025] S120: Input the transmission rate, edge node computing power ratio and preset minimum recognition accuracy into the pre-trained reinforcement learning model, perform pruning and segmentation decisions on the recognition model, and obtain the pruning and segmentation decision results output by the reinforcement learning model.
[0026] See also Figure 2 , Figure 2 It is a schematic diagram of an application scenario of the edge-end collaborative deduction framework provided by the present invention.
[0027] like Figure 2As shown in the figure, at the emergency rescue site, drones need to be deployed for disaster awareness, and different drones have differentiated transmission resources and computing resources. The drone needs to complete the collection of disaster images on site and perform target recognition processing through pre-trained recognition models. However, due to the limited payload of the drone, the lightweight computing equipment it carries cannot complete the deduction task in time. Therefore, it is necessary to rely on the edge server with sufficient computing power deployed in the rear for auxiliary calculation. There is a wireless communication link between the drone and the edge server, so the image data is first collected by the drone, and part of the deduction is completed on the computing equipment carried by the drone, and then transmitted to the edge server through the wireless link to complete the subsequent deduction. In the above process, the drone is the terminal device in the edge-end collaborative deduction framework, that is, the end-side node, and the edge server is the edge-side node in the edge-end collaborative deduction framework. In order to realize edge-end collaborative deduction, it is necessary to use the model pruning method to lightweight the recognition model according to the differentiated transmission and computing resources of the drone, and select the segmentation position to split the recognition model into two parts, one of which is deployed on the drone and the other on the edge server.
[0028] When making pruning and segmentation decisions for drones, since the convolutional layers in the recognition model usually consume most of the computing power, the convolutional layers can be mainly considered when making pruning and segmentation decisions. Generally speaking, assuming that the recognition model has n convolutional layers, each convolutional layer can be used as a segmentation point, that is, there are n optional segmentation positions, then the optional segmentation point position set O can be defined as , the currently selected split position O, you need to specify the pruning rate of each convolutional layer in the recognition model separately, and define the pruning rate of the i-th convolutional layer as .
[0029] The computational latency is determined by the number of floating-point operations per second (FLOPs) required by the recognition model, the GPU parallel computing performance of the hardware platform, the storage read and write rate, and software framework optimization. The FLOPs of the i-th convolutional layer is defined as: ; in, is the size of the convolution kernel of the convolution layer, and is the output feature size of the convolutional layer, is the number of original input channels of the convolutional layer, is the number of input channels after model pruning, is the number of original output channels of the convolutional layer, is the number of output channels after model pruning.
[0030] Define the FLOPs of all fully connected layers as: ; in, is the number of input neurons in a single fully connected layer, is the number of output neurons of the fully connected layer. Therefore, the FLOPs of the end-side and side-side models corresponding to different segmentation positions can be defined as: ; ; Since the computing latency of the model is greatly affected by the GPU underlying architecture design and the optimization effect of the adopted deep learning framework, it is difficult to calculate the accurate computing latency. Therefore, the computing latency can be obtained through actual testing. In addition, considering that the computing power of the edge hardware device is fixed, the definition It is the ratio of the deduction delay of the same model deployed on the end to the deduction delay deployed on the edge, that is, the ratio of the deduction delay of the recognition model deployed on the drone to the deduction delay deployed on the edge server. Therefore, the deduction delay on both sides of the edge under different segmentation positions can be defined as: ; ; in, The deduction delay on the drone side, is the deduced delay on the edge server side, The latency actually measured on the edge server to identify the model.
[0031] The transmission delay is determined by the size of the intermediate result data and the transmission rate of the communication link. The size of the intermediate result data at different split positions is defined as: ; in, and is the output feature size of the convolutional layer before the split point, is the number of original output channels of the convolutional layer before the split point, = is the number of output channels after model pruning. Due to the height advantage of UAVs, line-of-sight communication is considered between UAVs and between UAVs and ground equipment, and the channel gain can be defined as , then the transmission rate between edge nodes is defined as: ; in, is the bandwidth, is the transmission power, is the noise power density. The transmission delay can be defined as: .
[0032] When the deployment location of the drone is fixed, there is no need to adjust the transmission bandwidth and power between the drone and the edge server, so the transmission rate is a fixed value, and the transmission delay is mainly determined by the size of the intermediate result data, that is, the data size output by the convolutional network before the segmentation point of the recognition model.
[0033] In this embodiment, it is necessary to minimize the edge collaborative deduction delay while satisfying the accuracy constraint of the recognition model. Since the deduction result of the recognition model is only the classification label, the delay of transmitting the recognition result after the deduction is completed can be ignored. Based on this, the optimization problem of the recognition model can be written as: ; ; in, is the collaborative deduction accuracy of the model, that is, the deduction accuracy of the identification model; It is the minimum deduction accuracy of the recognition model set according to actual business needs. Considering that when the pruning strategy of the recognition model is given, the optimal segmentation position of the recognition model under the collaborative deduction framework can be obtained by traversal, that is, measuring the collaborative deduction delay under different segmentation positions respectively, and selecting the segmentation position with the minimum delay. Therefore, the optimization problem can be modified as follows: ; .
[0034] In order to solve the above optimization problem, this embodiment uses a reinforcement learning model to make pruning and segmentation decisions on the pre-trained recognition model to minimize the deduction delay of the recognition model after pruning and segmentation.
[0035] Specifically, first obtain the transmission rate between edge nodes, the edge node computing power ratio, and the preset minimum recognition accuracy, and load the pre-trained recognition model; input the transmission rate, the edge node computing power ratio, and the preset minimum recognition accuracy into the pre-trained reinforcement learning model, and the reinforcement learning model makes pruning and segmentation decisions on the recognition model based on the input data, and generates and outputs the final pruning and segmentation decision results.
[0036] The collaborative deduction model pruning and segmentation method with dynamic adaptation of transmission and computing resources provided in this embodiment uses a reinforcement learning model to make pruning and segmentation decisions on the recognition model according to the transmission rate between edge nodes, the computing power ratio of edge nodes, and the preset minimum recognition accuracy, and obtains a pruning and segmentation decision result. In the above manner, the transmission rate between edge nodes, the computing power ratio of edge nodes, and the minimum accuracy of the recognition model are comprehensively considered in the pruning and segmentation decision of the reinforcement learning model, so that the pruning and segmentation decision result finally generated can dynamically adapt to the transmission resources, computing resources, and accuracy requirements on both sides of the edge, optimize the pruning and segmentation strategy, and thus reduce the deduction delay of the recognition model after pruning and segmentation.
[0037] In some embodiments, the recognition model includes multiple convolutional layers, the pruning and segmentation decision results include the pruning rate of each convolutional layer of the recognition model, and the reinforcement learning model includes a Critic network and an Actor network; the Critic network is used to predict the cumulative reward finally obtained by the overall decision-making process; the cumulative reward is the reward calculated based on the inference delay and inference accuracy of the recognition model after executing the recognition model segmentation and pruning of each convolutional layer; the Actor network is used to decide the pruning rate of each convolutional layer of the recognition model.
[0038] Since the reinforcement learning model needs to decide the pruning rate of each convolutional layer and prune it in sequence according to the order of the convolutional layers in the recognition model, each decision step only needs to be made based on the state of the current recognition model and environmental information. Therefore, the decision process has the Markov property, and the pruning rate decision process can be defined as a Markov decision process. Among them, the state is the state of the current recognition model itself and environmental information such as the transmission rate, computing power, and accuracy requirements between edge nodes; the action is the pruning rate of the convolutional layer; its state transition is deterministic; the calculation of rewards requires further consideration of the model's segmentation decision. After completing a round of model pruning decisions, it is necessary to segment the pruned recognition model at each optional segmentation position, test the collaborative deduction delay, select the segmentation position that achieves the lowest deduction delay as the segmentation decision result, and then calculate the reward of this round of pruning decision process. The reward is determined by the collaborative deduction delay and accuracy.
[0039] The elements of the Markov decision process include state, action, strategy and reward. In this embodiment, the state of the reinforcement learning model in the decision process can be described by 8 features. The state of the decision process of the reinforcement learning model can be defined as: ; in, is the transmission rate, is the edge node computing power ratio, To preset the minimum recognition accuracy, , , In the training process of the reinforcement learning model, it can be randomly given within a certain range to ensure that the trained reinforcement learning model can adapt to different application scenarios, but it needs to be given in the single segmentation and pruning decision process. In addition, for After the model is pruned, fine-tuning training is usually required to restore the accuracy. However, fine-tuning training takes a long time and seriously increases the training time of the reinforcement learning model. Therefore, the accuracy used in the training process of the reinforcement learning model is the accuracy of the recognition model after pruning without fine-tuning training. Identify the computational effort of each convolutional layer and the remaining layers of the model in each decision-making process; Identify the number of channels in each convolutional layer of the model for each decision-making process; To identify the size of the amount of data transmitted corresponding to each optional segmentation position of the model; is the position of the pruned convolutional layer in each decision process, The length of the array corresponds to the number of network layers. The value of the position of the pruned network layer is 1, and the rest of the values are 0; is the pruning rate of each convolutional layer of the recognition model.
[0040] The Markov decision process requires an output action , that is, the decision result needs to be output; in this embodiment, the reinforcement learning model needs to output the pruning rate of each convolutional layer of the recognition model , as the pruning segmentation decision result, thus completing the pruning decision.
[0041] Since the collaborative deduction of the model requires the completion of pruning and segmentation decisions at the same time, but the reinforcement learning model can only output a single action to complete the pruning decision, the segmentation decision problem needs to be taken into account in the design of the reward, and the reinforcement learning model is encouraged to achieve the lowest collaborative deduction delay under multiple optional segmentation positions. Therefore, after completing the pruning of the recognition model, it is necessary to test the collaborative deduction delay corresponding to different optional segmentation positions separately and complete the reward calculation. Among them, considering that the deduction accuracy and deduction delay of the recognition model need to be obtained by completing the test of the validation set in the training data, the time overhead is relatively large. Therefore, the deduction accuracy and deduction delay of the model are not measured in a single decision-making process, and the reward for each decision step during this period is set to 0. After the last decision step is completed, the deduction accuracy and deduction delay of the recognition model are measured again, and the reward of the reinforcement learning model is defined as: ; in, The deduction delay on the drone side, is the deduced delay on the edge server side, is the transmission delay, To identify the deduction accuracy of the model, is the preset minimum recognition accuracy, O is the segmentation point position set of the recognition model, To identify the current segmentation position of the model.
[0042] In addition, similar to the existing hierarchical reinforcement learning model, on the one hand, the accuracy reward can be added to the reward of the reinforcement learning model, and the reward obtained can be increased when the deduction accuracy is close to the target accuracy. A higher pruning rate can bring lower computing latency and transmission latency to a certain extent. Therefore, in order to obtain a lower collaborative deduction latency, the reinforcement learning model should be encouraged to adopt a larger pruning rate so that the deduction accuracy is close to but not lower than the set , when the deduction accuracy is close to When At this time, Provide additional rewards on the basis of .
[0043] Where a is a constant; is a preset threshold, preferably, is 0.1.
[0044] However, the additional rewards for accuracy may cause the reinforcement learning model to be more inclined to obtain higher rewards around accuracy. Therefore, on the other hand, the delay reward is increased, and the collaborative deduction delay and the pure end and pure edge deduction delay of the model are measured at the same time. When the collaborative deduction delay is lower than the pure end and pure edge deduction delay, it will be Provide additional rewards on the basis of ,in is a constant. Through the above method, the reinforcement learning model can be encouraged to more reasonably allocate the pruning rate of each convolutional layer of the recognition model: (1) When the pure end-to-end inference delay of the recognition model is lower than the pure edge-to-edge inference delay, that is, the collaborative inference delay of the recognition model should be lower than the pure end-to-end inference delay, the reinforcement learning model is encouraged to use a higher pruning rate in a single convolutional layer to ensure that a smaller intermediate result can be obtained during segmentation, so that the transmission delay is lower than the inference delay of the edge model on the end; (2) When the pure edge-to-edge inference delay of the recognition model is lower than the pure end-to-end inference delay, that is, the collaborative inference delay of the recognition model is required to be lower than the transmission delay of the image data and the computing delay on the edge server, the reinforcement learning model is encouraged to weigh the size of the end-side model inference delay and the intermediate result transmission delay, and more reasonably allocate the pruning rate adopted by the end-side and edge-side convolutional layers.
[0045] See also Figure 3 , Figure 3 It is a structural schematic diagram of the reinforcement learning model provided by the present invention.
[0046] like Figure 3As shown in the figure, the reinforcement learning model adopts the Actor-Critic architecture, which includes a Critic network and an Actor network; the Critic network is used to predict the cumulative reward obtained in the overall decision-making process; the cumulative reward is the reward calculated based on the inference delay and inference accuracy of the recognition model after the recognition model segmentation and each convolutional layer pruning are completed; the Actor network is used to determine the pruning rate of each convolutional layer of the decision recognition model.
[0047] In some embodiments, the critic network is trained using a first preset loss function; the first preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network, and Return is the cumulative reward of the reinforcement learning model.
[0048] Specifically, the Critic network is responsible for predicting the cumulative reward obtained in the overall decision-making process, that is, the reward calculated based on the inference delay and inference accuracy of the recognition model after performing the recognition model segmentation and pruning of each convolutional layer. In order to make the prediction results of the Critic network more and more accurate, the loss function of the Critic network during training is defined as: .
[0049] In some embodiments, the Actor network is trained using a second preset loss function; the second preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network.
[0050] Specifically, the Actor network is responsible for deciding the pruning rate of each convolutional network layer of the recognition model. After the Actor network completes the pruning rate decision, all optional segmentation positions of the model will be tested to find the optimal segmentation position. In order to make the decision results of the Actor network better and better, that is, to make the decision effect of the Critic network on the segmentation position higher and higher, the loss function of the Actor network during training can be defined as: .
[0051] In some embodiments, the states of the decision-making process of the reinforcement learning model are: ; in, is the transmission rate, is the edge node computing power ratio, To preset the minimum recognition accuracy, The computational effort of each convolutional layer and the remaining layers of the recognition model in each decision-making process. is the number of channels of each convolutional layer of the recognition model in each decision process, To identify the amount of data transmitted for each optional segmentation position of the model, is the position of the pruned convolutional layer in each decision process, is the pruning rate of each convolutional layer of the recognition model.
[0052] In some embodiments, the actions of the reinforcement learning model include identifying a pruning rate for each convolutional layer of the model.
[0053] In some embodiments, the reward of the reinforcement learning model is: ; in, The deduction delay on the drone side, is the deduced delay on the edge server side, is the transmission delay, To identify the deduction accuracy of the model, is the preset minimum recognition accuracy, O is the segmentation point position set of the recognition model, To identify the current segmentation position of the model.
[0054] Specifically, the training process of the reinforcement learning model is as follows: (1) Initialize the parameters of the Critic network and the Actor network.
[0055] (2) Execute in each iteration step: (2.1) Random Input , and .
[0056] (2.2) Load the pre-trained recognition model.
[0057] (2.3) In each convolutional layer, the state is obtained , and the pruning rate of each layer of the convolutional network of the recognition model is determined based on the Actor network decision.
[0058] (2.4) Segment the recognition model, measure the delay and accuracy of each optional segmentation point, and select the optimal segmentation position.
[0059] (2.5) Calculation .
[0060] (2.6) Calculation To update the Critic network.
[0061] (2.7) Calculation to update the Actor network.
[0062] (3) Training is completed.
[0063] Specifically, the specific deduction process of the reinforcement learning model is as follows: (1) Input , and .
[0064] (2) Load the Actor network training parameters.
[0065] (3) Load the pre-trained recognition model.
[0066] (4) For each convolutional layer, obtain the state , and the pruning rate of each layer of the convolutional network of the recognition model is determined based on the Actor network decision.
[0067] (5) Prune the segmentation recognition model and measure the latency and accuracy of each optional segmentation point.
[0068] (6) Select the optimal split position.
[0069] (7) Pruning rate of each convolutional layer of the output recognition model .
[0070] It should be noted that during the training process of the reinforcement learning model, since there is a large time overhead in measuring the inference accuracy and inference delay of the recognition model, the model will not be pruned and the delay and accuracy will not be measured immediately after each pruning rate decision is completed. Only after the pruning of all convolutional layers of the model is completed, the delay and accuracy will be measured and the reward of this decision-making process will be calculated.
[0071] The collaborative deduction model pruning and segmentation method for dynamic adaptation of transmission computing resources provided in this embodiment has at least the following advantages compared with the prior art: (1) This embodiment defines the coupled decision problem of model pruning and model segmentation as a single model pruning problem under the collaborative deduction framework, and integrates the segmentation strategy into the reward design of the decision problem, thereby reducing the training difficulty of the decision model and obtaining better decision results; (2) This embodiment introduces a reinforcement learning algorithm to solve the model pruning problem under the collaborative deduction framework of the recognition model, models the collaborative deduction problem and designs the states, actions and rewards in the reinforcement learning algorithm, thereby realizing the coupled optimization of the pruning and segmentation strategies that adapt to dynamic transmission computing resources and accuracy requirements.
[0072] In order to verify the effectiveness of the technical solution proposed in this application, the existing adaptive model pruning and segmentation coupling decision method based on the hierarchical reinforcement learning model can be extended to the dynamic transmission computing resource scenario, and the present application and this method can be compared with each other to analyze the performance of the technical solution of this application.
[0073] The recognition model used in the comparative experiment was implemented using the PaddlePaddle framework. The server used to test the recognition model's deduction accuracy and delay was configured with an 11GB RTX 2080 Ti graphics card and a 2.5GHz Intel Xeon Platinum 8255C CPU. The Critic network and Actor network used in the reinforcement learning model are both composed of two hidden layers with 300 nodes each. The learning rate of the Critic network is 1e-3, and the learning rate of the Actor network is 1e-4. The parameters used for soft updating of the reinforcement learning model are 0.01, the batch size is 128, and the size is Priority experience replay library. The samples adopt each optional split position in turn and use a random pruning rate to complete pruning. The subsequent samples adopt the split position with the highest expected return and output the pruning rate according to the initial noise coefficient of 0.9 and the attenuation coefficient of 0.995 to complete pruning.
[0074] (1) Comparative experiment 1
[0075] The recognition models used in the test are VGG16 and ResNet34. The transmission rate between edge nodes is set to 1280KB / s, and the edge node computing power ratio is set to 20. The inference accuracy and inference latency test of the recognition model after pruning and segmentation are completed on the Cifar10 dataset with an image size of 320×320×3. This comparative experiment uses the L1-norm model as a comparison. The comparative experimental results are shown in Table 1.
[0076] Table 1
[0077] As shown in Table 1, in order to verify the technical effect of the technical solution of the present application, the present application is compared with the traditional pruning algorithm based on the L1-norm model for single-point deduction. Under the condition of the same accuracy after fine-tuning, the edge-end collaborative deduction delay of the technical solution of the present application and the delay of completing the deduction on the end or transmitting the original data to the edge after the recognition model pruned based on the L1-norm model are tested. In experiments for different recognition models, under the same accuracy conditions, the technical solution of the present application has achieved the lowest deduction delay, and the deduction delay can be reduced by up to 39%.
[0078] (2) Comparative experiment 2
[0079] The recognition models used in the test are VGG16 and ResNet34. The transmission rate between edge nodes is set to 1280KB / s, and the edge node computing power ratio is set to 20. The deduction accuracy and deduction delay test of the recognition model after pruning and segmentation are completed on the Cifar10 dataset with an image size of 320×320×3. This comparative experiment uses a hierarchical reinforcement learning model as a comparison. The comparative experimental results are shown in Table 2.
[0080] Table 2
[0081] As shown in Table 2, a comparative experiment was also conducted between the present application and the proposed pruning and segmentation method based on the hierarchical reinforcement learning model. In the experiment for the VGG16 recognition model with a relatively simple model structure, under the same accuracy conditions, the inference delay of the technical solution of the present application is the same as the inference delay of the hierarchical reinforcement learning method; however, in the experiment for the ResNet34 recognition model with a more complex model structure, under the same accuracy conditions, the inference delay of the technical solution of the present application can be reduced by 28%.
[0082] It can be seen from this that the technical solution of the present application can reduce the collaborative deduction delay of the recognition model while maintaining the high accuracy of the recognition model.
[0083] The present invention also provides a collaborative deduction model pruning and segmentation device with dynamic adaptation of computing resources. Figure 4 , Figure 4 4 is a schematic diagram of the structure of the collaborative deduction model pruning and segmentation device for dynamic adaptation of computing resources provided by the present invention. In this embodiment, the collaborative deduction model pruning and segmentation device for dynamic adaptation of computing resources includes an acquisition module 410 and a decision module 420.
[0084] The acquisition module 410 is used to obtain the transmission rate between edge nodes, the edge node computing power ratio, the preset minimum recognition accuracy, and load the pre-trained recognition model.
[0085] The transmission rate between edge nodes is the data transmission rate between the drone and the edge server. The edge node computing power ratio is the ratio of the inference delay of the recognition model deployed on the drone to the inference delay deployed on the edge server. The preset minimum recognition accuracy is the minimum inference accuracy of the recognition model set according to actual business needs.
[0086] The decision module 420 is used to input the transmission rate, edge node computing power ratio and preset minimum recognition accuracy into the pre-trained reinforcement learning model, perform pruning and segmentation decisions on the recognition model, and obtain the pruning and segmentation decision results output by the reinforcement learning model.
[0087] In some embodiments, the recognition model includes multiple convolutional layers, the pruning and segmentation decision results include the pruning rate of each convolutional layer of the recognition model, and the reinforcement learning model includes a Critic network and an Actor network; the Critic network is used to predict the cumulative reward finally obtained by the overall decision-making process; the cumulative reward is the reward calculated based on the inference delay and inference accuracy of the recognition model after executing the recognition model segmentation and pruning of each convolutional layer; the Actor network is used to decide the pruning rate of each convolutional layer of the recognition model.
[0088] In some embodiments, the critic network is trained using a first preset loss function; the first preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network, and Return is the cumulative reward of the reinforcement learning model.
[0089] In some embodiments, the Actor network is trained using a second preset loss function; the second preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network.
[0090] In some embodiments, the states of the decision-making process of the reinforcement learning model are: ; in, is the transmission rate, is the edge node computing power ratio, To preset the minimum recognition accuracy, The computational effort of each convolutional layer and the remaining layers of the recognition model in each decision-making process. is the number of channels of each convolutional layer of the recognition model in each decision process, To identify the amount of data transmitted for each optional segmentation position of the model, is the position of the pruned convolutional layer in each decision process, is the pruning rate of each convolutional layer of the recognition model.
[0091] In some embodiments, the actions of the reinforcement learning model include identifying a pruning rate for each convolutional layer of the model.
[0092] In some embodiments, the reward of the reinforcement learning model is: ; in, For the deduction delay on the drone side, is the deduced delay on the edge server side, is the transmission delay, To identify the deduction accuracy of the model, is the preset minimum recognition accuracy, O is the segmentation point position set of the recognition model, To identify the current segmentation position of the model.
[0093] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0094] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources, characterized in that: include: Obtain the transmission rate between edge nodes, edge node computing power ratio, and preset minimum recognition accuracy, and load the pre-trained recognition model; the transmission rate between edge nodes is the data transmission rate between the drone and the edge server, the edge node computing power ratio is the ratio of the deduction delay of the recognition model deployed on the drone to the deduction delay deployed on the edge server, and the preset minimum recognition accuracy is the minimum deduction accuracy of the recognition model set according to actual business needs; The transmission rate, the edge node computing power ratio and the preset minimum recognition accuracy are input into a pre-trained reinforcement learning model, and a pruning and segmentation decision is performed on the recognition model to obtain a pruning and segmentation decision result output by the reinforcement learning model.
2. According to claim 1, the collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources is characterized in that: The recognition model includes a plurality of convolutional layers, the pruning and segmentation decision result includes a pruning rate of each convolutional layer of the recognition model, and the reinforcement learning model includes a Critic network and an Actor network; The Critic network is used to predict the cumulative reward ultimately obtained in the overall decision-making process; the cumulative reward is the reward calculated based on the deduction delay and deduction accuracy of the recognition model after executing the recognition model segmentation and each convolutional layer pruning; The Actor network is used to determine the pruning rate of each convolutional layer of the recognition model.
3. The collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources according to claim 2 is characterized in that: The Critic network is trained using a first preset loss function; The first preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network, and Return is the cumulative reward of the reinforcement learning model.
4. The collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources according to claim 2 is characterized in that: The Actor network is trained using a second preset loss function; The second preset loss function is: ; Where T is the total number of samples, t is the current sample, is the output result of the Critic network.
5. The collaborative deduction type pruning and segmentation method for dynamic adaptation of computing resources according to claim 1 is characterized in that: The states of the decision-making process of the reinforcement learning model are: ; in, is the transmission rate, is the computing power ratio of the edge nodes, is the preset minimum recognition accuracy, is the computational effort of each convolutional layer and the remaining layers of the recognition model in each decision-making process, is the number of channels of each convolutional layer of the recognition model in each decision-making process, The amount of transmitted data corresponding to each optional segmentation position of the recognition model, is the position of the pruned convolutional layer in each decision process, is the pruning rate of each convolutional layer of the recognition model.
6. The collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources according to claim 1 is characterized in that: The actions of the reinforcement learning model include the pruning rate of each convolutional layer of the recognition model.
7. The collaborative deduction model pruning and segmentation method for dynamic adaptation of computing resources according to claim 1 is characterized in that: The reward of the reinforcement learning model is: ; in, For the deduction delay on the drone side, is the deduced delay on the edge server side, is the transmission delay, is the deduction accuracy of the recognition model, is the preset minimum recognition accuracy, O is the segmentation point position set of the recognition model, is the current segmentation position of the recognition model.
8. A collaborative deduction model pruning and segmentation device with dynamic adaptation of computing resources, characterized in that: include: An acquisition module is used to acquire the transmission rate between edge nodes, the edge node computing power ratio, the preset minimum recognition accuracy, and load a pre-trained recognition model; the transmission rate between edge nodes is the data transmission rate between the drone and the edge server, the edge node computing power ratio is the ratio of the deduction delay of the recognition model deployed on the drone to the deduction delay deployed on the edge server, and the preset minimum recognition accuracy is the minimum deduction accuracy of the recognition model set according to actual business needs; A decision module is used to input the transmission rate, the edge node computing power ratio and the preset minimum recognition accuracy into a pre-trained reinforcement learning model, perform pruning and segmentation decisions on the recognition model, and obtain the pruning and segmentation decision results output by the reinforcement learning model.