CN116011550A - A model pruning method, image processing method and related device - Google Patents
A model pruning method, image processing method and related device Download PDFInfo
- Publication number
- CN116011550A CN116011550A CN202211659437.7A CN202211659437A CN116011550A CN 116011550 A CN116011550 A CN 116011550A CN 202211659437 A CN202211659437 A CN 202211659437A CN 116011550 A CN116011550 A CN 116011550A
- Authority
- CN
- China
- Prior art keywords
- pruning
- model
- pruned
- target
- channel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明涉及模型压缩技术领域,尤其涉及一种模型剪枝方法、图像处理方法及相关装置。The invention relates to the technical field of model compression, in particular to a model pruning method, an image processing method and related devices.
背景技术Background technique
随着人工智能技术的发展,神经网络模型的应用也越来越广泛。考虑到网络模型的参数多、运算量大,为了提高模型的运算速度,需要对模型进行压缩。通过模型压缩,以达到减小模型尺寸,降低资源消耗并提升响应时间的目的。With the development of artificial intelligence technology, the application of neural network models is becoming more and more extensive. Considering that the network model has many parameters and a large amount of calculation, in order to improve the calculation speed of the model, it is necessary to compress the model. Through model compression, the purpose of reducing model size, reducing resource consumption and improving response time is achieved.
其中,模型剪枝是当前一种常见的模型压缩方法,该方法通过在训练完模型后,去掉网络模型中权重较小的参数,以实现对神经网络模型的压缩。当前模型剪枝分为迭代式剪枝和一次剪枝(one-shot剪枝),其中,迭代式剪枝在剪枝训练过程中每次剪枝后均需要经过微调(fine-tune)训练,从而导致训练耗时较多。因此,在迭代式剪枝中如何加快迭代式剪枝的训练过程是亟需解决的技术问题。Among them, model pruning is a common model compression method at present. This method achieves compression of the neural network model by removing parameters with smaller weights in the network model after the model is trained. The current model pruning is divided into iterative pruning and one-shot pruning. Among them, iterative pruning requires fine-tune training after each pruning in the pruning training process. This leads to more time-consuming training. Therefore, how to speed up the training process of iterative pruning in iterative pruning is a technical problem that needs to be solved urgently.
发明内容Contents of the invention
本发明提供一种模型剪枝方法、图像处理方法及相关装置,用以解决上述问题。The present invention provides a model pruning method, an image processing method and related devices to solve the above problems.
本发明提供一种模型剪枝方法,包括:The present invention provides a method for model pruning, comprising:
获取待剪枝模型以及其对应的剪枝目标;其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息;Obtaining the model to be pruned and its corresponding pruning target; wherein, the model to be pruned is obtained based on image data training, the pruning target includes pruning ratio information, and the pruning ratio information is used to represent the Information on the proportion of one-time pruning and iterative pruning in the model pruning process;
根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型;Performing a pruning on the model to be pruned according to the pruning target to obtain a first pruned model;
根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。Perform iterative pruning on the first pruned model according to the pruning target to obtain a second pruned model, and use the second pruned model as a target model.
根据本发明提供的一种模型剪枝方法,所述剪枝目标包括剪枝训练迭代总数;According to a model pruning method provided by the present invention, the pruning target includes the total number of pruning training iterations;
相应地,在根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型之后,该方法还包括:Correspondingly, after performing a pruning on the model to be pruned according to the pruning target to obtain the first pruned model, the method further includes:
按照第一微调次数对所述第一剪枝后模型进行微调训练,获得第一微调后模型;其中,所述第一微调次数根据所述剪枝配比信息中一次剪枝在模型剪枝过程中的占比信息以及剪枝训练迭代总数确定;Perform fine-tuning training on the first pruned model according to the first number of fine-tuning times to obtain the first fine-tuned model; wherein, the first number of fine-tuning times is based on the first pruning in the pruning ratio information in the model pruning process The proportion information in and the total number of pruning training iterations are determined;
所述根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,包括:The iterative pruning of the first pruned model according to the pruning target to obtain the second pruned model includes:
根据所述剪枝目标对所述第一微调后模型进行迭代剪枝,获得第二剪枝后模型。Iteratively pruning the first fine-tuned model according to the pruning target to obtain a second pruned model.
根据本发明提供的一种模型剪枝方法,所述剪枝目标还包括目标剪枝通道数;According to a model pruning method provided by the present invention, the pruning target further includes the number of target pruning channels;
相应地,所述根据所述剪枝目标对所述第一微调后模型进行迭代剪枝,获得第二剪枝后模型,包括:Correspondingly, performing iterative pruning on the first fine-tuned model according to the pruning target to obtain a second pruned model includes:
S1,对所述第一微调后模型中的一个通道进行剪枝,获得单通道剪枝后模型;S1, pruning a channel in the first fine-tuned model to obtain a single-channel pruned model;
S2,按照第二微调次数对单通道剪枝后模型进行微调训练,获得第二微调后模型;其中,所述第二微调次数根据剪枝配比信息中迭代剪枝在模型剪枝过程的占比信息、目标剪枝通道数以及剪枝训练迭代总数确定;S2. Perform fine-tuning training on the single-channel pruned model according to the second fine-tuning times to obtain the second fine-tuned model; wherein, the second fine-tuning times are based on the proportion of iterative pruning in the model pruning process in the pruning ratio information The ratio information, the number of target pruning channels and the total number of pruning training iterations are determined;
S3,在所述第二微调后模型的基础上重复执行S1-S2,直到达到预设的迭代次数,以获得最新的第二微调后模型,并将最新的第二微调后模型作为第二剪枝后模型;S3. Repeat S1-S2 on the basis of the second fine-tuned model until the preset number of iterations is reached, so as to obtain the latest second fine-tuned model, and use the latest second fine-tuned model as the second trimmed Branch model;
其中,所述预设的迭代次数根据迭代剪枝通道数确定,该迭代剪枝通道数根据所述目标剪枝通道数以及所述剪枝配比信息中迭代剪枝在模型剪枝过程中的占比信息计算得到。Wherein, the preset number of iterations is determined according to the number of iterative pruning channels, and the number of iterative pruning channels is based on the number of target pruning channels and the number of iterative pruning in the model pruning process in the pruning ratio information. The proportion information is calculated.
根据本发明提供的一种模型剪枝方法,所述第二微调次数根据剪枝配比信息中迭代剪枝在模型剪枝过程的占比信息、目标剪枝通道数以及剪枝训练迭代总数确定,包括:According to a model pruning method provided by the present invention, the second fine-tuning times are determined according to the proportion information of iterative pruning in the model pruning process in the pruning ratio information, the target number of pruning channels, and the total number of pruning training iterations ,include:
根据迭代剪枝在模型剪枝过程的占比信息以及剪枝训练迭代总数计算得到迭代剪枝微调训练总次数;According to the proportion information of iterative pruning in the model pruning process and the total number of pruning training iterations, the total number of iterative pruning fine-tuning training is calculated;
根据所述迭代剪枝微调训练总次数以及迭代剪枝通道数计算得到第二微调次数。The second fine-tuning times are calculated according to the total times of iterative pruning and fine-tuning training and the number of iterative pruning channels.
根据本发明提供的一种模型剪枝方法,所述剪枝目标还包括目标剪枝通道数;According to a model pruning method provided by the present invention, the pruning target further includes the number of target pruning channels;
相应地,所述根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型,包括:Correspondingly, performing a pruning on the model to be pruned according to the pruning target to obtain a first pruned model, including:
获取所述待剪枝模型中各个通道的第一范数,并按照所述第一范数的数值由小到大的顺序对待剪枝模型中各个通道进行排序,获得通道序列;Obtain the first norm of each channel in the model to be pruned, and sort the channels in the model to be pruned according to the value of the first norm from small to large, to obtain a channel sequence;
将所述通道序列中前p个通道作为第一待剪枝通道,其中,p根据所述目标剪枝通道数以及所述剪枝配比信息中一次剪枝在模型剪枝过程中的占比信息计算得到;Taking the first p channels in the channel sequence as the first channel to be pruned, where p is based on the number of target pruning channels and the proportion of one pruning in the model pruning process in the pruning ratio information The information is calculated;
根据所述第一待剪枝通道对所述待剪枝模型进行剪枝,获得第一剪枝后模型。Pruning the model to be pruned according to the first channel to be pruned to obtain a first pruned model.
根据本发明提供的一种模型剪枝方法,所述S1,对所述第一微调后模型中的一个通道进行剪枝,获得单通道剪枝后模型,包括:According to a model pruning method provided by the present invention, said S1 prunes a channel in the first fine-tuned model to obtain a single-channel pruned model, including:
获取所述第一微调后模型中各个通道的第二范数;Obtain the second norm of each channel in the first fine-tuned model;
将第二范数数值最小的通道作为第二待剪枝通道;Use the channel with the smallest value of the second norm as the second channel to be pruned;
根据所述第二待剪枝通道对所述第一微调后模型进行剪枝,获得单通道剪枝后模型。Pruning the first fine-tuned model according to the second channel to be pruned to obtain a single-channel pruned model.
本发明还提供一种图像处理方法,包括:The present invention also provides an image processing method, comprising:
获取待处理图像;Get the image to be processed;
将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果;Inputting the image to be processed into the trained image processing model, processing the image to be processed by the trained image processing model to obtain a processing result;
其中,所述训练好的图像处理模型为通过上述任一所述的模型剪枝方法得到。Wherein, the trained image processing model is obtained by any of the above-mentioned model pruning methods.
本发明还提供一种模型剪枝装置,包括:The present invention also provides a model pruning device, comprising:
模型与剪枝目标获取模块,用于获取待剪枝模型以及其对应的剪枝目标;其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息;The model and pruning target acquisition module is used to obtain the model to be pruned and its corresponding pruning target; wherein, the model to be pruned is obtained based on image data training, and the pruning target includes pruning ratio information, so The above pruning ratio information is used to represent the proportion information of one-time pruning and iterative pruning in the model pruning process;
一次剪枝模块,用于根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型;A pruning module, configured to perform one pruning on the model to be pruned according to the pruning target to obtain the first pruned model;
迭代剪枝模块,用于根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。An iterative pruning module, configured to perform iterative pruning on the first pruned model according to the pruning target to obtain a second pruned model, and use the second pruned model as a target model.
本发明还提供一种图像处理装置,包括:The present invention also provides an image processing device, comprising:
图像获取模块,用于获取待处理图像;An image acquisition module, configured to acquire images to be processed;
图像处理模块,用于将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果;其中,所述训练好的图像处理模型为通过如上述的模型剪枝装置得到。An image processing module, configured to input the image to be processed into a trained image processing model, and process the image to be processed through the trained image processing model to obtain a processing result; wherein, the trained The image processing model of is obtained by the model pruning device as described above.
本发明还提供一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时实现如上述任一种模型剪枝方法或图像处理方法。The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and operable on the processor. When the processor executes the program, any one of the above-mentioned model pruning methods or image processing methods is implemented.
本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现如上述任一种模型剪枝方法或图像处理方法。The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned model pruning methods or image processing methods is implemented.
本发明提供的模型剪枝方法、图像处理方法及相关装置,其中,模型剪枝方法,通过本发明中的一次剪枝和迭代式剪枝这两种方式能够加速训练过程,且相较于单独使用一次剪枝方法而言,提高了剪枝上限。The model pruning method, image processing method and related devices provided by the present invention, wherein, the model pruning method can accelerate the training process through the two methods of one-time pruning and iterative pruning in the present invention, and compared with a single For the one-time pruning method, the upper limit of pruning is increased.
附图说明Description of drawings
为了更清楚地说明本发明或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the present invention or the technical solutions in the prior art, the accompanying drawings that need to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings in the following description are the present invention. For some embodiments of the invention, those skilled in the art can also obtain other drawings based on these drawings without creative effort.
图1是本发明实施例提供的模型剪枝方法的流程示意图之一;Fig. 1 is one of the schematic flow charts of the model pruning method provided by the embodiment of the present invention;
图2是本发明实施例提供的模型剪枝方法的流程示意图之二;Fig. 2 is the second schematic flow diagram of the model pruning method provided by the embodiment of the present invention;
图3是本发明实施例提供的图像处理方法的流程示意图;FIG. 3 is a schematic flowchart of an image processing method provided by an embodiment of the present invention;
图4为本发明实施例提供的模型剪枝装置结构示意图;Fig. 4 is the structural representation of the model pruning device provided by the embodiment of the present invention;
图5是本发明实施例提供的图像处理装置的结构示意图;FIG. 5 is a schematic structural diagram of an image processing device provided by an embodiment of the present invention;
图6为本发明实施例提供的一种电子设备的实体结构示意图。FIG. 6 is a schematic diagram of a physical structure of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明中的附图,对本发明中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention , but not all examples. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
图1是本发明实施例提供的模型剪枝方法的流程示意图之一;图2是本发明实施例提供的模型剪枝方法的流程示意图之二;如图1以及图2所示,该模型剪枝方法,包括:Fig. 1 is one of the schematic flow diagrams of the model pruning method provided by the embodiment of the present invention; Fig. 2 is the second schematic flow diagram of the model pruning method provided by the embodiment of the present invention; as shown in Fig. 1 and Fig. 2, the model pruning Branch methods, including:
S101,获取待剪枝模型以及其对应的剪枝目标。S101. Obtain a model to be pruned and its corresponding pruning target.
其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息。Wherein, the model to be pruned is obtained based on image data training, and the pruning target includes pruning ratio information, and the pruning ratio information is used to represent the results of one-time pruning and iterative pruning in the model pruning process. percentage information.
在本步骤中,待剪枝模型为预训练模型,该预训练模型可以具体为卷积神经网络,且其基于训练图像及其对应的图像标签训练得到,用于进行图像处理。In this step, the model to be pruned is a pre-training model, and the pre-training model may specifically be a convolutional neural network, which is trained based on training images and corresponding image labels, and is used for image processing.
剪枝目标可以是预训练模型所要达到的体积大小,可以是整个预训练模型的剪枝率,或者具体到剪枝通道数,还可以包括剪枝训练总迭代次数。在本发明中,剪枝目标还可以包括用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例的剪枝配比信息,其用来配置一次剪枝与迭代剪枝两种剪枝方法各自在整个剪枝训练过程中所占的比例。The pruning target can be the size of the pre-trained model, the pruning rate of the entire pre-trained model, or the number of pruning channels, or the total number of iterations of pruning training. In the present invention, the pruning target may also include pruning ratio information used to characterize the proportion of primary pruning and iterative pruning in the model pruning process, which is used to configure two types of primary pruning and iterative pruning. The proportion of each pruning method in the whole pruning training process.
S102,根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型。S102. Perform one pruning on the model to be pruned according to the pruning target to obtain a first pruned model.
在本步骤中,根据剪枝目标(比如剪枝配比信息)采用一次剪枝方法对所述待剪枝模型进行剪枝(one-shot剪枝),将剪枝后的模型作为第一剪枝后模型。In this step, the one-shot pruning method is used to prune the model to be pruned (one-shot pruning) according to the pruning target (such as pruning ratio information), and the pruned model is used as the first pruning method. Branch model.
S103,根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。S103. Perform iterative pruning on the first pruned model according to the pruning target to obtain a second pruned model, and use the second pruned model as a target model.
在本步骤中,基于上述的第一剪枝后模型,并根据剪枝目标继续进行剪枝,采用迭代式剪枝方法对第一剪枝后模型剪枝,将剪枝后的模型作为第二剪枝后模型,该第二剪枝后模型即为最终输出的目标模型,用于图像处理。In this step, based on the above-mentioned first pruned model, pruning is continued according to the pruning target, the iterative pruning method is used to prune the first pruned model, and the pruned model is used as the second A pruned model, the second pruned model is a final output target model for image processing.
现有技术中,每次迭代式剪枝后均要进行微调训练(fine-tune训练),假设对待剪枝模型进行迭代式剪枝,且迭代次数为10,每次迭代式剪枝后微调训练次数为1000,则总共微调训练次数为10000;而如果对待剪枝模型进行一次剪枝,且设置微调训练次数为2000,则总共微调训练次数为2000。由上述举例可知,迭代式剪枝中的微调训练总次数相较于一次剪枝方法而言过多,导致剪枝训练过程耗时过长,而只使用一次剪枝方式进行剪枝,则剪枝模型的上限会受限。故而,本发明融合了一次剪枝与迭代式剪枝两种方法,举例来说,先进行了一次剪枝,在一次剪枝过程中,微调训练次数1000,在迭代式剪枝过程中,迭代次数为5,微调训练次数为1000,则整个剪枝过程中,微调训练总次数为1000+5*1000=6000。通过比较6000与10000可知,通过融合一次剪枝与迭代剪枝这两种剪枝方法能够大大减少微调训练次数,从而缩短训练时间。另外,相较于单纯使用一次剪枝方法而言,还能提升剪枝上限。In the prior art, fine-tune training (fine-tune training) is required after each iterative pruning. Assuming that the model to be pruned is iteratively pruned, and the number of iterations is 10, fine-tune training after each iterative pruning If the number of times is 1000, the total number of fine-tuning training is 10000; and if the model to be pruned is pruned once, and the number of fine-tuning training is set to 2000, the total number of fine-tuning training is 2000. From the above examples, it can be seen that the total number of fine-tuning training in iterative pruning is too much compared with the one-time pruning method, resulting in a long time-consuming pruning training process. The upper limit of the branch model will be limited. Therefore, the present invention combines two methods of one-time pruning and iterative pruning. For example, one-time pruning is performed first. In one pruning process, the number of times of fine-tuning training is 1000. The number of times is 5, the number of times of fine-tuning training is 1000, then the total number of times of fine-tuning training in the whole pruning process is 1000+5*1000=6000. By comparing 6000 and 10000, it can be seen that by combining the two pruning methods of one-time pruning and iterative pruning, the number of fine-tuning training can be greatly reduced, thereby shortening the training time. In addition, compared with simply using the one-time pruning method, the upper limit of pruning can also be increased.
本发明实施例提供的模型剪枝方法,通过本发明中的一次剪枝和迭代式剪枝这两种方式能够加速训练过程,且相较于单独使用一次剪枝方法而言,提高了剪枝上限。The model pruning method provided by the embodiment of the present invention can speed up the training process through the two methods of one-time pruning and iterative pruning in the present invention, and compared with the single-time pruning method, the pruning method is improved. upper limit.
在本发明的一些实施例中,所述剪枝目标包括剪枝配比信息以及剪枝训练迭代总数iters_all,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息,该剪枝配比信息更具体的为剪枝配比值,假设一次剪枝的占比为α(α∈[0,1]),则迭代剪枝的占比为1-α。In some embodiments of the present invention, the pruning target includes pruning ratio information and the total number of pruning training iterations iters_all, and the pruning ratio information is used to represent the difference between one pruning and iterative pruning Branch proportion information, the pruning ratio information is more specifically the pruning ratio value, assuming that the proportion of one pruning is α(α∈[0,1]), then the proportion of iterative pruning is 1- alpha.
相应地,在根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型之后,该方法还包括:Correspondingly, after performing a pruning on the model to be pruned according to the pruning target to obtain the first pruned model, the method further includes:
按照第一微调次数对所述第一剪枝后模型进行微调训练,获得第一微调后模型。Perform fine-tuning training on the first pruned model according to the first number of fine-tuning times to obtain the first fine-tuned model.
其中,所述第一微调次数根据所述剪枝配比信息中一次剪枝在模型剪枝过程中的占比信息以及剪枝训练迭代总数iters_all确定。具体地,若一次剪枝的占比为α,则第一微调次数iter1=0.8*α*iters_all,此处的0.8为设置的常数。Wherein, the first fine-tuning times are determined according to the proportion information of one pruning in the model pruning process in the pruning ratio information and the total number of pruning training iterations iters_all. Specifically, if the proportion of one pruning is α, the first fine-tuning times iter1=0.8*α*iters_all, where 0.8 is a set constant.
所述根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,包括:The iterative pruning of the first pruned model according to the pruning target to obtain the second pruned model includes:
根据所述剪枝目标对所述第一微调后模型进行迭代剪枝,获得第二剪枝后模型。即,在一次剪枝(one-shot)的基础上进行迭代式剪枝。Iteratively pruning the first fine-tuned model according to the pruning target to obtain a second pruned model. That is, iterative pruning is performed on the basis of one-shot pruning.
另外,为了进一步加速剪枝训练过程,一次剪枝的占比α根据经验值设置为0.8,对应的迭代式剪枝占比则为0.2,从而在保证剪枝效果的同时最大程度上加快剪枝训练过程。In addition, in order to further accelerate the pruning training process, the proportion α of one-time pruning is set to 0.8 according to the empirical value, and the corresponding proportion of iterative pruning is 0.2, so as to speed up the pruning to the greatest extent while ensuring the pruning effect training process.
本发明实施例提供的模型剪枝方法,通过按照一次剪枝在模型剪枝过程中的占比信息确定在一次剪枝之后,对第一剪枝后模型的微调训练次数,加快剪枝训练过程。The model pruning method provided by the embodiment of the present invention speeds up the pruning training process by determining the number of fine-tuning training times for the model after the first pruning according to the proportion information of one pruning in the model pruning process .
在本发明的一些实施例中,所述剪枝目标还包括目标剪枝通道数c_target。In some embodiments of the present invention, the pruning target further includes a target number of pruning channels c_target.
相应地,所述根据所述剪枝目标对所述第一微调后模型进行迭代剪枝,获得第二剪枝后模型,包括:Correspondingly, performing iterative pruning on the first fine-tuned model according to the pruning target to obtain a second pruned model includes:
S1,对所述第一微调后模型中的一个通道进行剪枝,获得单通道剪枝后模型。S1. Pruning one channel in the first fine-tuned model to obtain a single-channel pruned model.
S2,按照第二微调次数对单通道剪枝后模型进行微调训练,获得第二微调后模型。S2. Perform fine-tuning training on the single-channel pruned model according to the second number of fine-tuning times to obtain a second fine-tuned model.
其中,所述第二微调次数根据剪枝配比信息中迭代剪枝在模型剪枝过程的占比信息、目标剪枝通道数以及剪枝训练迭代总数确定。Wherein, the second fine-tuning times are determined according to the proportion information of iterative pruning in the model pruning process in the pruning ratio information, the target number of pruning channels, and the total number of pruning training iterations.
具体地,所述第二微调次数根据剪枝配比信息中迭代剪枝在模型剪枝过程的占比信息、目标剪枝通道数以及剪枝训练迭代总数确定,包括:Specifically, the second number of fine-tuning times is determined according to the proportion information of iterative pruning in the model pruning process in the pruning ratio information, the number of target pruning channels, and the total number of pruning training iterations, including:
根据迭代剪枝在模型剪枝过程的占比信息(迭代式剪枝的占比为1-α)以及剪枝训练迭代总数iters_all计算得到迭代剪枝微调训练总次数=(1-0.8*α)*iters_all。According to the proportion information of iterative pruning in the model pruning process (the proportion of iterative pruning is 1-α) and the total number of pruning training iterations iters_all is calculated to obtain the total number of iterative pruning fine-tuning training = (1-0.8*α) *iters_all.
根据所述迭代剪枝微调训练总次数以及迭代剪枝通道数c2计算得到每一次迭代时模型所要进行的微调次数(即第二微调次数iter2)。具体地, The number of times of fine-tuning to be performed by the model in each iteration (ie, the second number of times of fine-tuning iter2) is calculated according to the total number of training times of iterative pruning and fine-tuning and the number of iterative pruning channels c2. specifically,
S3,在所述第二微调后模型的基础上重复执行S1-S2,直到达到预设的迭代次数,以获得最新的第二微调后模型,并将最新的第二微调后模型作为第二剪枝后模型。即对所述第二微调后模型中的一个通道进行剪枝,获得新的单通道剪枝后模型。按照第二微调次数对新的单通道剪枝后模型进行微调训练,获得新的第二微调后模型。以此循环反复,直到到达预设的迭代次数(即,按照目标剪枝通道数完成剪枝)。S3. Repeat S1-S2 on the basis of the second fine-tuned model until the preset number of iterations is reached, so as to obtain the latest second fine-tuned model, and use the latest second fine-tuned model as the second trimmed Branch model. That is, one channel in the second fine-tuned model is pruned to obtain a new single-channel pruned model. Perform fine-tuning training on the new single-channel pruned model according to the second number of fine-tuning times to obtain a new second fine-tuned model. This cycle is repeated until the preset number of iterations is reached (that is, the pruning is completed according to the target number of pruning channels).
其中,所述预设的迭代次数iter2根据迭代剪枝通道数c2确定,该迭代剪枝通道数c2根据所述目标剪枝通道数c_target以及所述剪枝配比信息中迭代剪枝在模型剪枝过程中的占比信息(1-α)计算得到,具体为c2=c_target*(1-α)。Wherein, the preset number of iterations iter2 is determined according to the number of iterative pruning channels c2, and the number of iterative pruning channels c2 is based on the number of iterative pruning channels in the target pruning channel The proportion information (1-α) in the branch process is calculated, specifically, c2=c_target*(1-α).
本发明实施例提供的模型剪枝方法,在一次剪枝的基础上进行迭代式剪枝,不仅加快了剪枝训练过程,还能提升剪枝上限。The model pruning method provided by the embodiment of the present invention performs iterative pruning on the basis of one pruning, which not only speeds up the pruning training process, but also increases the upper limit of pruning.
在本发明的一些实施例中,所述剪枝目标还包括目标剪枝通道数c_target。In some embodiments of the present invention, the pruning target further includes a target number of pruning channels c_target.
相应地,所述根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型,包括:Correspondingly, performing a pruning on the model to be pruned according to the pruning target to obtain a first pruned model, including:
获取所述待剪枝模型中各个通道的第一范数,并按照所述第一范数的数值由小到大的顺序对待剪枝模型中各个通道进行排序,获得通道序列。Obtain the first norm of each channel in the model to be pruned, and sort the channels in the model to be pruned according to the value of the first norm from small to large, to obtain a channel sequence.
具体地,计算待剪枝模型中各层网络层下的各通道中权重的范数值的和,并由根据各个通道对应的权重范数值的和(即第一范数)按照由小到大的顺序对各个通道进行排序,总通道数记为T。Specifically, calculate the sum of the norm values of the weights in each channel under each layer of the network layer in the model to be pruned, and according to the sum of the norm values of the weights corresponding to each channel (that is, the first norm) according to the order from small to large Each channel is sorted sequentially, and the total number of channels is recorded as T.
将所述通道序列中前p个通道作为第一待剪枝通道。The first p channels in the channel sequence are used as the first channels to be pruned.
其中,p根据所述目标剪枝通道数c_target以及所述剪枝配比信息中一次剪枝在模型剪枝过程中的占比信息α计算得到。具体为p=c_target*α。Wherein, p is calculated according to the target number of pruning channels c_target and the proportion information α of one pruning in the model pruning process in the pruning ratio information. Specifically, p=c_target*α.
根据所述第一待剪枝通道对所述待剪枝模型进行剪枝,获得第一剪枝后模型。即根据第一待剪枝通道的标识信息在待剪枝模型中剪枝掉p个通道,获得第一剪枝后模型。Pruning the model to be pruned according to the first channel to be pruned to obtain a first pruned model. That is, p p channels are pruned in the model to be pruned according to the identification information of the first channel to be pruned to obtain the first pruned model.
在本实施例中,权重的范数值通过对权重进行L1范数计算后获得,在本发明的其他方案中也可以通过L0范数、L2范数等其他方式计算得到。In this embodiment, the norm value of the weight is obtained by performing L1 norm calculation on the weight, and in other solutions of the present invention, it may also be calculated by other means such as L0 norm and L2 norm.
本发明实施例提供的模型剪枝方法,根据各个通道的范数值确定剪枝敏感度较低的通道为第一待剪枝通道,并进行一次剪枝,从而获得第一剪枝后模型。In the model pruning method provided by the embodiment of the present invention, the channel with lower pruning sensitivity is determined as the first channel to be pruned according to the norm value of each channel, and one pruning is performed to obtain the first pruned model.
在本发明的一些实施例中,所述S1,对所述第一微调后模型中的一个通道进行剪枝,获得单通道剪枝后模型,包括:In some embodiments of the present invention, the S1 is to prune one channel in the first fine-tuned model to obtain a single-channel pruned model, including:
获取所述第一微调后模型中各个通道的第二范数。即,计算第一微调后模型中所有网络层中各通道权重的范数值的和。Obtain the second norm of each channel in the first fine-tuned model. That is, the sum of the norm values of the channel weights in all network layers in the first fine-tuned model is calculated.
将第二范数数值最小的通道作为第二待剪枝通道。The channel with the smallest value of the second norm is used as the second channel to be pruned.
根据所述第二待剪枝通道对所述第一微调后模型进行剪枝,获得单通道剪枝后模型。即在迭代剪枝过程中,每次迭代仅对一个通道进行剪枝。Pruning the first fine-tuned model according to the second channel to be pruned to obtain a single-channel pruned model. That is, in the iterative pruning process, only one channel is pruned in each iteration.
在本实施例中,权重的范数值通过对权重进行L1范数计算后获得,在本发明的其他方案中也可以通过L0范数、L2范数等其他方式计算得到。In this embodiment, the norm value of the weight is obtained by performing L1 norm calculation on the weight, and in other solutions of the present invention, it may also be calculated by other means such as L0 norm and L2 norm.
图3是本发明实施例提供的图像处理方法的流程示意图;如图3所示,该图像处理方法,包括:Fig. 3 is a schematic flow chart of an image processing method provided by an embodiment of the present invention; as shown in Fig. 3, the image processing method includes:
S301,获取待处理图像。S301. Acquire an image to be processed.
S302,将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果。S302. Input the image to be processed into a trained image processing model, and process the image to be processed through the trained image processing model to obtain a processing result.
其中,所述训练好的图像处理模型为通过如上述的模型剪枝方法得到。Wherein, the trained image processing model is obtained through the above-mentioned model pruning method.
在本实施例中,通过上述模型剪枝方法获得训练好的图像处理模型,并将该训练好的图像处理模型移植在算力有限的终端中,该终端在获取待处理图像之后,将待处理图像输入至训练好的图像处理模型,直接得到预测结果,降低资源消耗并提升响应时间。举例来说,图像处理模型为标志牌分类模型,其在云端或者其他计算资源丰富的设备上完成训练与剪枝之后,被移植至自动驾驶的车端。车端在获取车辆周围的图像之后,通过该标志牌分类模型进行分类预测,得到分类结果。又或者,图像处理模型为人脸属性识别模型,用于识别输入的人脸图像中人的性别、年龄、种族等,那么,该人脸属性识别模型在经过训练与剪枝之后被移植至计算资源有限的终端中,对终端所获取的人脸图像进行识别,获得人脸识别结果。In this embodiment, the trained image processing model is obtained through the above model pruning method, and the trained image processing model is transplanted into a terminal with limited computing power. After the terminal acquires the image to be processed, it will The image is input to the trained image processing model, and the prediction result is obtained directly, reducing resource consumption and improving response time. For example, the image processing model is a signboard classification model. After training and pruning on the cloud or other devices with rich computing resources, it is transplanted to the autonomous driving vehicle. After the vehicle terminal acquires the images around the vehicle, it uses the signboard classification model to perform classification prediction and obtain the classification result. Or, the image processing model is a face attribute recognition model, which is used to identify the gender, age, race, etc. of people in the input face image. Then, the face attribute recognition model is transplanted to computing resources after training and pruning In the limited terminal, the face image acquired by the terminal is recognized to obtain a face recognition result.
本发明实施例提供的图像处理方法,基于上述提到的剪枝方法获得图像处理模型,利用该图像处理模型在计算资源有限的终端中实现图像处理,达到了降低资源消耗并提升响应时间的目的。The image processing method provided by the embodiment of the present invention obtains an image processing model based on the pruning method mentioned above, and uses the image processing model to realize image processing in a terminal with limited computing resources, thereby achieving the purpose of reducing resource consumption and improving response time .
下面对本发明提供的模型剪枝装置以及图像处理装置进行描述,下文描述的模型剪枝装置与上文描述的模型剪枝方法可相互对应参照,图像处理装置与图像处理方法相互对应参照。The model pruning device and image processing device provided by the present invention are described below. The model pruning device described below and the model pruning method described above can be referred to in correspondence with each other, and the image processing device and image processing method can be referred to in correspondence.
图4为本发明实施例提供的模型剪枝装置结构示意图,如图4所示,该模型剪枝装置包括待模型与剪枝目标获取模块401、一次剪枝模块402以及迭代剪枝模块403。FIG. 4 is a schematic structural diagram of a model pruning device provided by an embodiment of the present invention. As shown in FIG. 4 , the model pruning device includes a model and pruning
模型与剪枝目标获取模块401,用于获取待剪枝模型以及其对应的剪枝目标。The model and pruning
其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息。Wherein, the model to be pruned is obtained based on image data training, and the pruning target includes pruning ratio information, and the pruning ratio information is used to represent the results of one-time pruning and iterative pruning in the model pruning process. percentage information.
在本模块中,待剪枝模型为预训练模型,该预训练模型可以具体为卷积神经网络,且其基于训练图像及其对应的图像标签训练得到,用于进行图像处理。In this module, the model to be pruned is a pre-training model, and the pre-training model can be specifically a convolutional neural network, and it is trained based on training images and corresponding image labels for image processing.
剪枝目标可以是预训练模型所要达到的体积大小,可以是整个预训练模型的剪枝率,或者具体到剪枝通道数,还可以包括剪枝训练总迭代次数。在本发明中,剪枝目标还可以包括用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例的剪枝配比信息,其用来配置一次剪枝与迭代剪枝两种剪枝方法各自在整个剪枝训练过程中所占的比例。The pruning target can be the size of the pre-trained model, the pruning rate of the entire pre-trained model, or the number of pruning channels, or the total number of iterations of pruning training. In the present invention, the pruning target may also include pruning ratio information used to characterize the proportion of primary pruning and iterative pruning in the model pruning process, which is used to configure two types of primary pruning and iterative pruning. The proportion of each pruning method in the whole pruning training process.
一次剪枝模块402,用于根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型。A
在本模块中,根据剪枝目标(比如剪枝配比信息)采用一次剪枝方法对所述待剪枝模型进行剪枝(one-shot剪枝),将剪枝后的模型作为第一剪枝后模型。In this module, the one-shot pruning method is used to prune the model to be pruned (one-shot pruning) according to the pruning target (such as pruning ratio information), and the pruned model is used as the first pruning model. Branch model.
迭代剪枝模块403,用于根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。The
在本模块中,基于上述的第一剪枝后模型,并根据剪枝目标继续进行剪枝,采用迭代式剪枝方法对第一剪枝后模型剪枝,将剪枝后的模型作为第二剪枝后模型,该第二剪枝后模型即为最终输出的目标模型,用于图像处理。In this module, based on the first pruned model mentioned above, pruning is continued according to the pruning target, the iterative pruning method is used to prune the first pruned model, and the pruned model is used as the second A pruned model, the second pruned model is a final output target model for image processing.
现有技术中,每次迭代式剪枝后均要进行微调训练(fine-tune训练),假设对待剪枝模型进行迭代式剪枝,且迭代次数为10,每次迭代式剪枝后微调训练次数为1000,则总共微调训练次数为10000;而如果对待剪枝模型进行一次剪枝,且设置微调训练次数为2000,则总共微调训练次数为2000。由上述举例可知,迭代式剪枝中的微调训练总次数相较于一次剪枝方法而言过多,导致剪枝训练过程耗时过长,而只使用一次剪枝方式进行剪枝,则剪枝模型的上限会受限。故而,本发明融合了一次剪枝与迭代式剪枝两种方法,举例来说,先进行了一次剪枝,在一次剪枝过程中,微调训练次数1000,在迭代式剪枝过程中,迭代次数为5,微调训练次数为1000,则整个剪枝过程中,微调训练总次数为1000+5*1000=6000。通过比较6000与10000可知,通过融合一次剪枝与迭代剪枝这两种剪枝方法能够大大减少微调训练次数,从而缩短训练时间。另外,相较于单纯使用一次剪枝方法而言,还能提升剪枝上限。In the prior art, fine-tune training (fine-tune training) is required after each iterative pruning. Assuming that the model to be pruned is iteratively pruned, and the number of iterations is 10, fine-tune training after each iterative pruning If the number of times is 1000, the total number of fine-tuning training is 10000; and if the model to be pruned is pruned once, and the number of fine-tuning training is set to 2000, the total number of fine-tuning training is 2000. From the above examples, it can be seen that the total number of fine-tuning training in iterative pruning is too much compared with the one-time pruning method, resulting in a long time-consuming pruning training process. The upper limit of the branch model will be limited. Therefore, the present invention combines two methods of one-time pruning and iterative pruning. For example, one-time pruning is performed first. In one pruning process, the number of times of fine-tuning training is 1000. The number of times is 5, the number of times of fine-tuning training is 1000, then the total number of times of fine-tuning training in the whole pruning process is 1000+5*1000=6000. By comparing 6000 and 10000, it can be seen that by combining the two pruning methods of one-time pruning and iterative pruning, the number of fine-tuning training can be greatly reduced, thereby shortening the training time. In addition, compared with simply using the one-time pruning method, the upper limit of pruning can also be increased.
本发明实施例提供的模型剪枝装置,通过本发明中的一次剪枝和迭代式剪枝这两种方式能够加速训练过程,且相较于单独使用一次剪枝方法而言,提高了剪枝上限。The model pruning device provided by the embodiment of the present invention can accelerate the training process through the two methods of one-time pruning and iterative pruning in the present invention, and compared with the single-time pruning method, the pruning method is improved. upper limit.
图5是本发明实施例提供的图像处理装置的结构示意图;如图5所示,该图像处理装置包括图像获取模块501以及图像处理模块502。FIG. 5 is a schematic structural diagram of an image processing device provided by an embodiment of the present invention; as shown in FIG. 5 , the image processing device includes an
图像获取模块501,用于获取待处理图像。An
图像处理模块502,用于将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果。The
其中,所述训练好的图像处理模型为通过如上述的模型剪枝装置得到。Wherein, the trained image processing model is obtained through the above-mentioned model pruning device.
在本实施例中,通过上述模型剪枝方法获得训练好的图像处理模型,并将该训练好的图像处理模型移植在算力有限的终端中,该终端在获取待处理图像之后,将待处理图像输入至训练好的图像处理模型,直接得到预测结果,降低资源消耗并提升响应时间。举例来说,图像处理模型为标志牌分类模型,其在云端或者其他计算资源丰富的设备上完成训练与剪枝之后,被移植至自动驾驶的车端。车端在获取车辆周围的图像之后,通过该标志牌分类模型进行分类预测,得到分类结果。又或者,图像处理模型为人脸属性识别模型,用于识别输入的人脸图像中人的性别、年龄、种族等,那么,该人脸属性识别模型在经过训练与剪枝之后被移植至计算资源有限的终端中,对终端所获取的人脸图像进行识别,获得人脸识别结果。In this embodiment, the trained image processing model is obtained through the above model pruning method, and the trained image processing model is transplanted into a terminal with limited computing power. After the terminal acquires the image to be processed, it will The image is input to the trained image processing model, and the prediction result is obtained directly, reducing resource consumption and improving response time. For example, the image processing model is a signboard classification model. After training and pruning on the cloud or other devices with rich computing resources, it is transplanted to the autonomous driving vehicle. After the vehicle terminal acquires the images around the vehicle, it uses the signboard classification model to perform classification prediction and obtain the classification result. Or, the image processing model is a face attribute recognition model, which is used to identify the gender, age, race, etc. of people in the input face image. Then, the face attribute recognition model is transplanted to computing resources after training and pruning In the limited terminal, the face image acquired by the terminal is recognized to obtain a face recognition result.
本发明实施例提供的图像处理装置,基于上述提到的剪枝方法获得图像处理模型,利用该图像处理模型在计算资源有限的终端中实现图像处理,达到了降低资源消耗并提升响应时间的目的。The image processing device provided by the embodiment of the present invention obtains an image processing model based on the above-mentioned pruning method, and uses the image processing model to realize image processing in a terminal with limited computing resources, thereby achieving the purpose of reducing resource consumption and improving response time .
图6为本发明实施例提供的一种电子设备的实体结构示意图,如图6所示,该电子设备可以包括:处理器(processor)610、通信接口(Communications Interface)620、存储器(memory)630和通信总线640,其中,处理器610,通信接口620,存储器630通过通信总线640完成相互间的通信。处理器610可以调用存储器630中的逻辑指令,以执行模型剪枝方法,所述模型剪枝方法,包括:获取待剪枝模型以及其对应的剪枝目标,其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息;根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型;根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。FIG. 6 is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. As shown in FIG. 6, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, and a memory (memory) 630 and a
或以执行图像处理方法,所述图像处理方法,包括:获取待处理图像;将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果;其中,所述训练好的图像处理模型为通过上述的模型剪枝方法得到。Or to execute an image processing method, the image processing method includes: acquiring an image to be processed; inputting the image to be processed into a trained image processing model, and processing the image to be processed by the trained image processing model The image is processed to obtain a processing result; wherein, the trained image processing model is obtained through the above-mentioned model pruning method.
此外,上述的存储器630中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。In addition, the logic instructions in the above-mentioned
又一方面,本发明还提供一种非暂态计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现以执行模型剪枝方法,所述模型剪枝方法,包括:获取待剪枝模型以及其对应的剪枝目标,其中,所述待剪枝模型基于图像数据训练得到,所述剪枝目标包括剪枝配比信息,所述剪枝配比信息用于表征在模型剪枝过程中一次剪枝与迭代剪枝所占比例信息;根据所述剪枝目标对所述待剪枝模型进行一次剪枝,获得第一剪枝后模型;根据所述剪枝目标对所述第一剪枝后模型进行迭代剪枝,获得第二剪枝后模型,并将所述第二剪枝后模型作为目标模型。In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it is implemented to perform a model pruning method, and the model pruning method includes : Acquiring the model to be pruned and its corresponding pruning target, wherein the model to be pruned is trained based on image data, the pruning target includes pruning ratio information, and the pruning ratio information is used to represent In the process of model pruning, the proportion information of one-time pruning and iterative pruning; perform one-time pruning on the model to be pruned according to the pruning target to obtain the first pruned model; according to the pruning target Perform iterative pruning on the first pruned model to obtain a second pruned model, and use the second pruned model as a target model.
或以执行图像处理方法,所述图像处理方法,包括:获取待处理图像;将所述待处理图像输入到训练好的图像处理模型中,通过所述训练好的图像处理模型对所述待处理图像进行处理,得到处理结果;其中,所述训练好的图像处理模型为通过上述的模型剪枝方法得到。Or to execute an image processing method, the image processing method includes: acquiring an image to be processed; inputting the image to be processed into a trained image processing model, and processing the image to be processed by the trained image processing model The image is processed to obtain a processing result; wherein, the trained image processing model is obtained through the above-mentioned model pruning method.
以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place , or can also be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without any creative efforts.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分的方法。Through the above description of the implementations, those skilled in the art can clearly understand that each implementation can be implemented by means of software plus a necessary general hardware platform, and of course also by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in computer-readable storage media, such as ROM/RAM, magnetic Discs, optical discs, etc., include several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods of various embodiments or some parts of the embodiments.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211659437.7A CN116011550A (en) | 2022-12-22 | 2022-12-22 | A model pruning method, image processing method and related device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211659437.7A CN116011550A (en) | 2022-12-22 | 2022-12-22 | A model pruning method, image processing method and related device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116011550A true CN116011550A (en) | 2023-04-25 |
Family
ID=86025997
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211659437.7A Pending CN116011550A (en) | 2022-12-22 | 2022-12-22 | A model pruning method, image processing method and related device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116011550A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116188878A (en) * | 2023-04-25 | 2023-05-30 | 之江实验室 | Image classification method, device and storage medium based on fine-tuning of neural network structure |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170337467A1 (en) * | 2016-05-18 | 2017-11-23 | Nec Laboratories America, Inc. | Security system using a convolutional neural network with pruned filters |
| CN110619385A (en) * | 2019-08-31 | 2019-12-27 | 电子科技大学 | Structured network model compression acceleration method based on multi-stage pruning |
| CN113762505A (en) * | 2021-08-13 | 2021-12-07 | 中国电子科技集团公司第三十八研究所 | Clustering pruning method of convolutional neural network according to norm of channel L2 |
| CN115222042A (en) * | 2022-07-08 | 2022-10-21 | 中国科学院计算技术研究所 | Structured pruning method and system |
-
2022
- 2022-12-22 CN CN202211659437.7A patent/CN116011550A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20170337467A1 (en) * | 2016-05-18 | 2017-11-23 | Nec Laboratories America, Inc. | Security system using a convolutional neural network with pruned filters |
| CN110619385A (en) * | 2019-08-31 | 2019-12-27 | 电子科技大学 | Structured network model compression acceleration method based on multi-stage pruning |
| CN113762505A (en) * | 2021-08-13 | 2021-12-07 | 中国电子科技集团公司第三十八研究所 | Clustering pruning method of convolutional neural network according to norm of channel L2 |
| CN115222042A (en) * | 2022-07-08 | 2022-10-21 | 中国科学院计算技术研究所 | Structured pruning method and system |
Non-Patent Citations (2)
| Title |
|---|
| XIAOFAN XU等: "Hybrid Pruning: Thinner Sparse Networks for Fast Inference on Edge Devices", ARXIV:1811.00482V1, 1 November 2018 (2018-11-01), pages 1 * |
| 侯俊龙;潘文林;王璐;何翠玲;王翠;: "基于剪枝AlexNet的普米语孤立词识别", 云南民族大学学报(自然科学版), vol. 29, no. 04, 10 July 2020 (2020-07-10), pages 382 - 389 * |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN116188878A (en) * | 2023-04-25 | 2023-05-30 | 之江实验室 | Image classification method, device and storage medium based on fine-tuning of neural network structure |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10552737B2 (en) | Artificial neural network class-based pruning | |
| CN112699991B (en) | Method, electronic device and computer readable medium for accelerating information processing for neural network training | |
| CN109344921B (en) | A kind of image recognition method, device and equipment based on deep neural network model | |
| CN112101190A (en) | Remote sensing image classification method, storage medium and computing device | |
| CN113392867B (en) | Image recognition method, device, computer equipment and storage medium | |
| EP3620982B1 (en) | Sample processing method and device | |
| CN113705598A (en) | Data classification method and device and electronic equipment | |
| CN111523640A (en) | Training method and device of neural network model | |
| WO2020211242A1 (en) | Behavior recognition-based method, apparatus and storage medium | |
| CN111047563A (en) | Neural network construction method applied to medical ultrasonic image | |
| CN112598110B (en) | Neural network construction method, device, equipment and medium | |
| US20210089825A1 (en) | Systems and methods for cleaning data | |
| CN115881103B (en) | Speech emotion recognition model training method, speech emotion recognition method and device | |
| CN117421657A (en) | A noisy labeled sample screening learning method and system based on oversampling strategy | |
| CN111582302A (en) | Vehicle identification method, device, equipment and storage medium | |
| CN114170484A (en) | Picture attribute prediction method and device, electronic equipment and storage medium | |
| CN116011550A (en) | A model pruning method, image processing method and related device | |
| CN114565080B (en) | Neural network compression method and device, computer readable medium and electronic equipment | |
| CN113505804B (en) | Image recognition method and system based on compressed deep neural network | |
| CN112598020B (en) | Target recognition method and system | |
| CN116128044A (en) | Model pruning method, image processing method and related devices | |
| CN114004974A (en) | Method and device for optimizing images shot in low-light environment | |
| CN113361384A (en) | Face recognition model compression method, device, medium, and computer program product | |
| CN113807413B (en) | Object identification method and device and electronic equipment | |
| CN114626501B (en) | Data processing method, device, electronic equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |
