Model dynamic compression method and system based on MeanShift clustering and SVD decomposition algorithm, electronic equipment and storage medium

By employing a dynamic compression method combining MeanShift clustering and SVD decomposition algorithms, the problem of deploying convolutional neural network models on computationally limited devices is solved, achieving consistency in model size reduction and performance maintenance, and adapting to the needs of different hardware platforms.

CN121638360APending Publication Date: 2026-03-10QIANJIBIAN (HANGZHOU) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing convolutional neural network models are difficult to deploy effectively on hardware devices with limited computing resources due to their large number of parameters and computational complexity. Furthermore, existing dynamic pruning methods often result in significant loss of model performance and accuracy.

Method used

A dynamic compression method combining MeanShift clustering and SVD decomposition algorithms is adopted, including sparse training, MeanShift clustering, fine-tuning training, and SVD decomposition pruning. The model parameters are gradually adjusted to meet hardware requirements while maintaining model performance.

Benefits of technology

It effectively reduces model size, enabling deployment on devices with limited memory, while ensuring that the performance of the pruned model is similar to that of the original model, thus adapting to the needs of different hardware platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121638360A_ABST
    Figure CN121638360A_ABST
Patent Text Reader

Abstract

The invention discloses a model dynamic compression method and system based on a Mean Shift clustering and SVD decomposition algorithm, electronic equipment and a storage medium. The method comprises the steps that S1, a convolutional neural network model subjected to sparse training is acquired; s2, performing clustering and pruning on the convolutional neural network model after the sparse training by using a Mean Shift clustering algorithm; s3, carrying out Finning training on the convolutional neural network model after clustering and pruning; s4, pruning operation is carried out on the convolutional neural network model after finishing the Finishing training based on an SVD decomposition algorithm; s5, after pruning operation is completed, whether the parameters meet the threshold value requirement or not is judged till a final model is output. After the dynamic clipping scheme is added, the three problems which are originally left can be effectively solved: 1, the size of the model is effectively reduced, so that the model can be deployed in equipment with a relatively small memory; 2, the model parameters can be effectively cut according to the requirements of a hardware deployment platform; and 3, for the pruned model, the performance similar to that of the original model can be effectively ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of neural network models, in particular to a model dynamic compression method and system based on MeanShift clustering and SVD decomposition algorithm, electronic equipment and storage medium. BACKGROUND

[0002] With the increasing innovation and rapid development of Internet technology, it is more and more common to analyze and process image or video data through machine vision algorithms. Among numerous algorithms, the deep learning convolutional neural network method has the advantage of higher accuracy, making it more popular among current researchers. However, due to the large number of parameters and large amount of calculation of the convolutional neural network model, the hardware and computing cost of model deployment is very high, which leads to the fact that it cannot be well applied in some hardware devices with relatively limited computing resources. Most of the current model pruning methods can only be compressed once, resulting in a large number of model parameters and calculation, which still cannot fundamentally solve the problem. In addition, some dynamic pruning methods also effectively reduce the number of model parameters, but the model performance accuracy loss is also large, which makes it cannot be well applied. Therefore, a method is needed to make the convolutional neural network model can be pruned through dynamic compression method, and the performance of the compressed model will not be greatly affected, so that it can be better applied in computing resource limited devices. SUMMARY

[0003] The purpose of the present application is to provide a model dynamic compression method, system, electronic equipment and storage medium based on MeanShift clustering and SVD decomposition algorithm, to solve one or more technical problems existing in the prior art, and at least provide a beneficial choice or create conditions.

[0004] The present application adopts the following technical solutions to achieve the above-mentioned purposes:

[0005] The present application provides a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm, comprising:

[0006] S1, obtaining a convolutional neural network model, and performing sparse training on the convolutional neural network model;

[0007] S2, using MeanShift clustering algorithm to cluster and prune the convolutional neural network model after sparse training;

[0008] S3, performing Finetuning training on the convolutional neural network model after clustering and pruning;

[0009] S4, Pruning operation is performed on the convolutional neural network model that has completed fine-tuning training based on the SVD decomposition algorithm;

