模型裁剪--Rethinking the Value of Network Pruning

Rethinking the Value of Network Pruning
https://github.com/Eric-mingjie/rethinking-network-pruning

网络模型裁剪价值的重新思考

当前的深度学习网络模型一般都是 heavy computational cost,如何降低其计算量而尽可能保持网络性能是一个重要的研究课题。

在这里插入图片描述

标准的模型裁剪三部曲是:1)训练一个 large, over-parameterized network,得到最佳网络性能,以此为基准;2)基于一定的准则来裁剪大网络模型;3)在数据集上微调裁剪后的网络模型

在这个裁剪的过程中,存在两个 common beliefs:
1)一般认为一开始训练一个 large, over-parameterized network 是很重要的,以大模型的性能为基准进行裁剪,一般认为这个方式比从头训练一个小模型的方式是更好的。
2)一般认为裁剪后的网络模型结构及其参数权重都很重要。所以目前大部分方法都是在裁剪后的模型上进行微调,The preserved weights after pruning are usually considered to be critical

本文经过大量实验得出了两个较意外的结论:
1) 如果我们的目标小模型是事先确定的,那么可以直接在数据集上训练此模型,得到的性能是最佳的,不比微调的性能差

First, for pruning algorithms with predefined target network architectures (Figure 2), directly training the small target model
from random initialization can achieve the same, if not better, performance, as the model obtained from the three-stage pipeline. In this case, starting with a large model is not necessary and one could instead directly train the target model from scratch。

2)对于目标模型不是事先确定的情况,从头开始训练裁剪后的模型,其得到的网络性能也是最好的,不比微调的差。
for pruning algorithms without a predefined target network, training the pruned model from scratch can also achieve comparable or even better performance than fine-tuning. This observation shows that for these pruning algorithms,
what matters is the obtained architecture, instead of the preserved weights,

模型裁剪的过程本质上可能是一个最优网络结构的搜索过程
our results suggest that the value of automatic pruning algorithms may lie in identifying efficient structures and performing implicit architecture search, rather than selecting “important” weights

predefined and non-predefined (automatically discovered) target architectures
在这里插入图片描述

predefined target architectures 这里我们举一个例子来说明一下: prune 50% channels in each layer of VGG,不管是哪个具体的 channels 被裁剪,最终的网络结构是一样的。因为 the pruning algorithm 将每个网络层中 least important 50% channels 裁掉。具体裁剪的比例一般是经验或尝试决定 the ratio in each layer is usually selected through empirical studies or heuristics

网络模型可以使用以下几个指标来描述:
model size, memory footprint, the number of computation operations (FLOPs) and power usage

本文选择了三个数据集和三个标准的网络结构
CIFAR-10, CIFAR-100 , and ImageNet
VGG, ResNet, and DenseNet

6个网络裁剪方法:
L1-norm based Channel Pruning (Li et al., 2017)
ThiNet (Luo et al., 2017)
Regression based Feature Reconstruction (He et al., 2017b)
Network Slimming (Liu et al., 2017):
Sparse Structure Selection (Huang & Wang, 2018) :
Non-structured Weight Pruning (Han et al., 2015):

Training Budget. One crucial question is how long should we train the small pruned model from scratch?
如果从头训练小模型,那么训练时间即迭代次数是一个关键的问题

这里我们做了两个尝试:
Scratch-E 表示和训练大模型的迭代次数一样 to denote training the small pruned models for the same epochs
Scratch-B 表示两者的计算量一样(和大模型训练的计算量)to denote training for the same amount of computation budget

4 Experiments
4.1 Predefined target architectures

L1-norm based Channel Pruning (Li et al., 2017):
In each layer, a certain percentage of channels with smaller L1-norm of its filter weights will be pruned
在这里插入图片描述

ThiNet (Luo et al., 2017) greedily prunes the channel that has the smallest effect on the next layer’s activation values
在这里插入图片描述

