Automated convolutional neural network quantization pruning method, device and storage medium based on reinforcement learning

Through reinforcement learning, the automated convolutional neural network quantization and pruning method solves the problem of deploying neural networks on mobile devices, achieves efficient and accurate model compression on low-cost devices, reduces the number of parameters and floating-point calculations, and is suitable for edge devices with limited computing resources.

CN115600650BActive Publication Date: 2025-09-26HUAQIAO UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211363959.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-02
Publication Date
2025-09-26
Estimated Expiration
2042-11-02

AI Technical Summary

Technical Problem

Existing neural network models are difficult to deploy efficiently on mobile devices with limited computing resources, and existing quantization and pruning methods require manual parameter adjustment, which is complex and prone to suboptimal results.

Method used

An automated convolutional neural network quantization and pruning method based on reinforcement learning is adopted. Through the actor-critic network and DDPG deep deterministic policy reinforcement learning, the quantization and pruning process are automatically optimized, and the global importance and average rank sorting of the filter are combined to achieve model compression.

Benefits of technology

With a small range of accuracy loss, the model's parameter count and floating-point calculation amount are significantly reduced. It is suitable for mobile edge devices with weak computing power, reducing device costs and maintaining high model accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115600650B_ABST
    Figure CN115600650B_ABST
Patent Text Reader

Abstract

The present invention is based on an automated convolutional neural network quantization and pruning method for reinforcement learning. First, an image data set is obtained, and the image is pre-trained using an initialized model to obtain the average rank of the feature map output by each filter. The average rank is combined with the global importance of the filter to sort the filter importance information; the automated neural network model quantization and pruning operation is implemented through reinforcement learning to obtain a neural network model compression strategy with the highest model accuracy, and the final neural network model after pruning is obtained. The present invention globally sorts the filters in the convolution layer according to their importance to the model accuracy and in combination with the average rank size. The size of the rank is consistent with the importance of the filter. At the same time, a higher number of bits is allocated to the weight parameters of the filters with high importance, thereby achieving maximum accuracy retention. The neural network used on high-performance computers can be compressed and deployed on mobile edge devices with weak computing and storage capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing, and in particular relates to an automated convolutional neural network quantization pruning method, device and storage medium based on reinforcement learning. Background Art

[0002] In recent years, research on deeper neural networks has yielded increasingly effective models. Meanwhile, with the continuous development and innovation in related fields such as autonomous driving and smart mobile devices, the demand for deep neural network models suitable for edge devices with limited computing power has also been increasing. Due to the characteristics of deep neural networks, deploying them on mobile devices requires an extremely large number of parameters and floating-point operations. For example, a 152-layer ResNet has over 60 million parameters and requires over 10 billion floating-point operations to infer a 224×224 resolution image. This makes it difficult to run on platforms with limited computing resources, such as mobile devices, wearable portable devices, and IoT devices. Furthermore, running deep neural network models for real-time object detection on GPUs is expensive. For example, YOLO v3 running on an NVIDIA Tesla T4 can detect 40 frames per second in real time, but this device costs nearly 30,000 yuan, far beyond the reach of the general public. Existing neural network models struggle to achieve both model accuracy and computational speed on low-cost devices.

[0003] As neural network deployments grow, their high reliance on precision is shifting to a focus on minimizing storage usage and floating-point computations while maintaining or maintaining acceptable accuracy. Reinforcement learning, as a method for automatically guiding neural network learning through agents, is undoubtedly a promising tool. Existing neural network quantization and pruning methods generally require human experts to continuously adjust parameters to achieve optimal compression. This creates an exponentially large hyperparameter space, making the operation difficult and time-consuming. In practice, these methods are prone to local optima or suboptimal performance. Existing model pruning methods focus on pruning weights within the model. These fine-grained pruning methods require specialized hardware support and suffer from poor generalization. Furthermore, most quantization and pruning strategies are rule-based heuristics, which can lead to suboptimal compression. Summary of the Invention