[0010] S5, calculate the total number of parameters in the convolutional neural network model after pruning, and determine whether the total number of parameters meets the threshold requirement:

[0011] If the conditions are met, fine-tuning training is performed again and the final model is output.

[0012] If the requirements are not met, obtain the pruned convolutional neural network model and repeat S1-S4 until the total number of parameters meets the requirements to output the final model.

[0013] Furthermore, methods for sparse training of convolutional neural network models include:

[0014] A scale scaling factor is introduced in the Batch Normalization (BN) layer following each convolutional layer in the convolutional neural network model.

[0015] The weighted data of the BN layer following the convolutional layer is subjected to L1 regularization using the sign function, as shown in the following formula:

[0016]

[0017]

[0018] In the formula As one of the samples, This indicates the minimum number of samples to process at present. and These represent the sample mean and variance, respectively. It is a natural number. For a natural number that tends towards zero, It calculates the normalized sample. This corresponds to the network output result. and Let represent the scale and shift variables that the BN layer can train, respectively, so that the samples are normalized to arbitrary scales through a linear transformation. This represents the sparsity factor, used to control the scaling factor. The degree of sparsity, sign is a sign function of -1 and 1, if If the value is greater than 0, it is 1; if it is 0, it is 0; otherwise, it is -1.

[0019] Furthermore, methods for clustering and pruning sparsely trained convolutional neural network models using the MeanShift clustering algorithm include:

[0020] The convolutional neural network model trained with sparsification is selected as the input of the MeanShift model pruning module. The MeanShift model pruning module includes a BN layer weight extraction unit, a MeanShift clustering unit, a corresponding network layer index acquisition unit, a BN layer weight and bias deletion unit, a convolutional layer weight and bias deletion unit, a fully connected layer weight and bias deletion unit, and a model unit that generates the pruned network.

[0021] The weight extraction unit of the BN layer is used to extract and store the weights of each BN layer in the sparsely trained convolutional neural network model.

[0022] The MeanShift clustering unit is connected to the BN layer weight extraction unit, and the weights of each BN layer are clustered using the MeanShift clustering algorithm.

[0023] The corresponding network layer index unit is used to connect to the MeanShift clustering unit, the index of the network channel is stored, and the flag of whether the network channel has been pruned is recorded.

[0024] By deleting weights and biases of BN layers, convolutional layers, and fully connected layers, the weights and biases of the channels containing the pruning flags in the BN, convolutional, and fully connected layers are pruned according to the index flags of the MeanShift clustering units.

[0025] The pruned network weights are re-integrated using the generated model units. The weights of the pruned network, after removing the weights and bias units of BN layers, convolutional layers, and fully connected layers, are then stored together with the network structure file to obtain the model pruned by MeanShift clustering.

[0026] Furthermore, a method for pruning a convolutional neural network model that has completed fine-tuning training based on the SVD decomposition algorithm includes:

[0027] Pruning operations are performed based on an SVD decomposition model module, which includes an input module, a convolutional layer module, and an SVD decomposition module. Modules, intermediate output modules, Ts modules, and output modules;

[0028] If the size of input module B is ;

[0029] For already trained convolutional layer modules Perform SVD decomposition, decompose into and The formula is as follows:

[0030]

[0031]

[0032]

[0033]

[0034] In the formula A is a real symmetric matrix, and Q is an orthonormal matrix, i.e. I is the identity matrix. It is a diagonal matrix. and These are the left and right singular matrices of the real symmetric matrix B, respectively.

[0035] The input module is passed The module performs a convolution operation to obtain an intermediate output module with a size of [size missing]. ;

[0036] Use the intermediate output module as The input to the module is further subjected to convolution operations to obtain the final output module, which has a size of [size missing]. .

[0037] Furthermore, methods for calculating the total number of parameters in a convolutional neural network model after pruning include:

[0038] Iterate through the convolutional layers, batch normalization (BN) layers, and fully connected layers in the convolutional neural network model, accumulating the total number of trainable parameters for each layer. The formula is:

[0039]

[0040] in, Indicates the first The number of parameters in the layer;

[0041] For convolutional layers, the number of parameters is the sum of the weight parameters and the bias parameters:

[0042]

