CN117291250A - Neural network pruning method for image segmentation - Google Patents
Neural network pruning method for image segmentation Download PDFInfo
- Publication number
- CN117291250A CN117291250A CN202311156130.XA CN202311156130A CN117291250A CN 117291250 A CN117291250 A CN 117291250A CN 202311156130 A CN202311156130 A CN 202311156130A CN 117291250 A CN117291250 A CN 117291250A
- Authority
- CN
- China
- Prior art keywords
- neuron
- importance
- gradient
- neurons
- neural network
- 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
- 238000000034 method Methods 0.000 title claims abstract description 48
- 238000013138 pruning Methods 0.000 title claims abstract description 26
- 238000013528 artificial neural network Methods 0.000 title claims abstract description 25
- 238000003709 image segmentation Methods 0.000 title claims abstract description 25
- 210000002569 neuron Anatomy 0.000 claims abstract description 86
- 230000004913 activation Effects 0.000 claims abstract description 26
- 230000008569 process Effects 0.000 claims abstract description 20
- 230000011218 segmentation Effects 0.000 claims abstract description 16
- 208000037062 Polyps Diseases 0.000 claims abstract description 12
- 238000012549 training Methods 0.000 claims abstract description 3
- 230000006870 function Effects 0.000 claims description 36
- 230000000694 effects Effects 0.000 claims description 12
- 208000032177 Intestinal Polyps Diseases 0.000 claims description 8
- 230000009466 transformation Effects 0.000 claims description 6
- 230000008859 change Effects 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 4
- 238000001839 endoscopy Methods 0.000 claims description 3
- 238000010606 normalization Methods 0.000 claims 2
- 230000006872 improvement Effects 0.000 claims 1
- 238000005259 measurement Methods 0.000 claims 1
- 230000001902 propagating effect Effects 0.000 claims 1
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 238000013135 deep learning Methods 0.000 description 5
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 238000003708 edge detection Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000003190 augmentative effect Effects 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000010191 image analysis Methods 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Biomedical Technology (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域Technical field
本发明涉及图像分割技术领域,具体为一种用于图像分割的神经网络剪枝方法。The present invention relates to the technical field of image segmentation, specifically a neural network pruning method for image segmentation.
背景技术Background technique
图像分割是计算机视觉领域的重要任务,旨在将图像中的像素划分为具有语义意义的不同区域。图像分割在许多应用领域中发挥关键作用,包括医学图像分析、自动驾驶、图像编辑和增强现实等。Image segmentation is an important task in the field of computer vision, which aims to divide pixels in an image into different regions with semantic meaning. Image segmentation plays a key role in many application areas, including medical image analysis, autonomous driving, image editing, and augmented reality.
现有技术中,在计算机视觉的早期阶段,图像分割主要基于低级特征,如边缘、纹理和颜色等。经典的算法包括基于边缘检测的方法,如Canny边缘检测算法,以及基于区域生长的方法,如基于阈值的分割算法。这些方法主要基于启发式规则和手工设计的特征。随着深度学习的快速发展,卷积神经网络在图像分割领域取得了显著的突破。深度学习方法通过端到端的训练,能够自动学习特征表示,并在大规模数据上取得较好的性能。著名的深度学习方法包括全卷积网络、U-Net和Mask R-CNN等。这些方法在图像分割任务上取得了很高的准确性,并且能够处理复杂的场景和多个对象的分割;近年来,深度学习得到了快速的发展,越来越的学者将其应用到图像分割领域,其中以Un-Net网络为代表的分割模型应用最为广泛。In the existing technology, in the early stages of computer vision, image segmentation was mainly based on low-level features, such as edges, textures, and colors. Classic algorithms include edge detection-based methods, such as the Canny edge detection algorithm, and region growing-based methods, such as threshold-based segmentation algorithms. These methods are mainly based on heuristic rules and hand-designed features. With the rapid development of deep learning, convolutional neural networks have made significant breakthroughs in the field of image segmentation. Deep learning methods can automatically learn feature representations through end-to-end training and achieve better performance on large-scale data. Well-known deep learning methods include fully convolutional networks, U-Net and Mask R-CNN, etc. These methods have achieved high accuracy in image segmentation tasks and can handle the segmentation of complex scenes and multiple objects; in recent years, deep learning has developed rapidly, and more and more scholars are applying it to image segmentation. field, among which the segmentation model represented by the Un-Net network is the most widely used.
但是,大型分割模型的延迟一直是成功部署的主要瓶颈。尽管使用较小的分割模型是一种选择,但这往往会牺牲模型的性能。However, the latency of large segmentation models has been a major bottleneck for successful deployment. Although using smaller split models is an option, this often sacrifices model performance.
发明内容Contents of the invention
本发明的目的在于提供一种用于图像分割的神经网络剪枝方法,以解决上述背景技术中提出的问题。The purpose of the present invention is to provide a neural network pruning method for image segmentation to solve the problems raised in the above background technology.
为实现上述目的,本发明提供如下技术方案:一种用于图像分割的神经网络剪枝方法,所述方法包括以下步骤:To achieve the above objectives, the present invention provides the following technical solution: a neural network pruning method for image segmentation, which method includes the following steps:
S1、使用Kvasir息肉分割数据集训练U-Net网络;S1. Use the Kvasir polyp segmentation data set to train the U-Net network;
S2、计算前向传播过程中神经元的激活程度,找出激活值为0的神经元;S2. Calculate the activation degree of neurons during the forward propagation process and find the neurons with an activation value of 0;
S3、计算反向传播过程中的梯度信息;S3. Calculate the gradient information in the back propagation process;
S4、结合步骤S2和S3,得到神经元对给定数据的损失或函数的重要性度量;S4. Combine steps S2 and S3 to obtain the importance measure of the loss or function of the neuron to the given data;
S5、模型参数修剪。S5. Model parameter pruning.
优选的,在骤S1中,Kvasir息肉分割数据集用于肠道息肉图像的分割任务,Kvasir数据集包括来自内镜检查的肠道息肉图像,包括息肉和正常组织在内的不同类别的图像,图像的分辨率为1080p,大小为576x576像素。Preferably, in step S1, the Kvasir polyp segmentation data set is used for the segmentation task of intestinal polyp images. The Kvasir data set includes intestinal polyp images from endoscopy, including images of different categories including polyps and normal tissue, The resolution of the image is 1080p and the size is 576x576 pixels.
优选的,在步骤S2中,前向信号通常由预激活值表示,当神经元的预激活为零时,意味着神经元的输入信号经过权重和偏置的加权求和后等于零,在神经网络中,预激活通常是通过对输入信号进行线性变换得到的,即尚未应用激活函数进行非线性变换的状态;Preferably, in step S2, the forward signal is usually represented by a pre-activation value. When the pre-activation of a neuron is zero, it means that the input signal of the neuron is equal to zero after the weighted sum of weights and biases. In the neural network , pre-activation is usually obtained by linear transformation of the input signal, that is, a state where the activation function has not been applied for non-linear transformation;
如果预激活为零,那么神经元对于函数的输出没有任何影响,因为它不会对最终的输出产生贡献;If the preactivation is zero, then the neuron has no effect on the output of the function because it does not contribute to the final output;
如果神经元的输入连接为零权重,则移除神经元,即神经元没有重要性;If the input connection of the neuron has zero weight, the neuron is removed, that is, the neuron has no importance;
如果输入连接是非零的,则神经元具有重要性,前向信号考虑了数据对特定神经元的影响。A neuron is significant if the input connections are non-zero, and the forward signal takes into account the impact of the data on a specific neuron.
优选的,在步骤S3中,反向信号通常是通过反向传播损失得到的,当神经元的输出连接为零时,神经元的激活程度为正,对函数的影响也是无关紧要的,梯度提供了当神经元被移除时,函数或损失如何变化的信息。Preferably, in step S3, the reverse signal is usually obtained through backpropagation loss. When the output connection of the neuron is zero, the activation degree of the neuron is positive, and the impact on the function is also insignificant. The gradient provides provides information about how the function or loss changes when the neuron is removed.
优选的,在步骤S3中,在神经网络的反向传播过程中,首先计算损失函数对网络输出的梯度,然后将梯度沿着网络的连接进行反向传播,从而计算每个神经元的梯度;反向传播的过程给出神经元的梯度信息,即梯度指示了当神经元被移除时,损失函数的变化情况;Preferably, in step S3, during the back propagation process of the neural network, first calculate the gradient of the loss function on the network output, and then back propagate the gradient along the connections of the network to calculate the gradient of each neuron; The process of backpropagation gives the gradient information of the neuron, that is, the gradient indicates the change of the loss function when the neuron is removed;
如果神经元的输出连接权重为零,意味着它对后续层神经元的输出没有任何影响;通过计算神经元的梯度,了解到当移除神经元时,函数或损失函数的变化情况。If the output connection weight of a neuron is zero, it means that it has no effect on the output of the neuron in the subsequent layer; by calculating the gradient of the neuron, we can understand how the function or loss function changes when the neuron is removed.
优选的,在步骤S4中,结合前向和后向信号,得到神经元对给定数据的损失或函数的影响包含以下部分:Preferably, in step S4, combining the forward and backward signals to obtain the impact of the neuron on the loss or function of the given data includes the following parts:
对于数量为M的数据集,U-Net网络中每个神经元的重要性度量Ii可由下述公式(1)得到For a data set with a number of M, the importance measure I i of each neuron in the U-Net network can be obtained by the following formula (1)
其中xi是预激活,δxi是其梯度,上述公式满足了如果传入或传出连接为零,重要性应该很低,否则重要性更高的规则。Where xi is the preactivation and δxi is its gradient, the above formula satisfies the rule that if the incoming or outgoing connections are zero, the importance should be low, otherwise the importance should be higher.
优选的,在步骤S4中,结合前向和后向信号,得到神经元对给定数据的损失或函数的影响还包含以下部分:Preferably, in step S4, combining the forward and backward signals to obtain the impact of the neuron on the loss or function of the given data also includes the following parts:
得到的重要性度量Ii类似于泰勒一阶展开式,度量指标在梯度为负时给出较低的重要性,对重要性度量Ii进行平方,增加反向传播中梯度为负的神经元的重要性,改进后的重要性度量Ii如公式(2)所示:The resulting importance measure I i is similar to Taylor's first-order expansion. The metric index gives lower importance when the gradient is negative. Square the importance measure I i and increase the neurons with negative gradients in backpropagation. The improved importance measure I i is shown in formula (2):
其中代表重要性度量Ii的平方。in represents the square of the importance measure I i .
优选的,在步骤S4中,结合前向和后向信号,得到神经元对给定数据的损失或函数的影响还包含以下部分:Preferably, in step S4, combining the forward and backward signals to obtain the impact of the neuron on the loss or function of the given data also includes the following parts:
在计算梯度过程中,对梯度进行归一化处理,通常将其归一化为1,确保每个数据点在计算重要性时具有相等的贡献,通过对梯度进行归一化,消除梯度幅度差异,确保每个输入样本在计算重要性时具有相同的权重,确保不同输入样本对于整体重要性分数的计算具有公平的贡献。In the process of calculating the gradient, the gradient is normalized, usually normalized to 1, to ensure that each data point has an equal contribution in calculating the importance. By normalizing the gradient, the difference in gradient amplitude is eliminated. , ensuring that each input sample has the same weight when calculating importance, ensuring that different input samples have a fair contribution to the calculation of the overall importance score.
优选的,步骤S5中,模型参数修剪是在大小为N的数据集D∈[x0,x1,…,xn]进行修剪,在神经网络中,输入输出简单的表示为:yn=f(xn),目标tn是希望模型预测或分类的标签,对于每个目标tn,计算相对于每个输入xn的梯度,揭示出对于给定目标的期望输出,每个输入对于输出的贡献程度,公式如(3)所示:Preferably, in step S5, the model parameters are pruned on a data set D∈[x 0 , x 1 ,..., x n ] of size N. In the neural network, the input and output are simply expressed as: y n = f(x n ), the target t n is the label that you want the model to predict or classify. For each target t n , calculate the gradient with respect to each input x n , revealing the expected output for the given target, and for each input The degree of contribution of the output, the formula is shown in (3):
然后将梯度Δyn进行归一化:Then normalize the gradient Δy n :
之后,将梯度进行反向传播以计算每个卷积核的重要性度量Ii的平方/> Afterwards, the gradient Backpropagation is performed to calculate the square of the importance measure I i for each convolution kernel/>
与现有技术相比,本发明的有益效果是:Compared with the prior art, the beneficial effects of the present invention are:
本发明提出的用于图像分割的神经网络剪枝方法,使用Kvasir息肉分割数据集训练U-Net网络;计算前向传播过程中神经元的激活程度,找出激活值为0的神经元;计算反向传播过程中的梯度信息;结合前向信号和反向信号得到对于给的数据集的重要性度量,根据该重要性度量裁剪掉得分小于阈值的神经元。通过修剪冗余的参数,可以减小模型的体积并提高推理效率,从而更好地满足实际部署的需求。The neural network pruning method for image segmentation proposed by the present invention uses the Kvasir polyp segmentation data set to train the U-Net network; calculates the activation degree of neurons during the forward propagation process, and finds neurons with an activation value of 0; calculate Gradient information in the back propagation process; combine the forward signal and the reverse signal to obtain the importance measure for the given data set, and crop out neurons with scores less than the threshold based on the importance measure. By pruning redundant parameters, the size of the model can be reduced and the inference efficiency improved, thereby better meeting the needs of actual deployment.
附图说明Description of drawings
图1为本发明方法流程图;Figure 1 is a flow chart of the method of the present invention;
图2为本发明剪枝前后U-Net模型的参数变化对比图。Figure 2 is a comparison chart of parameter changes of the U-Net model before and after pruning in the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案进行清楚、完整地描述,及优点更加清楚明白,以下结合附图对本发明实施例进行进一步详细说明。应当理解,此处所描述的具体实施例是本发明一部分实施例,而不是全部的实施例,仅仅用以解释本发明实施例,并不用于限定本发明实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to clearly and completely describe the purpose and technical solution of the present invention, and make the advantages more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described here are part of the embodiments of the present invention, rather than all embodiments. They are only used to explain the embodiments of the present invention and are not used to limit the embodiments of the present invention. Those of ordinary skill in the art will not All other embodiments obtained without creative efforts belong to the scope of protection of the present invention.
请参阅图1至图2,本发明提供一种技术方案:一种用于图像分割的神经网络剪枝方法,所述方法包括以下步骤:Referring to Figures 1 to 2, the present invention provides a technical solution: a neural network pruning method for image segmentation. The method includes the following steps:
S1、使用Kvasir息肉分割数据集训练U-Net网络;S1. Use the Kvasir polyp segmentation data set to train the U-Net network;
S2、计算前向传播过程中神经元的激活程度,找出激活值为0的神经元;S2. Calculate the activation degree of neurons during the forward propagation process and find the neurons with an activation value of 0;
S3、计算反向传播过程中的梯度信息;S3. Calculate the gradient information in the back propagation process;
S4、结合S2和S3,得到神经元对给定数据的损失或函数的重要性度量;S4. Combine S2 and S3 to obtain the importance measure of the loss or function of the neuron to the given data;
S5、模型参数修剪。S5. Model parameter pruning.
在骤S1中,所述Kvasir息肉分割数据集是一个在医学图像分割领域广泛使用的数据集,专门用于肠道息肉图像的分割任务。该数据集由挪威特隆赫姆大学的研究团队开发,旨在促进肠道息肉相关研究和算法的发展。Kvasir数据集包含了来自内镜检查的肠道息肉图像,该数据集包含了包括息肉和正常组织在内的不同类别的图像。图像的分辨率为1080p,大小为576x576像素。该数据集已经被广泛应用于深度学习和计算机视觉算法的训练和评估,以提高肠道息肉检In step S1, the Kvasir polyp segmentation data set is a data set widely used in the field of medical image segmentation and is specifically used for the segmentation task of intestinal polyp images. The dataset was developed by a research team at the University of Trondheim in Norway to facilitate the development of intestinal polyp-related research and algorithms. The Kvasir dataset contains images of intestinal polyps from endoscopy. The dataset contains images of different categories including polyps and normal tissue. The resolution of the image is 1080p and the size is 576x576 pixels. This dataset has been widely used to train and evaluate deep learning and computer vision algorithms to improve intestinal polyp detection.
在步骤S2中,所述前向信号通常由预激活值表示。当神经元的预激活(pre-activation)为零时,意味着该神经元的输入信号经过权重和偏置的加权求和后等于零。在神经网络中,预激活通常是通过对输入信号进行线性变换得到的,即尚未应用激活函数进行非线性变换的状态。如果预激活为零,那么该神经元对于函数的输出没有任何影响,因为它不会对最终的输出产生贡献。此外,如果神经元的输入连接为零权重,则可以移除该神经元,即该神经元没有重要性。如果输入连接是非零的,则神经元具有重要性。前向信号考虑了数据对特定神经元的影响。In step S2, the forward signal is typically represented by a preactivation value. When the pre-activation of a neuron is zero, it means that the input signal of the neuron is equal to zero after the weighted sum of weights and biases. In neural networks, pre-activation is usually obtained by linear transformation of the input signal, that is, a state where the activation function has not yet been applied for non-linear transformation. If the preactivation is zero, then the neuron has no effect on the output of the function because it does not contribute to the final output. Furthermore, a neuron can be removed if its input connection has zero weight, i.e. it has no importance. A neuron has significance if its input connections are non-zero. The forward signal takes into account the impact of the data on a specific neuron.
在步骤S3中,反向信号通常是通过反向传播损失得到的。当神经元的输出连接为零时,即使神经元的激活程度为正,它对函数的影响也是无关紧要的。梯度提供了当神经元被移除时,函数或损失如何变化的信息。In step S3, the reverse signal is usually obtained by backpropagation loss. When a neuron's output connection is zero, its effect on the function is insignificant, even if the neuron's activation level is positive. The gradient provides information about how the function or loss changes when neurons are removed.
在神经网络的反向传播过程中,首先计算损失函数对网络输出的梯度,然后将这个梯度沿着网络的连接进行反向传播,从而计算每个神经元的梯度。这个反向传播的过程可以给出神经元的梯度信息,即梯度指示了当神经元被移除时,损失函数的变化情况。如果神经元的输出连接权重为零,意味着它对后续层神经元的输出没有任何影响。即使该神经元具有正的激活程度,它对函数的结果或损失的影响仍然是微不足道的。因此,在计算梯度时,这样的神经元对整个网络的贡献被认为是不重要的。通过计算神经元的梯度,可以了解到当移除神经元时,函数或损失函数的变化情况。In the back propagation process of the neural network, the gradient of the loss function on the network output is first calculated, and then this gradient is back propagated along the connections of the network to calculate the gradient of each neuron. This backpropagation process can give the gradient information of the neuron, that is, the gradient indicates the change of the loss function when the neuron is removed. If the output connection weight of a neuron is zero, it means that it has no effect on the output of subsequent layers of neurons. Even if the neuron has positive activation, its impact on the result or loss of the function will still be negligible. Therefore, the contribution of such neurons to the overall network is considered unimportant when computing gradients. By calculating the gradient of a neuron, you can learn how the function or loss function changes when the neuron is removed.
在步骤S4中,所述结合前向和后向信号,得到神经元对给定数据的损失或函数的影响包含以下部分:In step S4, combining the forward and backward signals to obtain the impact of the neuron on the loss or function of the given data includes the following parts:
1)对于数量为M的数据集,U-Net网络中每个神经元的重要性度量Ii可由下述公式(1)得到1) For a data set with a number of M, the importance measure I i of each neuron in the U-Net network can be obtained by the following formula (1)
其中xi是预激活,δxi是其梯度。上述公式满足了如果传入或传出连接为零,重要性应该很低,否则重要性更高的规则。where xi is the preactivation and δxi is its gradient. The above formula satisfies the rule that if there are zero incoming or outgoing connections, the importance should be low, otherwise the importance should be higher.
2)上述1)得到的重要性度量Ii类似于泰勒一阶展开式。该度量指标在梯度为负时给出较低的重要性,然而这是一个问题,因为即使它对于反向传播中梯度重要性较低,去除它也会导致损失函数发生显著变化。因此,对1)中重要性度量Ii进行了平方,增加反向传播中梯度为负的神经元的重要性。改进后的重要性度量Ii如公式(2)2) The importance measure I i obtained in 1) above is similar to Taylor's first-order expansion. This metric gives less importance when the gradient is negative, however this is a problem because even if it has low importance for the gradient in backpropagation, removing it will cause a significant change in the loss function. Therefore, the importance measure I i in 1) is squared, increasing the importance of neurons with negative gradients in backpropagation. The improved importance measure I i is as formula (2)
所示。shown.
其中代表重要性度量Ii的平方(square)。in Represents the square of the importance measure I i .
3)在计算梯度过程中,不同的输入样本可能会产生不同幅度的梯度。3) During the gradient calculation process, different input samples may produce gradients of different magnitudes.
由于梯度的幅度对于计算重要性至关重要,因此不同的输入样本对于整体重要性得分的贡献是不同的。为了解决这个问题,需要对梯度进行归一化处理,使其具有相同的幅度,通常将其归一化为1。Since the magnitude of the gradient is crucial for calculating importance, different input samples contribute differently to the overall importance score. To solve this problem, the gradients need to be normalized so that they have the same magnitude, usually normalized to 1.
这样可以确保每个数据点在计算重要性时具有相等的贡献。通过对梯度进行归一化,可以消除梯度幅度差异,确保每个输入样本在计算重要性时具有相同的权重。这样可以确保不同输入样本对于整体重要性分数的计算具有公平的贡献。无论是产生较大梯度幅度的样本还是产生较小梯度幅度的样本,它们的贡献都会被平等地考虑。This ensures that each data point contributes equally when calculating importance. By normalizing the gradients, gradient magnitude differences are eliminated, ensuring that each input sample has the same weight when calculating importance. This ensures that different input samples contribute fairly to the calculation of the overall importance score. Whether they are samples that produce larger gradient magnitudes or samples that produce smaller gradient magnitudes, their contributions are considered equally.
步骤S5中,所述模型参数修剪是在大小为N的数据集D∈[x0,x1,…,xn]进行修剪。在神经网络中,其输入输出可以简单的表示为:yn=f(xn),目标tn是希望模型预测或分类的标签。对于每个目标tn,计算其相对于每个输入xn的梯度,这样可以揭示出对于给定目标的期望输出,每个输入对于输出的贡献程度。公式如(3)所示。In step S5, the model parameter pruning is performed on a data set D∈[x 0 , x 1 ,..., x n ] of size N. In a neural network, its input and output can be simply expressed as: y n =f(x n ), and the target t n is the label that the model is expected to predict or classify. For each target t n , calculate its gradient with respect to each input x n , which can reveal the expected output for a given target and how much each input contributes to the output. The formula is shown in (3).
然后将梯度Δyn进行归一化:Then normalize the gradient Δy n :
之后,将该梯度进行反向传播以计算每个卷积核的重要性度量Ii的平方/> Afterwards, this gradient Backpropagation is performed to calculate the square of the importance measure I i for each convolution kernel/>
对于上述步骤,本专利在U-Net模型上使用Kvasir息肉分割数据集进行验证,首先,计算给定数据集上每个神经元的重要性分数。其次,根据重要性度量(Is)剪枝掉总共N个神经元/通道中的P个最不重要的神经元/通道。通过将重要性得分从高到低进行排序,并选择最低的P个得分进行剪枝。For the above steps, this patent uses the Kvasir polyp segmentation data set for verification on the U-Net model. First, the importance score of each neuron on the given data set is calculated. Secondly, prune out the P least important neurons/channels out of the total N neurons/channels according to the importance measure (Is). By sorting the importance scores from high to low, and selecting the lowest P scores for pruning.
尽管已经示出和描述了本发明的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本发明的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由所附权利要求及其等同物限定。Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art will understand that various changes, modifications, and substitutions can be made to these embodiments without departing from the principles and spirit of the invention. and modifications, the scope of the invention is defined by the appended claims and their equivalents.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311156130.XA CN117291250A (en) | 2023-09-08 | 2023-09-08 | Neural network pruning method for image segmentation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311156130.XA CN117291250A (en) | 2023-09-08 | 2023-09-08 | Neural network pruning method for image segmentation |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117291250A true CN117291250A (en) | 2023-12-26 |
Family
ID=89247227
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311156130.XA Pending CN117291250A (en) | 2023-09-08 | 2023-09-08 | Neural network pruning method for image segmentation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117291250A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117808072A (en) * | 2024-02-28 | 2024-04-02 | 苏州元脑智能科技有限公司 | Model pruning method, image processing method, device, equipment and medium |
-
2023
- 2023-09-08 CN CN202311156130.XA patent/CN117291250A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117808072A (en) * | 2024-02-28 | 2024-04-02 | 苏州元脑智能科技有限公司 | Model pruning method, image processing method, device, equipment and medium |
CN117808072B (en) * | 2024-02-28 | 2024-05-14 | 苏州元脑智能科技有限公司 | Model pruning method, image processing method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111402268B (en) | A Method for Segmenting the Liver and Its Lesions in Medical Images | |
CN109145939B (en) | A Small Object-Sensitive Two-Channel Convolutional Neural Network Semantic Segmentation Method | |
CN108510012B (en) | Target rapid detection method based on multi-scale feature map | |
CN109583501B (en) | Method, device, equipment and medium for generating image classification and classification recognition model | |
CN110781924B (en) | Side-scan sonar image feature extraction method based on full convolution neural network | |
CN114758288B (en) | Power distribution network engineering safety control detection method and device | |
CN110879982B (en) | A crowd counting system and method | |
CN112446891A (en) | Medical image segmentation method based on U-Net network brain glioma | |
CN117372278A (en) | Point cloud denoising method based on multiscale distribution score | |
CN111145145B (en) | Image surface defect detection method based on MobileNet | |
CN113158789B (en) | Target detection method, system, device and medium for remote sensing image | |
CN115641443B (en) | Method for training image segmentation network model, method for processing image and product | |
CN111931641A (en) | Pedestrian re-identification method based on weight diversity regularization and application thereof | |
CN116311083A (en) | A crowd counting model training method and system | |
CN117291250A (en) | Neural network pruning method for image segmentation | |
CN111488786A (en) | Method and device for object detector for monitoring based on CNN | |
CN119559403B (en) | High-resolution remote sensing image semantic segmentation method based on multi-scale depth supervision | |
CN115965874A (en) | A crop disease identification method, system, device and storage medium | |
CN116433552A (en) | Method and related device for constructing focus image detection model in dyeing scene | |
CN112508863B (en) | A dual-channel target detection method based on RGB images and MSR images | |
CN114492755A (en) | Object Detection Model Compression Method Based on Knowledge Distillation | |
CN113205534A (en) | Retinal vessel segmentation method and device based on U-Net + | |
CN117636183A (en) | A small-sample remote sensing image classification method based on self-supervised pre-training | |
Huang et al. | DeeptransMap: a considerably deep transmission estimation network for single image dehazing | |
CN117011515A (en) | Interactive image segmentation model based on attention mechanism and segmentation method thereof |
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 |