[0004] The purpose of the present invention is to provide an automated convolutional neural network quantization pruning method, device and storage medium based on reinforcement learning. Under the premise of a small range of accuracy loss, the parameter bit width, parameter quantity and floating-point calculation amount of the model are reduced through the process of automated quantization pruning. The neural network originally used on high-performance computers can be compressed and deployed on mobile edge devices with weak computing and storage capabilities.

[0005] The present invention provides an automated convolutional neural network quantization pruning method based on reinforcement learning, comprising the following steps:

[0006] Step S10: Obtain an image dataset and divide the dataset into a training set and a validation set in proportion;

[0007] Step S20: Obtain a convolutional neural network model to be quantized and pruned and perform initialization. Use the initialized model to perform 60 rounds of pre-training on the images in the training set to obtain the average rank of the feature map output by each filter. Combine the average rank of the feature map output by each filter in the convolutional layer of the current model with the global importance ranking of the filter to obtain filter importance information.

[0008] Step S30: Automated neural network model quantization and pruning operations are implemented through reinforcement learning to obtain a neural network model compression strategy with the highest model accuracy. The reinforcement learning agent is an actor-critic network, where the actor network consists of actor networks A and B, and the critic network is responsible for evaluating the model compression strategy. The parameter update method of the actor network and the critic network is the DDPG deep deterministic policy reinforcement learning method.

[0009] Step S40: Perform a fine-tuning operation on the neural network model after the quantization pruning is completed to obtain the final neural network model after the pruning is completed.

[0010] The step S20 is specifically as follows:

[0011] Step S21: Create a convolutional neural network model to be quantized and pruned based on the Pytorch framework;

[0012] Step S22: setting pre-training parameters and establishing a layer structure index corresponding to the convolutional neural network model;

[0013] Step S23: Perform 60 rounds of pre-training on the images in the training set to obtain the current model accuracy, which is obtained by testing different images in the validation set;

[0014] Step S24: obtain the rank of each filter output feature map in the convolutional layer, divide the sum of the ranks of all filter output feature maps by the number of filters in the convolutional layer, and obtain the average rank of the convolutional layer; sort the filters based on their global importance, and use the sorting results as the basis for discriminating the importance of the filters;

[0015] The filter importance information is obtained by combining the average rank of the output feature map of each filter in the convolutional layer of the current model with the global importance ranking of the filter.

[0016] The filter importance information in step S24 refers to the filter in each convolutional layer using the average importance of the current layer filter as a threshold. Filters greater than this value are important filters, otherwise they are unimportant filters. All convolutional layers are sorted according to the average importance of their filters. The convolutional layer with the preset value before sorting is the sensitive layer, and it is stored in the sensitive layer index of the corresponding convolutional neural network model.

[0017] The step S30 is specifically as follows:

[0018] Step S31: Obtain the target quantization rate and pruning rate set in the hyperparameters, determine the number of filters to be pruned based on the target pruning rate, and measure the number of bits of the retained filter parameters based on the quantization rate;

[0019] Step S32: According to the deterministic strategy of reinforcement learning, if the current layer is in the sensitive layer index, the quantization bit number of the current layer of the deterministic output of reinforcement learning is set to 8 bits, the compression rate is set to 0.1, the number of filters that should be pruned in the current layer of the model is obtained, and the number of filters remaining to be pruned is calculated;

[0020] Step S33: sort the filters in the layer from low to high by calculating the average rank of the filters and combining the global importance of the filters;

[0021] Step S34: Based on the number of filters required to be pruned for each convolutional layer obtained in step S31 above, actor network A makes different filter pruning strategies based on whether the current convolutional layer is a sensitive layer and the importance of the filters in the convolutional layer, and sets the weights of the pruned filters to 0; actor network B allocates different bit widths according to the importance of the filters, and allocates a higher bit width to the sensitive layer filters. The strategies of actor networks A and B are aggregated into the actor network;