[0043] in, Input the number of channels. , The width and height of the convolution kernel. Number of output channels;

[0044] For a Batch Normalization (BN) layer, the number of parameters is a trainable scaling factor. and displacement factor sum:

[0045]

[0046] in, This represents the number of channels corresponding to this BN layer;

[0047] For a fully connected layer, the number of parameters is the sum of the weight parameters and the bias parameters:

[0048]

[0049] in, For input dimensions, For output dimensions.

[0050] Furthermore, methods for determining whether the total number of parameters meets the threshold requirement include:

[0051] The threshold requirement Set a preset upper limit for the number of parameters, based on the memory limitations or target compression ratio of the hardware deployment platform.

[0052] The formula for determining whether the total number of parameters meets the threshold requirement is:

[0053] .

[0054] This application provides a model dynamic compression system based on MeanShift clustering and SVD decomposition algorithms, including:

[0055] The acquisition unit is used to acquire the convolutional neural network model and perform sparsified training on the convolutional neural network model.

[0056] Clustering and pruning units are used to cluster and prune sparsely trained convolutional neural network models using the MeanShift clustering algorithm;

[0057] The training unit is used to fine-tun the clustered and pruned convolutional neural network model.

[0058] The pruning unit is used to prune the convolutional neural network model that has completed fine-tuning training based on the SVD decomposition algorithm. The output judgment unit is used to calculate the total number of parameters of the convolutional neural network model after pruning, and determine whether the total number of parameters meets the threshold requirement. If it does, fine-tuning training is performed again and the final model is output. If it does not meet the threshold requirement, the pruned convolutional neural network model is obtained, and the acquisition unit, clustering and pruning unit, training unit and pruning unit are reused until the parameters meet the threshold requirement and the final model is output.

[0059] This application provides an electronic device, including a memory and a processor;

[0060] The memory is used to store instructions;

[0061] The processor is configured to operate according to the instructions to perform the steps according to the method described above.

[0062] This application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0063] The beneficial effects of this application are as follows:

[0064] This application integrates the MeanShift clustering algorithm and the SVD decomposition algorithm into dynamic model pruning. It utilizes sparsity training to prune convolutional network channel parameters that have little impact on model performance, and then uses fine-tuning to train the pruned model to ensure its accuracy. Adding this dynamic model pruning scheme effectively solves three previously existing problems: 1. It effectively reduces the model size, allowing deployment on devices with limited memory; 2. It allows for effective pruning of model parameters according to the hardware deployment platform requirements; 3. It effectively maintains performance similar to the original model for the pruned model. Attached Figure Description

[0065] Figure 1 This is a flowchart of a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm provided according to an embodiment of this application;

[0066] Figure 2 This is a flowchart of a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm provided according to an embodiment of this application;

[0067] Figure 3 This is a flowchart of the MeanShift model pruning module in a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm provided in an embodiment of this application;

[0068] Figure 4 This is a flowchart of the SVD decomposition model module in a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm provided in an embodiment of this application. Detailed Implementation

[0069] The model dynamic compression method, system, electronic device, and storage medium based on MeanShift clustering and SVD decomposition algorithms provided in this application, on the one hand, involve algorithms such as sparse training algorithm, MeanShift clustering algorithm, and SVD algorithm in the dynamic convolutional neural network model pruning algorithm of this invention. The algorithm of this invention can effectively reduce the size of the model while maintaining similar performance to the original model, so that the model can be deployed on devices with small memory. This is of great significance for the better application of convolutional neural network models on devices with limited computing resources.

[0070] like Figures 1-4 As shown, this application provides a model dynamic compression method based on MeanShift clustering and SVD decomposition algorithms, which specifically includes the following steps:

[0071] S1: Obtain the convolutional neural network model and perform sparse training on the convolutional neural network model.

[0072] Specifically, S1 includes:

[0073] The model sparse training module introduces a scale factor into the BN layer (Batch Normalization, a technique used to accelerate neural network training, stabilize the training process, and improve model generalization ability) after the convolutional layer for sparse training, and selects the best-performing model as the input to the MeanShift model pruning module.