Regression based Feature Reconstruction (He et al., 2017b)
prunes channels by minimizing the feature map reconstruction error of the next layer

在这里插入图片描述

最终的结论是: 当我们确定了最终的目标网络结构,从头训练小模型比微调小模型更好。从头训练小模型的计算量如果和大模型训练一样,那么其得到的网络性能比微调后的性能一般要好

4.2 Automatically discovered target architectures

Network Slimming (Liu et al., 2017):
imposes L 1 -sparsity on channel-wise scaling factors from Batch Normalization layers (Ioffe & Szegedy, 2015) during
training, and prunes channels with lower scaling factors afterward.

在这里插入图片描述

Sparse Structure Selection (Huang & Wang, 2018) :
uses sparsified scaling factors to prune structures, and can be seen as a generalization of Network Slimming. Other
than channels, pruning can be on residual blocks in ResNet or groups in ResNeXt (Xie et al., 2017)

在这里插入图片描述

Non-structured Weight Pruning (Han et al., 2015):
prunes individual weights that have small magnitudes. This pruning granularity leaves the weight matrices sparse, hence
it is commonly referred to as non-structured weight pruning.
在这里插入图片描述

4.3 Transfer Learning to object detection

we evaluate the L1-norm based pruning method on the PASCAL VOC object detection task, using Faster-RCNN
在这里插入图片描述

Prune-C refers to pruning on classifcation pre-trained weights
Prune-D refers to pruning after the weights are transferred to detection task

5 Network pruning as architecture search
在这里插入图片描述

在这里插入图片描述
不同网络层裁剪的幅度不一样

在这里插入图片描述

11

### Few-shot 3D点云语义分割的研究与方法 Few-shot学习是一种机器学习范式,旨在通过少量样本训练模型来完成特定任务。对于3D点云语义分割而言,这一领域面临的主要挑战在于如何有效提取几何特征以及适应新类别时的数据稀缺问题。 #### 数据增强与元学习 为了应对数据不足的问题,一些研究引入了基于元学习的方法。这些方法通常会构建一个基础网络,在大量已知类别的支持下进行预训练,并通过优化算法快速适配到新的未知类别上。例如,有工作提出了一种原型网络框架,该框架能够通过对不同类别的平均嵌入向量计算距离来进行分类决策[^1]。 #### 图神经网络的应用 由于3D点云本质上是非结构化数据形式,传统卷积操作并不适用。因此,近年来图神经网络(GNNs)被广泛应用于处理此类数据集。具体来说,可以先建立K近邻(KNN)图表示点之间的关系,再利用GNN实现消息传递机制更新节点特征直至收敛后再做最终预测。这种方法充分利用了局部区域内的空间关联特性从而提高了泛化能力尤其适合于few-shot场景下的应用需求。 另外值得注意的是Mask R-CNN虽然主要用于图像实例分割但在某些变体版本里也被扩展到了三维物体检测当中去比如PointRCNN它结合了pointnet++ backbone 和rcnn head共同完成了端到端的目标定位加mask生成过程尽管如此这类两阶段pipeline架构可能不太容易直接迁移到极低标注率条件下所以还需要进一步改进才能满足few-shot setting的要求[^2]. ```python import torch from torch_geometric.nn import GCNConv class SimpleGCN(torch.nn.Module): def __init__(self, input_dim, hidden_dim, output_dim): super(SimpleGCN, self).__init__() self.conv1 = GCNConv(input_dim, hidden_dim) self.conv2 = GCNConv(hidden_dim, output_dim) def forward(self, data): x, edge_index = data.x, data.edge_index x = self.conv1(x, edge_index) x = torch.relu(x) x = self.conv2(x, edge_index) return x ``` 上述代码展示了一个简单的图卷积网络(Graph Convolutional Network),它可以用于处理点云中的邻居关系并进行特征传播,这是许多Few-shot 3D点云语义分割方法的基础组件之一。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值