[0022] Step S35: Repeat steps S32 to S34 until the quantization pruning operation on all layers of the model is completed, that is, a full round of quantization pruning operation is completed. The model accuracy of this round of quantization pruning operation is verified through the validation set, and the current model compression strategy and accuracy are saved in the reinforcement learning experience replay pool.

[0023] Step S36: Repeat steps S32 to S35 to complete all rounds of model quantization and pruning operations to obtain the neural network model compression strategy with the highest accuracy.

[0024] The global importance estimation formula of the filter in step S33 is:

[0025]

[0026] Where l(i) represents the layer index of the i-th filter, ||·||2 represents the L2 norm, and w i Represents the weight of the i-th filter, α,k∈R L is a trainable variable, L represents the total number of layers;

[0027] r l represents the scaling factor of the l-th layer rank, R l represents the average rank of the lth layer, R min Represents the minimum average rank of all convolutional layers in the neural network, R max Represents the maximum average rank of all convolutional layers in the neural network.

[0028] The parameter update method in step S30 is the DDPG deep deterministic policy reinforcement learning method. The training of the actor network and the critic network is performed based on the accuracy obtained after a complete round of quantization pruning and the quantization pruning state in each round as input. In the state space, for each layer of the network t, the state S is represented by 11 attributes as shown in the following formula: t Attribute characteristics:

[0029] (t,n,c,h,w,stride,k,FLOPs[t],Re all ,Rest,i w / a ,a t-1 )

[0030] Among them, t represents the label of each layer of the network, n represents the total number of network layers, c represents the number of convolution channels, h, w represent the height and width of the convolution feature map respectively, stride is the step size, k represents the number of iterations, FLOPs[t] represents the floating-point calculation amount of each layer of the network t, Re all For all status responses, Rest is the remaining status, i w / a The number of quantized bits representing weights and activations, a t-1 is the action of the t-1 layer network;

[0031] The agent obtains the state S of the tth layer from the filter quantization pruning environment t , get the current feature vector Then output S t Action a in state t As the quantization strategy and compression rate of the current layer, it guides the current layer to select the quantization bit width and prune the alternative filters, where N represents noise, θ represents all parameters of the actor network, π θ (x) is the pruning rate function;

[0032] In the next round of quantitative pruning, m samples are collected from the DDPG experience replay pool and the current target Q value y is calculated according to the following formula j :

[0033]

[0034] in, is obtained through the actor-target network, and It is obtained through the critic target network, setting the value of γ to 1 to avoid giving too high priority to short-term rewards, so that the agent can take into account long-term rewards. During the agent update, the variance of the gradient estimate is reduced by subtracting the baseline reward b. j is the short-term reward of the current quantized pruning operation, and the gradient estimate is the exponential moving average of the previous rewards;

[0035] The loss function of DDPG is the mean square error function as shown below:

[0036]

[0037] A=π θ (S)+N

[0038] in is the current state S j The obtained feature vector, the action A selected for interacting with the environment, will increase a certain amount of noise N, and the noise will decay exponentially after each round of pruning;

[0039] The reward function in reinforcement learning is shown in the following formula:

[0040] R FLOPs =-Error·log(FLOPs).

[0041] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements any of the above-mentioned automated convolutional neural network quantization pruning methods based on reinforcement learning.

[0042] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned reinforcement learning-based automated convolutional neural network quantization pruning methods.

[0043] The reinforcement learning-based convolutional neural network quantitative pruning method, device, and storage medium of the present invention, combined with global sorting based on average rank, are more effective than traditional importance sorting methods and have the following advantages:

[0044] 1. Automated quantization and pruning operations. The quantization and pruning method, implemented through reinforcement learning, automates the compression process. During the quantization and pruning process, learning can continuously optimize the quantization and pruning strategies, ultimately achieving the optimal compression strategy.