[0074] A scaling factor is introduced in the Batch Normalization (BN) layer after each convolutional layer in the convolutional neural network. This is achieved by applying L1 regularization to the weight data of the BN layer after the convolutional layer using the sign function. The conventional BN layer implementation is shown in equations (1) and (2). Sparsity is achieved by optimizing the weights in equation (2) using equation (3).

[0075] (1)

[0076] (2)

[0077] (3)

[0078] In the above formula (1) As one of the samples, This indicates the minimum number of samples that need to be processed. and These represent the sample mean and variance, respectively. It is a natural number. Let be a natural number approaching zero. In formula (2) and Let represent the trainable scale and shift variables of the BN layer, respectively. The purpose is to normalize the samples to any scale through a linear transformation. Equation (3) introduces L1 regularization, where ... This represents the sparsity factor, which is used to control the scaling factor. The degree of sparsity, sign is a sign function of -1 and 1, if If the value is greater than 0, it is 1; if it is 0, it is 0; otherwise, it is -1.

[0079] S2 uses the MeanShift clustering algorithm to cluster and prune the sparsely trained convolutional neural network model.

[0080] Specifically, S2 above includes:

[0081] The MeanShift model pruning module primarily uses the MeanShift clustering algorithm to cluster the weights of the sparsely trained BN layers, pruning the network channels corresponding to the clusters with the smallest values. The MeanShift module includes a BN layer weight extraction unit, a MeanShift clustering unit, a unit for obtaining the corresponding network layer index, a unit for deleting BN layer weights and biases, a unit for deleting convolutional layer weights and biases, a unit for deleting fully connected layer weights and biases, and a unit for generating the pruned network model.

[0082] The weight extraction unit of the BN layer mainly processes the sparsely trained network model, and extracts and stores the weights of each BN layer separately after traversing the sparsely trained model.

[0083] The MeanShift clustering unit is connected to the BN layer weight extraction unit, and the MeanShift clustering algorithm is used to cluster the weights of each BN layer. Specifically, it iterates through all BN layers in the model, extracts the scale factor γ of each BN layer to form a set of weight vectors, and applies the MeanShift clustering algorithm to the γ vector of each BN layer. This algorithm is a non-parametric clustering algorithm, and the clustering granularity is controlled by setting the bandwidth parameter. The algorithm iteratively calculates the mean offset vector of each data point, moving it to a region with higher density, and finally converges to the mode. To prevent excessive pruning of model weights, which could lead to difficulty in converging during fine-tuning training, this application uses the minimum number of classes as the pruning threshold to ensure that large channels of network weights are preserved.

[0084] Obtain the corresponding network layer index unit and connect it to the MeanShift clustering unit. Its purpose is to store the index of the network channel and record the flag of whether the network channel has been pruned.

[0085] The weights and biases of the BN layer, convolutional layer, and fully connected layer are deleted based on the index of the MeanShift clustering unit. The weights and biases of the channels where the pruning flag is located in the BN layer, convolutional layer, and fully connected layer are pruned respectively. Based on the pruning index, the weights and biases of the relevant channels in the BN layer, the corresponding convolutional layer, and the fully connected layer (if they exist) are deleted simultaneously.

[0086] In generating the model units of the pruned network, the main process involves re-integrating the network weights after removing the weights and bias units of BN layers, convolutional layers, and fully connected layers. This re-integrates the pruned weight matrix, adjusts the network structure configuration file, generates a temporary pruned model, and then stores it in a unified manner with the network structure file, thus obtaining the model pruned by MeanShift clustering.

[0087] S3 performs fine-tuning training on the clustered and pruned convolutional neural network model.

[0088] Specifically, S3 includes:

[0089] Finetuning is a method of retraining a pre-trained model to improve its performance. Typically, pruning results in a loss of accuracy, which finetuning mitigates. Specifically, finetuning retrains a MeanShift-pruned model on the original training dataset (or a task-specific dataset). A smaller learning rate is used to recover the accuracy loss caused by pruning. The finetuning process allows the model weights to readjust to the new network structure, effectively improving model performance and ensuring high accuracy.

[0090] S4. Pruning operation is performed on the convolutional neural network model that has completed fine-tuning training based on the SVD decomposition algorithm.

