ShuffleNet 小结

ref: https://blog.csdn.net/weixin_38740463/article/details/89924345

最主要的特点(优点)是使用 channel shuffle 改变数据流向,大幅度减小模型参数量和计算量。

  1. channel shuffle解决什么问题?
    解决利用Group在组间进行深度卷积造成的边界效应。
    利用group ,在组间进行深度卷积。
    优点:极大减小计算量(FLOPS)。由于每个filter不再是和输入的全部feature map做卷积,而是仅仅和一个group的feature map做卷积。
    缺点:边界效应产生,即某个输出channel仅仅来自输入channel的一小部分

  2. channel shuffle 是怎样操作的?

    实际上是一个均匀的混合,代码也很简单,使用一个transpose操作交换分组再reshape回来,是一个均匀的混合。

def channel_shuffle(x, groups):
    batchsize, num_channels, height, width = x.data.size()
    channels_per_group = num_channels // groups

    # reshape
    x = x.view(batchsize, groups,
               channels_per_group, height, width)

    x = torch.transpose(x, 1, 2).contiguous()

    # flatten
    x = x.view(batchsize, -1, height, width)

    return x
原文地址:https://www.cnblogs.com/wioponsen/p/13825454.html