[0045] 2. Greatly ensure the accuracy of the neural network model after compression. This invention focuses on globally sorting the filters in the convolutional layer according to their importance to the model accuracy and combined with the average rank. The rank size is consistent with the importance of the filter, which is combined with importance sorting pruning. At the same time, a higher number of bits is allocated to the weight parameters of the filter with high importance, thereby achieving the greatest degree of accuracy preservation.

[0046] 3. Reduce the cost of intelligent equipment. The present invention prunes the filter while taking a quantization operation, that is, selecting the number of bits represented by the filter parameters. Combining pruning and quantization operations, even if the computational complexity is much higher than that of a single pruning operation, a more lightweight network can still be obtained. Since high-performance mobile edge devices are very expensive, directly deploying the model after the quantization and pruning operation on edge devices with weaker computing and storage capabilities, while ensuring a slightly lower accuracy, can greatly reduce the cost of the corresponding computing equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the framework of the present invention.

[0048] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. DETAILED DESCRIPTION

[0049] like Figure 1 As shown, the automatic convolutional neural network quantization pruning method based on reinforcement learning of the present invention includes the following steps:

[0050] Step S10: Obtain an image dataset and divide the dataset into a training set and a validation set in proportion;

[0051] Step S20: Obtain the convolutional neural network model to be quantized and pruned and perform initialization. Use the initialized model to perform 60 rounds of pre-training on the images in the training set to obtain the average rank of the feature map output by each filter. Combine the average rank of the feature map output by each filter in the convolution layer of the current model with the global importance ranking of the filter to obtain filter importance information. Specifically:

[0052] Step S21: Create a convolutional neural network model to be quantized and pruned based on the Pytorch framework;

[0053] Step S22: setting pre-training parameters and establishing a layer structure index corresponding to the convolutional neural network model;

[0054] Step S23: Perform 60 rounds of pre-training on the images in the training set to obtain the current model accuracy, which is obtained by testing different images in the validation set;

[0055] Step S24: obtain the rank of each filter output feature map in the convolution layer, divide the sum of the ranks of all filter output feature maps by the number of filters in the convolution layer, and obtain the average rank of the convolution layer; sort the filters based on their global importance, and use the sorting results as the basis for judging the importance of the filters. The average rank calculation formula is:

[0056]

[0057] Among them, l(i) represents the output feature map of the i-th filter in the l-th layer, Rank(x) represents the function for calculating the rank, and n represents the number of filters in the convolutional layer;

[0058] The average rank of the output feature map of each filter in the convolutional layer of the current model is combined with the global importance sorting of the filter to obtain the filter importance information: the filter in each convolutional layer uses the average importance of the current layer filter as the threshold. Filters with a value greater than this value are important filters, and vice versa. All convolutional layers are sorted by the average importance of their filters. The top 10% of the convolutional layers are sensitive layers and stored in the sensitive layer index of the corresponding convolutional neural network model.

[0059] Step S30: Automated neural network model quantization and pruning operations are implemented through reinforcement learning to obtain the neural network model compression strategy with the highest model accuracy. The reinforcement learning agent is an actor-critic network. The actor network consists of actor networks A and B. The critic network is responsible for evaluating the model compression strategy. The parameter update method of the actor network and the critic network is the DDPG deep deterministic policy reinforcement learning method. Specifically:

[0060] Step S31: Obtain the target quantization rate and pruning rate set in the hyperparameters, determine the number of filters that need to be pruned based on the target pruning rate, and measure the number of bits of the retained filter parameters based on the quantization rate; Step S32: Based on the deterministic strategy of reinforcement learning, if the current layer is in the sensitive layer index, set the current layer quantization bit of the deterministic output of reinforcement learning to 8 bits and the compression rate to 0.1, obtain the number of filters that should be pruned in the current layer of the model, and calculate the number of filters remaining to be pruned;