[0091] In S4 above, SVD stands for Singular Value Decomposition. The SVD decomposition model module is a matrix decomposition method that decomposes a matrix into the product of three special matrices, breaking down complex matrices into simpler parts for easier further analysis and processing. The decomposed model is then evaluated by calculating the number of parameters to determine if it meets hardware or user requirements. If it does, the model is output; otherwise, the process repeats through the model sparsification module, MeanShift model pruning module, Finetuning training module, and SVD decomposition model module until the hardware or user requirements are met.

[0092] The SVD decomposition model module includes an input module, a convolutional layer module, and an SVD decomposition module. The module consists of an intermediate output module, a Ts module, and an output module. The following is a detailed description of each unit of the SVD decomposition model module.

[0093] Assume the size of input module B is B is a symmetric matrix of the same size as the input module A, for a pre-trained convolutional layer module. SVD decomposition can be performed using the following formulas (4) to (7), resulting in the following decomposition: and

[0094] (4)

[0095] (5)

[0096] (6)

[0097] (7)

[0098] Where A is a real symmetric matrix, and Q is an orthonormal matrix, i.e. I is the identity matrix. It is a diagonal matrix. and These are the left and right singular matrices of the real symmetric matrix B, respectively. In order to solve... and We only need to perform eigenvalue decomposition on formulas 4, 6, and 7 respectively. Then, the input module will be processed... The module performs a convolution operation to obtain an intermediate output module with a size of [size missing]. Finally, the intermediate output module is used as The input of the module is further subjected to convolution operations to obtain the final output module, which has a size of [missing value]. .

[0099] S5, calculate the total number of parameters in the convolutional neural network model after pruning, and determine whether the total number of parameters meets the threshold requirement:

[0100] If the conditions are met, fine-tuning training is performed again and the final model is output.

[0101] If the requirements are not met, obtain the pruned convolutional neural network model and repeat S1-S4 until the total number of parameters meets the requirements to output the final model.

[0102] In S5 above, the total number of parameters of the convolutional neural network model after the SVD decomposition and pruning operation is calculated. And determine whether it meets the preset threshold requirements. .

[0103] The total number of parameters The calculation method is as follows: traverse all layers in the model, including convolutional layers, batch normalization (BN) layers, and fully connected layers, and accumulate the number of trainable parameters for each layer. The calculation formula is:

[0104]

[0105] in, Indicates the first The number of parameters for a layer is calculated as follows:

[0106] For convolutional layers, the number of parameters is the sum of the weight parameters and the bias parameters:

[0107]

[0108] in, Input the number of channels. , The width and height of the convolution kernel. This represents the number of output channels.

[0109] For a Batch Normalization (BN) layer, the number of parameters is a trainable scaling factor. and displacement factor sum:

[0110]

[0111] in, This represents the number of channels corresponding to this BN layer.

[0112] For a fully connected layer, the number of parameters is the sum of the weight parameters and the bias parameters:

[0113]

[0114] in, For input dimensions, For output dimensions.

[0115] The threshold requirement This is a preset upper limit for the number of parameters, set based on the memory limitations or target compression ratio of the hardware deployment platform. The formula for determining whether the total number of parameters meets the threshold requirement is:

[0116]

[0117] If the above judgment is satisfied, then the current model will undergo final fine-tuning training to restore model performance, and this model will be output as the final model after compression.

[0118] If the above condition is not met, the current pruned model is used as input, and the process returns to step S1. Steps S1 to S4 are repeated for the next round of sparsity training, MeanShift clustering pruning, Finetuning training, and SVD decomposition pruning, until the total number of parameters of the model is reduced. satisfy The requirements are met, and the final model is output after fine-tuning training.

