Pruning method, device and equipment of neural network and medium
By applying preset pruning and compression metrics and performance evaluation metrics to the neural network, suitable neural network subnetworks for the target hardware platform are selected, solving the problem of inaccurate evaluation in the prior art and improving the performance and efficiency of the neural network on the hardware platform.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2022-03-31
- Publication Date
- 2026-07-24
AI Technical Summary
Existing pruning algorithms, when evaluating neural network performance, cannot accurately reflect the performance improvement and power consumption reduction on the hardware platform simply by reducing the amount of computation or parameters, resulting in inaccurate evaluations.
The initial neural network is pruned using preset pruning and compression metrics to obtain multiple candidate subnets. The performance of each candidate subnet is then predicted on the target hardware platform based on preset performance evaluation metrics such as speed, latency, and power consumption, and the target subnet that meets the target value range is selected.
It improves the performance and data processing efficiency of neural networks on target hardware platforms, ensures the accuracy and adaptability of evaluation, and is suitable for neural network optimization on hardware platforms such as mobile terminals.
Smart Images

Figure CN116933857B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for pruning neural networks. Background Technology
[0002] The application of neural network-based artificial intelligence technology on hardware platforms such as mobile terminals has led to the rapid development of smart mobile terminals, meeting various application needs. Key technologies include data processing based on trained neural network model data in application areas such as video processing, speech recognition, image recognition and understanding, and game vision. Given the limited computing resources of mobile terminals and considering that most convolutional neural networks have a certain degree of parameter redundancy, pruning is used to remove redundant convolutional kernels or neurons in each layer of the neural network, resulting in neural networks that consume fewer computing and storage resources on mobile terminals and other hardware platforms.
[0003] Most existing pruning algorithms simplify networks by reducing computational load or the number of parameters. However, due to the complexity of neural network computation and the differences in the underlying computational characteristics of hardware platforms, reducing computational load or the number of parameters does not necessarily lead to speed improvements or power reductions. Therefore, evaluating the performance of pruned neural networks solely based on computational load or the number of parameters is inaccurate. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a method, apparatus, device, and medium for pruning neural networks.
[0005] In a first aspect, embodiments of this disclosure provide a method for pruning neural networks, the method comprising:
[0006] The initial neural network is pruned according to the preset pruning and compression index to obtain multiple candidate subnetworks;
[0007] Predict the estimated values of each candidate subnet on the target hardware platform based on preset performance evaluation indicators;
[0008] The target subnet is selected from the plurality of candidate subnets based on the estimated values, wherein the estimated values of the target subnet running on the target hardware platform meet the target value range corresponding to the pre-configured performance evaluation index.
[0009] In one optional implementation, the preset pruning compression index includes:
[0010] The pruning calculation reduction index, or the pruning parameter reduction index.
[0011] In one optional implementation, the step of pruning the initial neural network according to a preset pruning compression index to obtain multiple candidate subnetworks includes:
[0012] Based on the preset initial pruning rate and the pruning growth rate of the current period, obtain the pruning compression index of the current period;
[0013] Pruning is performed on at least one convolutional layer in the initial neural network according to the pruning compression index of the current period to obtain the plurality of candidate subnetworks.
[0014] In one optional implementation, the step of pruning at least one convolutional layer in the initial neural network according to the pruning compression index of the current period to obtain multiple candidate subnetworks includes:
[0015] Based on the pruning compression index of the current period and the parameter configuration of each convolutional layer in the initial neural network, calculate the set of pruning units corresponding to each convolutional layer, wherein the set of pruning units corresponding to each convolutional layer satisfies the pruning compression index of the current period.
[0016] Based on the set of pruning units corresponding to each convolutional layer, each convolutional layer in the initial neural network is pruned individually to obtain multiple candidate subnetworks, wherein the number of multiple candidate subnetworks is the same as the number of convolutional layers in the initial neural network.
[0017] In one optional implementation, the preset performance evaluation metrics include:
[0018] A performance evaluation metric can be one of speed, latency, power consumption, or memory usage, or a combination of multiple performance evaluation metrics.
[0019] In one optional implementation, predicting the estimated value of each candidate subnet running on the target hardware platform based on preset performance evaluation metrics includes:
[0020] Each candidate subnet is encoded using a speed evaluation network to obtain the running speed of each candidate subnet on the target hardware platform. The speed evaluation network is trained and generated based on a sample network and a dataset of corresponding speeds on the target hardware platform.
[0021] In one optional implementation, predicting the estimated value of each candidate subnet running on the target hardware platform based on preset performance evaluation metrics includes:
[0022] Each candidate subnet is encoded according to the power consumption evaluation network to obtain the operating power consumption of each candidate subnet on the target hardware platform. The power consumption evaluation network is trained and generated based on the sample network and corresponding power consumption dataset of the target hardware platform.
[0023] In one optional implementation, the step of filtering the target subnet from the plurality of candidate subnets based on the estimated value includes:
[0024] The estimated value is compared with the target value range. If there is at least one estimated value that meets the target value range, then at least one target candidate subnet that meets the target value range is selected from the plurality of candidate subnets.
[0025] The target subnet is selected based on the at least one target candidate subnet.
[0026] In an optional implementation, when there are multiple target candidate subnets, the step of filtering the target subnet based on the at least one target candidate subnet includes:
[0027] The target performance evaluation index is determined from a set of pre-defined performance evaluation indicators.
[0028] Compare the estimated values corresponding to the target performance evaluation index in each of the target candidate subnets;
[0029] Based on the comparison results, the target candidate subnet with the highest estimated value is selected as the target subnet.
[0030] In an optional implementation, when there are multiple target candidate subnets, the step of filtering the target subnet based on the at least one target candidate subnet includes:
[0031] Predict the operating accuracy of each of the target candidate subnets on the target hardware platform;
[0032] The running accuracy of each of the target candidate subnets on the target hardware platform is compared, and the target candidate subnet with the highest running accuracy is selected as the target subnet.
[0033] In an optional implementation, after comparing the estimated value with the target value range, the method further includes:
[0034] If none of the estimated values meet the target value range, then predict the running accuracy of each candidate subnet on the target hardware platform;
[0035] The running accuracy of each candidate subnet on the target hardware platform is compared, and the candidate subnet with the highest running accuracy is selected as the initial neural network for the next cycle.
[0036] The initial neural network for the next cycle is pruned according to the preset pruning growth rate for the next cycle to obtain the multiple candidate subnetworks.
[0037] In one optional implementation, it further includes:
[0038] The input data is processed on the target hardware platform through the target subnet, wherein the input data includes one or more combinations of multimedia data, audio data, video data, and image data.
[0039] Secondly, embodiments of this disclosure also provide a neural network pruning processing apparatus, the apparatus comprising:
[0040] The acquisition module is used to prune the initial neural network according to the preset pruning and compression index to obtain multiple candidate subnetworks;
[0041] The prediction module is used to predict the estimated values of each candidate subnet running on the target hardware platform based on preset performance evaluation indicators.
[0042] A filtering module is used to filter a target subnet from the plurality of candidate subnets based on the estimated values, wherein the estimated values of the target subnet running on the target hardware platform meet the pre-configured target value range corresponding to the performance evaluation index.
[0043] Thirdly, this disclosure provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to implement the above-described method.
[0044] Fourthly, this disclosure provides an apparatus comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method described above.
[0045] Fifthly, this disclosure provides a computer program product comprising a computer program / instruction that, when executed by a processor, implements the method described above.
[0046] The technical solution provided in this disclosure has the following advantages compared with the prior art: The initial neural network is pruned according to a preset pruning and compression index to obtain multiple candidate subnets; the estimated value of each candidate subnet running on the target hardware platform is predicted according to a preset performance evaluation index; a target subnet is selected from the multiple candidate subnets based on the estimated value, wherein the estimated value of the target subnet running on the target hardware platform matches a pre-configured target value range corresponding to the performance evaluation index. Therefore, this disclosure uses a pre-configured performance evaluation index associated with the target hardware platform to evaluate the performance of multiple pruned candidate subnets, thereby finding a target subnet whose running performance on the target hardware platform meets preset requirements. Compared with the prior art's method of evaluating candidate subnet performance through computational load, this application accurately selects target subnets that are more suitable for the characteristics of the hardware platform for data processing using direct hardware evaluation indexes, thereby further improving the network's running performance and data processing efficiency. Attached Figure Description
[0047] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0048] Figure 1 A flowchart illustrating a neural network pruning method provided in an embodiment of this disclosure;
[0049] Figure 2 A flowchart illustrating another neural network pruning method provided in this embodiment of the disclosure;
[0050] Figure 3 A schematic diagram of channel dependency provided in an embodiment of this disclosure;
[0051] Figure 4 A schematic diagram of the structure of a neural network pruning device provided in an embodiment of this disclosure;
[0052] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0053] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0054] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0055] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0056] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0057] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0058] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0059] To address the aforementioned problems, this disclosure provides a method for pruning neural networks, which will be described below with reference to specific embodiments.
[0060] Figure 1 This is a flowchart illustrating a neural network pruning method provided in an embodiment of this disclosure. The method can be executed by a neural network pruning device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:
[0061] Step 101: Prune the initial neural network according to the preset pruning and compression index to obtain multiple candidate subnetworks.
[0062] To ensure model performance, neural networks may contain a certain amount of redundant parameters. Pruning can reduce computational and storage resource consumption while maintaining accuracy, thereby accelerating the inference process and facilitating edge deployment. In related technologies, evaluation metrics such as computational FLOPS or parameter count are used to assess the pruned neural network model. However, due to the complexity of neural network computation or differences in the underlying computational characteristics of hardware platforms, a neural network model with lower computational FLOPS or fewer parameters may not necessarily run faster on the hardware platform. Therefore, indirect metrics like computational FLOPS or parameter count are insufficient for accurately evaluating neural network models. In this embodiment, the accuracy of neural network evaluation is improved, specifically by including:
[0063] In this embodiment, the initial neural network is a neural network model that needs to be pruned. The initial neural network can be set according to the application scenario. This embodiment does not impose any restrictions. For example, the parameters of the neural network can be trained based on the sample data of the application scenario to obtain the initial neural network. Then, the input data can be processed based on the obtained initial neural network to obtain the output data. The input data includes one or more combinations of multimedia data, audio data, video data, and image data.
[0064] In this embodiment, the initial neural network is pruned according to a preset pruning compression metric to obtain multiple candidate subnetworks. The preset pruning compression metric may include a pruning computation compression metric or a pruning parameter compression metric. There are various methods for pruning the initial neural network according to the preset pruning compression metric, and this embodiment does not impose any limitations. For example, one or more layers of the initial neural network can be pruned according to the pruning compression metric, or the initial neural network can be iteratively pruned over multiple cycles until the pruned initial neural network reaches the pruning compression metric.
[0065] Step 102: Predict the estimated values of each candidate subnet running on the target hardware platform based on preset performance evaluation indicators.
[0066] Due to the different underlying computational characteristics of hardware platforms, the performance of the same neural network model may vary on different hardware platforms. For example, if a graphics processing unit (GPU) is optimized for a specific algorithm, the GPU will perform better when running that algorithm. In this embodiment, the target hardware platform is determined based on the hardware environment of the pruned neural network model, and then the estimated value of each candidate subnet running on that target hardware platform is predicted according to preset performance evaluation metrics.
[0067] Among them, the performance evaluation index can be a direct indicator that characterizes the running performance of the candidate subnet on the target hardware platform. For example, the performance evaluation index may include one or a combination of speed, latency, power consumption, and memory usage.
[0068] In this embodiment, there are multiple methods for determining the estimated value, which can be selected according to the application scenario. This embodiment does not impose any restrictions. Examples are illustrated below:
[0069] In one alternative implementation, the candidate subnet can be run on the target hardware platform, and the running process can be tested according to preset performance evaluation indicators, and then the estimated values can be determined based on the test results.
[0070] In another alternative implementation, a corresponding evaluation network can be determined based on performance evaluation metrics, and then the corresponding estimated values can be obtained based on the evaluation network. Taking performance evaluation metrics including speed evaluation metrics or power consumption evaluation metrics as an example, the following example is provided:
[0071] If the performance evaluation metrics include speed evaluation metrics, each candidate subnet is encoded using the speed evaluation network to obtain the running speed of each candidate subnet on the target hardware platform. The speed evaluation network is trained and generated based on the sample networks and corresponding speed datasets of the target hardware platform, as detailed below:
[0072] In this embodiment, a sample network can be run on the target hardware platform and the speed of the sample network can be recorded to obtain a training set of the sample network and its corresponding speed for the target hardware platform. Then, the neural network model can be trained based on the training set to obtain a speed evaluation network for the target hardware platform. After obtaining the speed evaluation network, each candidate subnet can be encoded according to the format of the input data of the speed evaluation network. The encoding corresponding to each candidate subnet is input into the speed evaluation network to obtain the running speed of each candidate subnet on the target hardware platform.
[0073] Taking the speed evaluation network as a trained SENet (Squeeze-and-Excitation Networks) model as an example, the encoding information obtained by encoding the candidate subnets includes: the detailed configuration of the computation of each layer in the candidate subnet, and the input size of the entire network. This encoding information is then input into the trained SENet model to obtain the corresponding running speed.
[0074] If the performance evaluation metrics include power consumption metrics, each candidate subnet is encoded using the power consumption evaluation network to obtain the operating power consumption of each candidate subnet on the target hardware platform. The power consumption evaluation network is trained and generated based on a dataset of sample networks and corresponding power consumption values from the target hardware platform, as detailed below:
[0075] In this embodiment, a sample network can be run on the target hardware platform and the power consumption of the sample network can be recorded to obtain a training set of the sample network and corresponding power consumption for the target hardware platform. Then, the neural network model can be trained based on the training set to obtain a power consumption evaluation network for the target hardware platform. After obtaining the power consumption evaluation network, each candidate subnet can be encoded according to the format of the input data of the power consumption evaluation network. The encoding corresponding to each candidate subnet is input into the power consumption evaluation network to obtain the running power consumption of each candidate subnet on the target hardware platform.
[0076] Taking the power consumption evaluation network as a trained deep completion neural network PENet model as an example, the encoding information obtained by encoding the candidate subnet includes: the detailed configuration of the computation of each layer in the candidate subnet and the input size of the whole network. This encoding information is input into the trained PENet model to obtain the corresponding running power consumption.
[0077] Step 103: Select the target subnet from multiple candidate subnets based on the estimated values, wherein the estimated values of the target subnet running on the target hardware platform match the pre-configured target value range corresponding to the performance evaluation indicators.
[0078] After obtaining the estimated values corresponding to the candidate subnets, the candidate subnets can be filtered based on these estimated values to determine the target subnet from multiple candidate subnets. The estimated values of the target subnet running on the target hardware platform need to meet the pre-configured target value range corresponding to the performance evaluation indicators. It should be noted that there are multiple methods to determine the target subnet, and this embodiment does not limit them. An example is illustrated below:
[0079] In one optional implementation, if the estimated value includes data from multiple dimensions such as running speed, running power consumption, and memory usage, and there are multiple candidate subnets that meet the target value range, then the subnet with the best running speed among these multiple candidate subnets can be determined as the target subnet.
[0080] In another optional implementation, the first candidate subnet with the best estimated comprehensive performance value can be determined from multiple candidate subnets. It is then determined whether the current first candidate subnet meets the target value range. If it does not meet the target value range, further pruning is performed based on the current first candidate subnet. If it meets the target value range, the current first candidate subnet is determined as the target subnet.
[0081] In summary, the neural network pruning method according to the embodiments of this disclosure prunes the initial neural network according to a preset pruning compression index to obtain multiple candidate subnets; predicts the estimated value of each candidate subnet running on the target hardware platform according to a preset performance evaluation index; and filters the target subnet from the multiple candidate subnets based on the estimated value, wherein the estimated value of the target subnet running on the target hardware platform matches a pre-configured target value range corresponding to the performance evaluation index. It can be seen that the embodiments of this disclosure evaluate the performance of multiple pruned candidate subnets through pre-configured performance evaluation indices associated with the target hardware platform, thereby finding the target subnet whose running performance on the target hardware platform meets preset requirements. Compared to the prior art's method of evaluating candidate subnet performance through computational load, this application accurately filters out target subnets that are more suitable for the characteristics of the hardware platform for data processing using direct hardware evaluation indices, thereby further improving the network's running performance and data processing efficiency.
[0082] Figure 2 A flowchart illustrating another neural network pruning method provided in this disclosure embodiment is shown below. Figure 2 As shown, the method includes the following steps:
[0083] Step 201: Obtain the pruning compression index for the current period based on the preset initial pruning rate and the pruning growth rate for the current period.
[0084] In this embodiment, the pruning rate gradually increases through one or more cycles of pruning. Specifically, an initial pruning rate and a pruning growth rate for each cycle can be preset. Taking the pruning operation performed in the current cycle as an example, when performing the pruning operation in the current cycle, the pruning growth rates of the current cycle and previous cycles can be accumulated on the basis of the initial pruning rate, and the accumulated result is determined as the pruning compression index for the current cycle.
[0085] The initial pruning rate and the pruning growth rate for each cycle can be set according to the application scenario. This embodiment does not impose any restrictions. For example, the initial pruning rate can be preset to 0, and the pruning growth rate for each cycle can be set to the same value, such as 5%.
[0086] Step 202: Prune at least one convolutional layer in the initial neural network according to the pruning compression index of the current period to obtain multiple candidate subnetworks.
[0087] In one optional implementation, the pruning rate of each convolutional layer in the initial neural network can be calculated based on the pruning compression index of the current period. The initial neural network is then pruned according to the pruning rate of each convolutional layer to obtain candidate subnetworks. Since there are multiple possible correspondences between the convolutional layers and pruning rates determined by the pruning compression index of the current period, multiple candidate subnetworks can be obtained.
[0088] In another optional implementation, to reduce the computational complexity of pruning and improve pruning efficiency, pruning can be performed individually for each convolutional layer in the current cycle, specifically including:
[0089] Step a1: Based on the pruning compression index of the current period and the parameter configuration of each convolutional layer in the initial neural network, calculate the set of pruning units corresponding to each convolutional layer, wherein the set of pruning units corresponding to each convolutional layer satisfies the pruning compression index of the current period.
[0090] In this embodiment, a convolutional layer in the initial neural network is pruned in the current cycle, and the pruning performed on this convolutional layer meets the pruning compression metric of the current cycle. Specifically, in this embodiment, the parameter configuration of each convolutional layer in the initial neural network can be adjusted accordingly using a pruning algorithm. This embodiment is not limited to this. For example, if the pruning algorithm is ConvertFlopsOrParamsToFilters, the parameter configuration of the convolutional layer may include: the dimension of the input feature map, the dimension of the output feature map, and the dimension of the convolutional kernel. Furthermore, based on the parameter configuration of each convolutional layer and the pruning compression metric of the current cycle, the corresponding set of pruned units is calculated.
[0091] The ConvertFlopsOrParamsToFilters pruning algorithm is illustrated using the Lth layer of the initial neural network. Assume the input feature map dimension of the Lth layer is (C1, H1, W1), the convolution kernel dimension is (O1, C1, L, L), and the output feature map dimension is (O1, H2, W2). H2 and W2 in the output feature map can be calculated based on the convolution kernel size, stride, and other information combined with the input feature map size. Furthermore, for the next layer after the Lth layer, the (L+1)th layer, the input feature map dimension is (O1, H2, W2), the convolution kernel dimension is (O2, O1, L, L), and the output feature map dimension is (O2, H3, W3). The computational cost of layer L is Flops(L) = H1 × W1 × C1 × L × L × O1, and the computational cost of layer L+1 is Flops(L+1) = H2 × W2 × O1 × L × L × O2. Assume that x convolutional kernels are pruned from layer L to achieve the current pruning growth rate ΔR. i,0 Then we have:
[0092] H1×W1×C1×L×L×(O1-x)+H2×W2×(O1-x)×L×L×O2<=Flops(L)+Flops(L+1)-ΔR i,0 .
[0093] Find the minimum x that satisfies the above formula, and use this minimum x as the minimum number of convolutional kernels to be pruned. Establish a set of pruned units based on the x least important convolutional kernels in the convolutional layer.
[0094] Step a2: Based on the set of pruning units corresponding to each convolutional layer, perform separate pruning on each convolutional layer in the initial neural network to obtain multiple candidate subnetworks. The number of candidate subnetworks is the same as the number of convolutional layers in the initial neural network.
[0095] In this embodiment, each convolutional layer has a corresponding set of pruning units, so each convolutional layer can be pruned individually to obtain multiple candidate subnetworks, and the number of candidate subnetworks is consistent with the number of convolutional layers in the initial neural network. When pruning the initial neural network, the set of pruning units is determined based on the convolutional layer currently being pruned, and the convolutional layer being pruned is pruned according to the set of pruning units. After pruning, the corresponding candidate subnetworks are obtained. It should be noted that in this pruning process, convolutional layers other than the one currently being pruned are not pruned.
[0096] For example, if the initial neural network includes four convolutional layers: A, B, C, and D, then pruning can be performed on each convolutional layer separately to obtain four candidate subnetworks.
[0097] It should be noted that in the above embodiments, in order to ensure the speed gain obtained by pruning, the pruning information of convolutional layers with channel dependencies in the initial neural network is consistent. Taking two convolutional layers, Conv-1 and Conv-2, as an example, if structured pruning of Conv-1 reduces the number of input channels of Conv-2, it can be assumed that there is a channel dependency between Conv-1 and Conv-2. For convolutional layers with channel dependencies, if the pruned convolutional kernels are different, no actual speed gain can be obtained.
[0098] Figure 3 A schematic diagram of channel dependency provided in an embodiment of this disclosure, such as... Figure 3 As shown, Figure 3 The neural network in the example includes two convolutional layers, Conv-1 and Conv-2, which have a channel dependency. One pruning method involves pruning convolutional kernels 3 and 4 from Conv-1 and convolutional kernels 1 and 2 from Conv-2. Since Conv-1 and Conv-2 prune different kernels, adding or multiplying the outputs of Conv-1 and Conv-2 requires zero-padding before addition / multiplication, thus not reducing the actual computational cost. Another pruning method involves keeping the pruning information consistent for Conv-1 and Conv-2. This eliminates the need for zero-padding during addition / multiplication, effectively reducing the computational cost.
[0099] Optionally, after obtaining the candidate subnet, preliminary accuracy recovery training can be performed on the candidate subnet. If the pruning and compression index value of the current period is small, the number of rounds of the initial accuracy recovery training can be small. The accuracy of the candidate subnet can be better recovered by a smaller number of rounds of accuracy recovery training, thereby improving the accuracy of the performance evaluation of the candidate subnet.
[0100] Step 203: Predict the estimated values of each candidate subnet running on the target hardware platform based on preset performance evaluation indicators.
[0101] In this embodiment, the performance evaluation metrics include, but are not limited to, any one or a combination of accuracy evaluation metrics, speed evaluation metrics, and power consumption evaluation metrics. Furthermore, in this embodiment, speed evaluation metrics can be obtained based on a speed evaluation network, and power consumption evaluation metrics can be obtained based on a power consumption evaluation network.
[0102] Let Net be the initial neural network of the current cycle. i For example, this Net i It has K convolutional layers and an initial pruning rate of R. 0,0 The pruning growth rate for the current cycle is ΔR. i,0 R0,0 ΔR is the initial computational cost. i,0 As a metric for computational growth, the computational cost Flops(Net0) of the initial neural network Net0 without iterative pruning can be calculated, and R can be determined. 0,0 =Flops(Net0). This applies to Net... i Each convolutional layer in the network is pruned individually to obtain multiple candidate subnetworks. Taking the Kth layer as an example, according to Net... i The dimensions of the input feature map, the dimensions of the output feature map, and the size of the convolutional kernels for each layer are used to determine the minimum number N of pruned convolutional kernels based on the ConvertFlopsOrParamsToFilters function. filterk Based on the L1 norm convolutional kernel importance evaluation criterion, the N kernels with the lowest importance in the Kth convolutional layer are pruned. filterk Using convolutional kernels, we obtain candidate subnets Net. Slimk-1 The Net is computed through speed evaluation networks, power consumption evaluation networks, etc. Slimk-1 The various estimated values of Res i,j (Net Slimk-1 ).
[0103] Step 204: Compare the estimated value with the target value range to determine whether there is at least one estimated value that meets the target value range.
[0104] In this embodiment, the target value range can be set according to user needs, application scenario, hardware environment, etc. The estimated values of candidate subnets are compared with the target value range. If an estimated value meets the target value range, the target subnet can be determined from the candidate subnets; if no estimated value meets the target value range, pruning can be performed in the next cycle. In an optional implementation, a filter can be used to determine whether an estimated value meets the target value range.
[0105] Step 205: If there is at least one estimated value that meets the target value range, then select at least one target candidate subnet that meets the target value range from multiple candidate subnets.
[0106] In this embodiment, if there are one or more estimated values that meet the target value range, it means that there are candidate subnets that can pass the screening. Then, one or more target candidate subnets that meet the target value range are selected from multiple candidate subnets.
[0107] Step 206: Filter target subnets based on at least one target candidate subnet.
[0108] If there is only one target candidate subnet, then that target candidate subnet can be used as the target subnet.
[0109] If there are multiple target candidate subnets, a method for determining the target subnet can be set according to user needs. This method determines the target subnet from the multiple candidate subnets, thereby meeting the user's performance requirements for the neural network model in different application scenarios. In this embodiment, the method for determining the target subnet is not limited; an example is given below:
[0110] In one optional implementation, the target subnet can be determined based on the target performance evaluation metrics, specifically including:
[0111] First, a target performance evaluation index is determined from a set of preset performance evaluation indices. In this embodiment, there are various methods for determining the target performance evaluation index from multiple performance evaluation indices, and this embodiment does not impose any limitations. For example, a performance evaluation index with higher importance can be selected as the target performance evaluation index.
[0112] Furthermore, the estimated values corresponding to the target performance evaluation index in each target candidate subnet are compared. Finally, based on the comparison results, the target candidate subnet with the highest estimated value is selected as the target subnet.
[0113] For each target candidate subnet, an estimated value corresponding to the target performance evaluation index is obtained. This estimated value is then compared using methods such as sorting, and the target candidate subnet with the highest estimated value is selected as the target subnet. For example, running speed can be determined as the target performance evaluation index. Each target candidate subnet can be sorted according to its running speed, and the target candidate subnet with the fastest running speed is selected as the target subnet.
[0114] In another alternative implementation, the target subnet can be determined based on the operational precision, specifically including:
[0115] First, the running accuracy of each target candidate subnet on the target hardware platform is predicted. In this embodiment, accuracy test samples can be used to test the accuracy of the target candidate subnets running on the target hardware platform to obtain the running accuracy of each target candidate subnet. In different application scenarios, running accuracy can have corresponding metrics. For example, if the application scenario is a super-resolution problem, running accuracy can be the peak signal-to-noise ratio; if the application scenario is a classification problem, running accuracy can be the classification accuracy; if the application scenario is a segmentation problem, running accuracy can be the average accuracy across all classes.
[0116] Furthermore, the running accuracy of each target candidate subnet on the target hardware platform is compared, and the target candidate subnet with the highest running accuracy is selected as the target subnet. In this embodiment, the target candidate subnets can be compared by sorting or other methods based on their running accuracy on the target hardware platform, and the target candidate subnet with the highest running accuracy is selected as the target subnet.
[0117] Optionally, after acquiring the target subnet, it can be subjected to full-precision recovery training. The number of epochs for this full-precision training can be similar to the number of epochs for pre-training the neural network.
[0118] Continuing with the initial neural network of the current cycle as Net i For example, after the pruning process in the current cycle, K candidate subnets can be obtained, namely {Net}. Slim0 ,...,Net Slimk-1}, and obtain the estimated value {Res} corresponding to each candidate subnet. i,j (Net Slim0 ),...,Res i,j (Net Slimk-1 Based on the estimated values corresponding to each candidate subnet, target candidate subnets that meet the target value range are selected, and the target candidate subnet with the highest accuracy is selected as the target subnet.
[0119] Step 207: If none of the estimated values meet the target value range, then predict the running accuracy of each candidate subnet on the target hardware platform.
[0120] In this embodiment, if none of the estimated values meet the target value range, pruning is required for the next cycle. The initial neural network for the next cycle can be determined by the running accuracy. Specifically, accuracy test samples can be used to test the accuracy of each candidate subnetwork running on the target hardware platform to obtain the running accuracy of each candidate subnetwork.
[0121] Step 208: Compare the running accuracy of each candidate subnet on the target hardware platform, and select the candidate subnet with the highest running accuracy as the initial neural network for the next cycle.
[0122] After obtaining the running accuracy of the candidate subnets on the target platform, the running accuracy of each candidate subnet on the target hardware platform can be compared by sorting and other methods. Based on the comparison results, the candidate subnet with the highest running accuracy is selected as the initial neural network for the next cycle.
[0123] Step 209: Prune the initial neural network for the next cycle according to the preset pruning growth rate for the next cycle to obtain multiple candidate subnetworks.
[0124] In this embodiment, the pruning growth rate for the next period can be determined based on the preset pruning growth rate for each period. The initial neural network for the next period is then pruned according to the pruning growth rate to obtain multiple candidate subnetworks.
[0125] There are various methods for pruning the initial neural network of the next cycle, and this embodiment does not limit them. For example, based on the pruning compression index of the next cycle and the parameter configuration of each convolutional layer in the initial neural network of the next cycle, the set of pruning units corresponding to each convolutional layer can be calculated. Based on the set of pruning units corresponding to each convolutional layer, each convolutional layer in the initial neural network of the next cycle can be pruned separately to obtain multiple candidate subnetworks.
[0126] In summary, the neural network pruning method of this disclosure iteratively prunes the initial neural network using the pruning compression index of the current cycle, thereby gradually improving the pruning rate of the initial neural network. Furthermore, it determines whether the candidate subnets obtained after pruning include the target subnet in each cycle, thus avoiding over-pruning and balancing the pruning rate and the performance of the pruned neural network. Moreover, it evaluates the performance of the candidate subnets based on performance evaluation metrics associated with the target hardware platform, improving the accuracy of performance evaluation. In some application scenarios, if the performance evaluation metrics include speed and power consumption, it can also obtain estimated values of the candidate subnets based on speed evaluation networks and power consumption evaluation networks, thereby reducing the time spent on performance evaluation and improving the efficiency of performance evaluation.
[0127] Based on the above embodiments, the target subnet can also be run on the target hardware platform to process the input data. Specifically, this includes processing the input data on the target hardware platform through the target subnet, wherein the input data includes one or more combinations of multimedia data, audio data, video data, and image data.
[0128] In this embodiment, the application scenarios of the target subnet include, but are not limited to, any one of video processing, speech recognition, and image recognition and understanding. The target subnet, determined by filtering candidate subnets obtained through pruning based on estimated values on the target hardware platform, is well-suited for data processing of input data on that target hardware platform. Understandably, different application scenarios have corresponding input data, which includes one or more combinations of multimedia data, audio data, video data, and image data.
[0129] Figure 4 This is a schematic diagram of a neural network pruning processing device provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware and is generally integrated into an electronic device.
[0130] like Figure 4 As shown, the device includes:
[0131] The acquisition module 401 is used to prune the initial neural network according to the preset pruning and compression index to obtain multiple candidate subnetworks;
[0132] The prediction module 402 is used to predict the estimated value of each candidate subnet running on the target hardware platform based on preset performance evaluation indicators.
[0133] The filtering module 403 is used to filter the target subnet from the plurality of candidate subnets according to the estimated value, wherein the estimated value of the target subnet running on the target hardware platform matches a pre-configured target value range corresponding to the performance evaluation index.
[0134] In one optional implementation, the preset pruning compression index includes:
[0135] The pruning calculation reduction index, or the pruning parameter reduction index.
[0136] In one optional implementation, the acquisition module 401 includes:
[0137] The first acquisition unit is used to acquire the pruning compression index of the current period based on the preset initial pruning rate and the pruning growth rate of the current period.
[0138] The second acquisition unit is used to prune at least one convolutional layer in the initial neural network according to the pruning and compression index of the current period, and acquire the plurality of candidate subnetworks.
[0139] In one optional implementation, the second acquisition unit is configured to:
[0140] Based on the pruning compression index of the current period and the parameter configuration of each convolutional layer in the initial neural network, calculate the set of pruning units corresponding to each convolutional layer, wherein the set of pruning units corresponding to each convolutional layer satisfies the pruning compression index of the current period.
[0141] Based on the set of pruning units corresponding to each convolutional layer, each convolutional layer in the initial neural network is pruned individually to obtain multiple candidate subnetworks, wherein the number of multiple candidate subnetworks is the same as the number of convolutional layers in the initial neural network.
[0142] In one optional implementation, the preset performance evaluation metrics include:
[0143] A performance evaluation metric can be one of speed, latency, power consumption, or memory usage, or a combination of multiple performance evaluation metrics.
[0144] In one optional implementation, the prediction module 402 is configured to:
[0145] Each candidate subnet is encoded using a speed evaluation network to obtain the running speed of each candidate subnet on the target hardware platform. The speed evaluation network is trained and generated based on a sample network and a dataset of corresponding speeds on the target hardware platform.
[0146] In one optional implementation, the prediction module 402 is configured to:
[0147] Each candidate subnet is encoded according to the power consumption evaluation network to obtain the operating power consumption of each candidate subnet on the target hardware platform. The power consumption evaluation network is trained and generated based on the sample network and corresponding power consumption dataset of the target hardware platform.
[0148] In one optional implementation, the filtering module 403 includes:
[0149] The first filtering unit is used to compare the estimated value with the target value range. If there is at least one estimated value that meets the target value range, then at least one target candidate subnet that meets the target value range is filtered from the plurality of candidate subnets.
[0150] The second filtering unit is used to filter the target subnet based on the at least one target candidate subnet.
[0151] In an optional implementation, when there are multiple target candidate subnets, the second filtering unit is used to:
[0152] The target performance evaluation index is determined from a set of pre-defined performance evaluation indicators.
[0153] Compare the estimated values corresponding to the target performance evaluation index in each of the target candidate subnets;
[0154] Based on the comparison results, the target candidate subnet with the highest estimated value is selected as the target subnet.
[0155] In an optional implementation, when there are multiple target candidate subnets, the second filtering unit is used to:
[0156] Predict the operating accuracy of each of the target candidate subnets on the target hardware platform;
[0157] The running accuracy of each of the target candidate subnets on the target hardware platform is compared, and the target candidate subnet with the highest running accuracy is selected as the target subnet.
[0158] In an optional implementation, the first filtering unit is further configured to:
[0159] If none of the estimated values meet the target value range, then predict the running accuracy of each candidate subnet on the target hardware platform;
[0160] The running accuracy of each candidate subnet on the target hardware platform is compared, and the candidate subnet with the highest running accuracy is selected as the initial neural network for the next cycle.
[0161] The initial neural network for the next cycle is pruned according to the preset pruning growth rate for the next cycle to obtain the multiple candidate subnetworks.
[0162] In one optional embodiment, the apparatus further includes:
[0163] The data processing module is used to process input data on the target hardware platform through the target subnet, wherein the input data includes one or more combinations of multimedia data, audio data, video data, and image data.
[0164] The neural network pruning processing apparatus provided in this disclosure can execute the neural network pruning processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.
[0165] In addition to the methods and apparatus described above, this disclosure also provides a computer-readable storage medium storing instructions that, when executed on a terminal device, cause the terminal device to implement the neural network pruning method described in this disclosure.
[0166] This disclosure also provides a computer program product, which includes a computer program / instructions that, when executed by a processor, implement the neural network pruning method described in this disclosure.
[0167] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.
[0168] The following is a detailed reference. Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device 500 in the embodiments of this disclosure. The electronic device 500 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0169] like Figure 5 As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0170] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0171] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the neural network pruning method of embodiments of this disclosure.
[0172] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0173] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0174] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0175] The aforementioned computer-readable medium carries one or more programs. When these programs are executed by the electronic device, the electronic device: predicts the estimated value of each candidate subnet running on the target hardware platform according to preset performance evaluation indicators; and filters the target subnet from the multiple candidate subnets based on the estimated values, wherein the estimated value of the target subnet running on the target hardware platform matches a pre-configured target value range corresponding to the performance evaluation indicators. Therefore, this embodiment of the present disclosure evaluates the performance of multiple pruned candidate subnets using pre-configured performance evaluation indicators associated with the target hardware platform, thereby finding the target subnet whose running performance on the target hardware platform meets preset requirements. Compared to the prior art's method of evaluating candidate subnet performance through computational load, this application accurately filters out target subnets that are more adapted to the characteristics of the hardware platform for data processing using direct hardware evaluation indicators, thereby further improving network operating performance and data processing efficiency.
[0176] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0177] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0178] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0179] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0180] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0181] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0182] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0183] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for pruning neural networks, characterized in that, include: The initial neural network is pruned according to the preset pruning and compression index to obtain multiple candidate subnetworks; Predict the estimated values of each candidate subnet on the target hardware platform based on preset performance evaluation indicators; The target subnet is selected from the plurality of candidate subnets based on the estimated values, wherein the estimated values of the target subnet running on the target hardware platform match a pre-configured target value range corresponding to the performance evaluation index. The input data is processed on the target hardware platform through the target subnet, wherein the input data includes one or more combinations of multimedia data, audio data, video data, and image data; The step of pruning the initial neural network according to a preset pruning and compression index to obtain multiple candidate subnetworks includes: Based on the preset initial pruning rate and the pruning growth rate of the current period, obtain the pruning compression index of the current period; Pruning is performed on at least one convolutional layer in the initial neural network according to the pruning compression index of the current period to obtain the plurality of candidate subnetworks.
2. The method according to claim 1, characterized in that, The preset pruning compression index includes: The pruning calculation reduction index, or the pruning parameter reduction index.
3. The method according to claim 1, characterized in that, The step of pruning at least one convolutional layer in the initial neural network according to the pruning compression index of the current period to obtain multiple candidate subnetworks includes: Based on the pruning compression index of the current period and the parameter configuration of each convolutional layer in the initial neural network, calculate the set of pruning units corresponding to each convolutional layer, wherein the set of pruning units corresponding to each convolutional layer satisfies the pruning compression index of the current period. Based on the set of pruning units corresponding to each convolutional layer, each convolutional layer in the initial neural network is pruned individually to obtain multiple candidate subnetworks, wherein the number of multiple candidate subnetworks is the same as the number of convolutional layers in the initial neural network.
4. The method according to claim 1, characterized in that, The preset performance evaluation indicators include: A performance evaluation metric can be one of speed, latency, power consumption, or memory usage, or a combination of multiple performance evaluation metrics.
5. The method according to claim 1, characterized in that, The step of predicting the estimated values of each candidate subnet on the target hardware platform based on preset performance evaluation indicators includes: Each candidate subnet is encoded using a speed evaluation network to obtain the running speed of each candidate subnet on the target hardware platform. The speed evaluation network is trained and generated based on a sample network and a dataset of corresponding speeds on the target hardware platform.
6. The method according to claim 1, characterized in that, The step of predicting the estimated values of each candidate subnet on the target hardware platform based on preset performance evaluation indicators includes: Each candidate subnet is encoded according to the power consumption evaluation network to obtain the operating power consumption of each candidate subnet on the target hardware platform. The power consumption evaluation network is trained and generated based on the sample network and corresponding power consumption dataset of the target hardware platform.
7. The method according to claim 1, characterized in that, The step of filtering the target subnet from the plurality of candidate subnets based on the estimated value includes: The estimated value is compared with the target value range. If there is at least one estimated value that meets the target value range, then at least one target candidate subnet that meets the target value range is selected from the plurality of candidate subnets. The target subnet is selected based on the at least one target candidate subnet.
8. The method according to claim 7, characterized in that, When there are multiple target candidate subnets, the step of filtering the target subnet based on the at least one target candidate subnet includes: The target performance evaluation index is determined from a set of pre-defined performance evaluation indicators. Compare the estimated values corresponding to the target performance evaluation index in each of the target candidate subnets; Based on the comparison results, the target candidate subnet with the highest estimated value is selected as the target subnet.
9. The method according to claim 7, characterized in that, When there are multiple target candidate subnets, the step of filtering the target subnet based on the at least one target candidate subnet includes: Predict the operating accuracy of each of the target candidate subnets on the target hardware platform; The running accuracy of each of the target candidate subnets on the target hardware platform is compared, and the target candidate subnet with the highest running accuracy is selected as the target subnet.
10. The method according to claim 7, characterized in that, After comparing the estimated value with the target value range, the method further includes: If none of the estimated values meet the target value range, then predict the running accuracy of each candidate subnet on the target hardware platform; The running accuracy of each candidate subnet on the target hardware platform is compared, and the candidate subnet with the highest running accuracy is selected as the initial neural network for the next cycle. The initial neural network for the next cycle is pruned according to the preset pruning growth rate for the next cycle to obtain the multiple candidate subnetworks.
11. A pruning device for a neural network, characterized in that, The device includes: The acquisition module is used to prune the initial neural network according to the preset pruning and compression index to obtain multiple candidate subnetworks; The prediction module is used to predict the estimated values of each candidate subnet running on the target hardware platform based on preset performance evaluation indicators. A filtering module is used to filter a target subnet from the plurality of candidate subnets according to the estimated value, wherein the estimated value of the target subnet running on the target hardware platform matches a pre-configured target value range corresponding to the performance evaluation index. A data processing module is used to process input data on the target hardware platform through the target subnet, wherein the input data includes one or more combinations of multimedia data, audio data, video data, and image data; The acquisition module includes: The first acquisition unit is used to acquire the pruning compression index of the current period based on the preset initial pruning rate and the pruning growth rate of the current period. The second acquisition unit is used to prune at least one convolutional layer in the initial neural network according to the pruning and compression index of the current period, and acquire the plurality of candidate subnetworks.
12. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method of any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for performing the method described in any one of claims 1-10.
14. A computer program product, characterized in that, The computer program product includes a computer program / instruction that, when executed by a processor, implements the method as described in any one of claims 1-10.