[0061] Step S33: sort the filters in the layer from low to high by calculating the average rank of the filters and combining the global importance of the filters. The global importance estimation formula of the filters is:

[0062]

[0063] Where l(i) represents the layer index of the i-th filter, ||·||2 represents the L2 norm, and w i Represents the weight of the i-th filter, α,k∈R L is a trainable variable, L represents the total number of layers, r l represents the scaling factor of the l-th layer rank, R l represents the average rank of the lth layer, R min Represents the minimum average rank of all convolutional layers in the neural network, R max Represents the maximum average rank of all convolutional layers in the neural network;

[0064] Step S34: Based on the number of filters required to be pruned for each convolutional layer obtained in step S31 above, actor network A makes different filter pruning strategies based on whether the current convolutional layer is a sensitive layer and the importance of the filters in the convolutional layer, and sets the weights of the pruned filters to 0; actor network B allocates different bit widths according to the importance of the filters, and allocates a higher bit width to the sensitive layer filters. The strategies of actor networks A and B are aggregated into the actor network;

[0065] Step S35: Repeat steps S32 to S34 until the quantization pruning operation on all layers of the model is completed, that is, a full round of quantization pruning operation is completed. The model accuracy of this round of quantization pruning operation is verified through the validation set, and the current model compression strategy and accuracy are saved in the reinforcement learning experience replay pool.

[0066] Step S36: Repeat steps S32 to S35 to complete all rounds of model quantization and pruning operations to obtain the neural network model compression strategy with the highest accuracy.

[0067] Furthermore, the parameter update method in the above steps is the DDPG deep deterministic policy reinforcement learning method, in which the training of the actor network and the critic network is based on the accuracy obtained after a complete round of quantization pruning and the quantization pruning state in each round as input to perform training operations. In the state space, for each layer of the network t, the state S is represented by 11 attributes as shown in the following formula t Attribute characteristics:

[0068] (t,n,c,h,w,stride,k,FLOPs[t],Re all ,Rest,iw / a ,a t-1 )

[0069] Among them, t represents the label of each layer of the network, n represents the total number of network layers, c represents the number of convolution channels, h, w represent the height and width of the convolution feature map respectively, stride is the step size, k represents the number of iterations, FLOPs[t] represents the floating-point calculation amount of each layer of the network t, Re all For all status responses, Rest is the remaining status, i w / a The number of quantized bits representing weights and activations, a t-1 is the action of the t-1 layer network;

[0070] The agent obtains the state S of the tth layer from the environment of filter quantization pruning t , get the current feature vector Then output S t Action a in state t As the quantization strategy and compression rate of the current layer, it guides the current layer to select the quantization bit width and prune the alternative filters, where N represents noise, θ represents all parameters of the actor network, π θ (x) is the pruning rate function.

[0071] In the next round of quantitative pruning, m samples are collected from the DDPG experience replay pool and the current target Q value y is calculated according to the following formula j :

[0072]

[0073] in, is obtained through the actor-target network, and It is obtained through the critic target network, setting the value of γ to 1 to avoid giving too high priority to short-term rewards, so that the agent can take into account long-term rewards. During the agent update, the variance of the gradient estimate is reduced by subtracting the baseline reward b. j is the short-term reward of the current quantized pruning operation, and the gradient estimate is the exponential moving average of the previous rewards.

[0074] The loss function of DDPG is the mean square error function as shown below:

[0075]

[0076] A=π θ (S)+N

[0077] in is the current state S jThe obtained feature vector, the action A selected for interacting with the environment, will increase a certain amount of noise N, and the noise will decay exponentially after each round of pruning;

[0078] The reward function in reinforcement learning is shown in the following formula:

[0079] R FLOPs =-Error·log(FLOPs)

[0080] Step S40: Perform a fine-tuning operation on the neural network model after the quantization pruning is completed to obtain the final neural network model after the pruning is completed.