[0119] This application integrates the MeanShift clustering algorithm and the SVD decomposition algorithm into dynamic model pruning. It utilizes sparsity training to prune convolutional network channel parameters that have little impact on model performance, and then uses fine-tuning training on the pruned model to ensure model accuracy. Existing model compression methods, such as one-time pruning or weight quantization, while reducing some parameters, often lead to a significant decrease in model accuracy or an inability to flexibly adapt to different hardware constraints. Furthermore, single compression methods struggle to achieve a good balance between compression ratio and model performance. Therefore, a dynamic, progressive compression method is urgently needed that can significantly reduce model size while maintaining performance similar to the original model. Adding a dynamic model pruning scheme effectively solves three previously existing problems: 1. It effectively reduces the model size, allowing deployment on devices with limited memory; 2. It allows for effective pruning of model parameters according to the hardware deployment platform requirements; 3. It effectively ensures that the pruned model maintains performance similar to the original model.

[0120] This application provides a model dynamic compression system based on MeanShift clustering and SVD decomposition algorithms, including:

[0121] The acquisition unit is used to acquire the convolutional neural network model and perform sparsified training on the convolutional neural network model.

[0122] Clustering and pruning units are used to cluster and prune sparsely trained convolutional neural network models using the MeanShift clustering algorithm;

[0123] The training unit is used to fine-tun the clustered and pruned convolutional neural network model.

[0124] The pruning unit is used to perform pruning operations on the convolutional neural network model that has completed fine-tuning training based on the SVD decomposition algorithm.

[0125] The output unit is used to calculate the total number of parameters of the convolutional neural network model after pruning. It determines whether the total number of parameters meets the threshold requirement. If it does, fine-tuning training is performed again and the final model is output. If it does not meet the threshold requirement, the pruned convolutional neural network model is obtained. The acquisition unit, clustering and pruning unit, training unit and pruning operation unit are reused until the parameters meet the threshold requirement and the final model is output.

[0126] The electronic device provided in this application may also include a memory and a processor; the memory is used to store instructions.

[0127] The processor is configured to operate according to the instructions to execute the steps of the aforementioned model dynamic compression method based on MeanShift clustering and SVD decomposition algorithms.

[0128] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the aforementioned model dynamic compression method based on MeanShift clustering and SVD decomposition algorithms.

[0129] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0133] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm, characterized in that, The method comprises the following steps: S1, obtaining a convolutional neural network model, and performing sparse training on the convolutional neural network model; S2, performing clustering and pruning on the convolutional neural network model after sparse training by using a MeanShift clustering algorithm; S3, performing Finetuning training on the convolutional neural network model after clustering and pruning; S4, performing pruning operation on the convolutional neural network model after Finetuning training based on an SVD decomposition algorithm; S5, calculating the total parameter quantity of the convolutional neural network model after the pruning operation, and determining whether the total parameter quantity meets the threshold requirement: If yes, performing Finetuning training again and outputting a final model; If no, obtaining the convolutional neural network model after the pruning operation, and repeating S1-S4 until the total parameter quantity meets the requirement to output the final model.

2. The model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm of claim 1, wherein, The method for performing sparse training on the convolutional neural network model comprises the following steps: Introducing a scale factor to the BN layer after each convolutional layer of the convolutional neural network model; Performing L1 regularization processing on the BN layer weight data after the convolutional layer by weighting the sign function, and the formula is as follows: In the formula As one of the samples, This indicates the minimum number of samples to process at present. and These represent the sample mean and variance, respectively. It is a natural number. For a natural number that tends towards zero, It calculates the normalized sample. This corresponds to the network output result. and Let represent the scale and shift variables that the BN layer can train, respectively, so that the samples are normalized to arbitrary scales through a linear transformation. This represents the sparsity factor, used to control the scaling factor. The degree of sparsity, sign is a sign function of -1 and 1, if If the value is greater than 0, it is 1; if it is 0, it is 0; otherwise, it is -1.

3. The model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm of claim 1, wherein, The method for performing clustering and pruning on the convolutional neural network model after sparse training by using the MeanShift clustering algorithm comprises the following steps: Selecting the convolutional neural network model after sparse training as the input of a MeanShift model pruning module, wherein the MeanShift model pruning module comprises a BN layer weight extraction unit, a MeanShift clustering unit, an obtaining corresponding network layer index unit, a deleting BN layer weight and bias unit, a deleting convolutional layer weight and bias unit, a deleting fully connected layer weight and bias unit, and a generating pruned network model unit; Using the BN layer weight extraction unit to extract and store each BN layer weight of the convolutional neural network model after sparse training respectively; Connecting the MeanShift clustering unit to the BN layer weight extraction unit, and performing clustering on the weight of each BN layer by using the MeanShift clustering algorithm; Using the obtaining corresponding network layer index unit to connect to the MeanShift clustering unit, store the index of the network channel, and record the flag of whether the network channel is pruned; Using the deleting BN layer weight and bias unit, the deleting convolutional layer weight and bias unit, and the deleting fully connected layer weight and bias unit to respectively prune the weight and bias of the channel with the pruning flag in the BN layer, the convolutional layer and the fully connected layer according to the index flag of the MeanShift clustering unit; Using the generating pruned network model unit to re-integrate the network weight after pruning by the deleting BN layer weight and bias unit, the deleting convolutional layer weight and bias unit, and the deleting fully connected layer weight and bias unit, and uniformly store the re-integrated network weight with the network structure file to obtain the model pruned by the MeanShift clustering.

4. The model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm of claim 1, wherein, The method for performing pruning operation on the convolutional neural network model after Finetuning training based on the SVD decomposition algorithm comprises the following steps: performing pruning operation based on the SVD decomposition model module, the SVD decomposition model module comprising an input module, a convolutional layer module, an SVD decomposition module, a module, an intermediate output module and a Ts module and an output module; If the size of the input module B is ; For the already trained convolutional layer module SVD decomposition is performed to decompose into and The formula is as follows: wherein A is a real symmetric matrix, Q is an orthogonal matrix, i.e. I is an identity matrix, is a diagonal matrix, and are the left and right singular matrices of the real symmetric matrix B, respectively; The input module is convoluted by the module to obtain an intermediate output module with a size of ; The intermediate output module is taken as The input of the module continues the convolution operation, and the final output module size is .

5. The model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm of claim 1, wherein, The method for calculating the total parameter quantity of the convolutional neural network model after pruning operation comprises the following steps: Traverse the convolution layer, BN layer and fully connected layer in the convolutional neural network model, and accumulate the trainable total parameter quantity of each layer , the formula is: ; wherein, represents the number of parameters of the layer layer. For the convolutional layer, the parameter quantity is the sum of the weight parameter and the bias parameter: ; wherein, is the number of input channels, , is the width and height of the convolution kernel, is the number of output channels; For the BN layer, the number of parameters is the trainable scale factor and the shift factor sum: ; wherein, is the number of channels corresponding to the BN layer; For the fully connected layer, the parameter quantity is the sum of the weight parameter and the bias parameter: ; wherein, is the input dimension, is the output dimension.

6. The model dynamic compression method based on MeanShift clustering and SVD decomposition algorithm of claim 1, wherein, The method for judging whether the total parameter quantity meets the threshold requirement comprises the following steps: The threshold requirement is a preset parameter upper limit, which is set based on a memory limit of a hardware deployment platform or a target compression rate The judgment formula for judging whether the total parameter quantity meets the threshold requirement is: 。 7. A model dynamic compression system based on MeanShift clustering and SVD decomposition algorithm, characterized in that, The method comprises the following steps: The obtaining unit is used for obtaining the convolutional neural network model and performing sparse training on the convolutional neural network model; The clustering and pruning unit is used for performing clustering and pruning on the convolutional neural network model after sparse training by using the MeanShift clustering algorithm; The training unit is used for performing Finetuning training on the convolutional neural network model after clustering and pruning; The pruning operation unit is used for performing pruning operation on the convolutional neural network model after Finetuning training based on the SVD decomposition algorithm; The judgment output unit is used for calculating the total parameter quantity of the convolutional neural network model after pruning operation, judging whether the total parameter quantity meets the threshold requirement, if yes, performing Finetuning training again and outputting the final model, and if not, obtaining the convolutional neural network model after pruning operation, repeatedly using the obtaining unit, the clustering and pruning unit, the training unit and the pruning operation unit until the parameter meets the threshold requirement to output the final model.

8. An electronic device, comprising: It comprises a memory and a processor; The memory is used for storing instructions; The processor is used for operating according to the instructions to perform the steps of the method according to any one of claims 1-6.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the steps of the method according to any one of claims 1-6.