[0081] The convolutional neural network to be quantized and pruned has multiple convolutional layers. The top 10% of the convolutional layers obtained from step S24 are sensitive layers, which means that these convolutional layers are relatively important to the convolutional neural network. If they are pruned too much or the bit allocation is too low, the accuracy of the convolutional neural network model will be greatly reduced. That is, they are sensitive to quantization and pruning operations, so they are called sensitive layers.

[0082] The pruning process is to operate on each convolutional layer of the convolutional neural network layer by layer. During this period, sensitive layers and non-sensitive layers will be encountered. The present invention performs different operations on sensitive layers or non-sensitive layers in order to better compress the model while maintaining accuracy.

[0083] The filters in the convolutional layers of the convolutional neural network to be quantitatively pruned also have different importances. They are divided into important filters and unimportant filters using the average value as the threshold. The pruning strategy obtained through the actor network is to retain the important filters in the sensitive layers and prune the unimportant filters in the unsensitive layers the most.

[0084] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements an automated convolutional neural network quantization pruning method based on reinforcement learning. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen. The input device of the computer device may be a touch layer covering the display screen, or may be a key, trackball, or touchpad provided on the computer device housing, or may be an external keyboard, touchpad, or mouse.

[0085] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the automated convolutional neural network quantization pruning method based on reinforcement learning provided in any of the above embodiments is implemented, and has corresponding functions and beneficial effects.

[0086] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0087] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0088] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present invention patent shall be determined by the appended claims.

Claims

1. An automated convolutional neural network quantization pruning method based on reinforcement learning, characterized by The method includes the following steps: Step S10: Obtain an image dataset and divide the dataset into a training set and a validation set in proportion; Step S20: Obtain a convolutional neural network model to be quantized and pruned and perform initialization. Use the initialized model to perform 60 rounds of pre-training on the images in the training set to obtain the average rank of the feature map output by each filter. Combine the average rank of the feature map output by each filter in the convolutional layer of the current model with the global importance ranking of the filter to obtain filter importance information. Step S30: Automated neural network model quantization and pruning operations are implemented through reinforcement learning to obtain a neural network model compression strategy with the highest model accuracy. The reinforcement learning agent is an actor-critic network, where the actor network consists of actor networks A and B, and the critic network is responsible for evaluating the model compression strategy. The parameter update method of the actor network and the critic network is the DDPG deep deterministic policy reinforcement learning method. Specifically: Step S31: Obtain the target quantization rate and pruning rate set in the hyperparameters, determine the number of filters to be pruned based on the target pruning rate, and measure the number of bits of the retained filter parameters based on the quantization rate; Step S32: According to the deterministic strategy of reinforcement learning, if the current layer is in the sensitive layer index, the quantization bit number of the current layer of the deterministic output of reinforcement learning is set to 8 bits, the compression rate is set to 0.1, the number of filters that should be pruned in the current layer of the model is obtained, and the number of filters remaining to be pruned is calculated; Step S33: sort the filters in the layer from low to high by calculating the average rank of the filters and combining the global importance of the filters; the global importance estimation formula of the filters is: in, Indicates the i The layer index of the filters, represents the L2 norm, Representative i The weights of the filters, is a trainable variable, L represents the total number of layers; , Indicates the Scaling factor of layer rank, Indicates the The average rank of the layer, represents the minimum average rank of all convolutional layers in the neural network, Represents the maximum average rank of all convolutional layers in the neural network; Step S34: Based on the number of filters to be pruned for each convolutional layer obtained in step S31, the actor network A makes different filter pruning strategies according to whether the current convolutional layer is a sensitive layer and the importance of the filters in the convolutional layer, and sets the weights of the pruned filters to 0. Actor network B allocates different bit widths according to the importance of the filters, and the sensitive layer filters are allocated higher bit widths, summarizing the strategies of actor networks A and B into the actor network; Step S35: Repeat steps S32 to S34 until the quantization pruning operation on all layers of the model is completed, that is, a full round of quantization pruning operation is completed. The model accuracy of this round of quantization pruning operation is verified through the validation set, and the current model compression strategy and accuracy are saved in the reinforcement learning experience replay pool. Step S36: Repeat steps S32 to S35 to complete all rounds of model quantization and pruning operations to obtain the neural network model compression strategy with the highest accuracy; Step S40: Perform a fine-tuning operation on the neural network model after the quantization pruning is completed to obtain the final neural network model after the pruning is completed.

2. The automated convolutional neural network quantization pruning method based on reinforcement learning according to claim 1, characterized in that The step S20 is specifically as follows: Step S21: Create a convolutional neural network model to be quantized and pruned based on the Pytorch framework; Step S22: setting pre-training parameters and establishing a layer structure index corresponding to the convolutional neural network model; Step S23: Perform 60 rounds of pre-training on the images in the training set to obtain the current model accuracy, which is obtained by testing different images in the validation set; Step S24: obtain the rank of each filter output feature map in the convolutional layer, divide the sum of the ranks of all filter output feature maps by the number of filters in the convolutional layer, and obtain the average rank of the convolutional layer; sort the filters based on their global importance, and use the sorting results as the basis for discriminating the importance of the filters; The filter importance information is obtained by combining the average rank of the output feature map of each filter in the convolutional layer of the current model with the global importance ranking of the filter.

3. The automated convolutional neural network quantization pruning method based on reinforcement learning according to claim 2, characterized in that The filter importance information in step S24 refers to the filter in each convolutional layer using the average importance of the current layer filter as a threshold. Filters greater than this value are important filters, otherwise they are unimportant filters. All convolutional layers are sorted according to the average importance of their filters. The convolutional layer with the preset value before sorting is the sensitive layer, and it is stored in the sensitive layer index of the corresponding convolutional neural network model.

4. The automated convolutional neural network quantization pruning method based on reinforcement learning according to claim 1, characterized in that The parameter updating method of step S30 is the DDPG deep deterministic policy reinforcement learning method. The training of the actor network and the critic network is based on the accuracy obtained after a complete round of quantization pruning and the quantization pruning state in each round as input to perform training operations. In the state space, for each layer of the network , the state is represented by 11 attributes as shown in the following formula Attribute characteristics: in, Indicates the label of each layer of the network, Indicates the total number of network layers, represents the number of convolution channels, Represent the height and width of the convolution feature map respectively, is the step length, represents the number of iterations, Represents each layer of the network The floating point calculation amount, For all status responses, is the remaining state, The number of quantized bits representing weights and activations, for Actions of layer networks; The agent obtains its first Layer status , get the current feature vector , then output Actions in state As the quantization strategy and compression rate of the current layer, it guides the current layer to select the quantization bit width and prune the alternative filters, where , represents noise, Represents all parameters of the actor network, is the pruning rate function; In the next round of quantitative pruning, by collecting samples, calculate the current target according to the following formula value : in, is obtained through the actor-target network, and is obtained through the critic target network, The value of is set to 1 to avoid overprioritizing short-term rewards, allowing the agent to take into account long-term rewards, by subtracting the baseline reward during agent updates. To reduce the variance of the gradient estimate, is the short-term reward of the current quantized pruning operation, and the gradient estimate is the exponential moving average of the previous rewards; The loss function of DDPG is the mean square error function as shown below: in Current status The feature vector obtained, which selects the action of interacting with the environment It will increase some noise And the noise will decay exponentially after each round of pruning; The reward function in reinforcement learning is shown in the following formula: 。 5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the automated convolutional neural network quantization pruning method based on reinforcement learning according to any one of claims 1 to 4 is implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the automated convolutional neural network quantization pruning method based on reinforcement learning according to any one of claims 1 to 4 is implemented.