ShuffleNet
論文:ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices
論文連接:https://arxiv.org/pdf/1707.01083.pdf
降低深度網絡計算
該文章主要採用 channel shuffle 、pointwise group convolutions和depthwise separable convolution來修改原來的ResNet單元。
- 傳統卷積操作:N個feature map ,M個filters。M中的每一個filter均與N個feature map做卷積操作,多對多。
- group卷積 : 將N個feature map和M個filters分爲g個組。對應組的M/g中每個filters均與N/g個feature map做卷積操作。組對組,組內一般卷積操作。
- group卷積相比傳統卷積計算量減少,但會出現邊界效應,特徵受到侷限。提出channel shuffle。
- channel shuffle:對group卷積之後的feature map,對feature map中分好的group進行一個類似交叉重組的方式,如下圖。
def shuffle_channels(x, groups):
batch_size, channels, height, width = x.size()
assert channels % groups == 0
channels_per_group = channels // groups
# split into groups
x = x.view(batch_size, groups, channels_per_group,
height, width)
# transpose 1, 2 axis
x = x.transpose(1, 2).contiguous()
# reshape into orignal
x = x.view(batch_size, channels, height, width)
return x
- pointwise group convolutions:顧名思義,卷積核爲1x1的group convolution。
- depthwise separable convolution:來自MobileNet,博客鏈接。將傳統卷積拆分爲兩步,第一步,N個feature map 對應N個3x3 filters,一對一做卷積操作,得到N個feature map;第二步,N個feature map 對應M個1x1 filters,傳統卷積,得到M個feature map。
下圖abc均改進自ResNet中的bottleneck unit。
a)Xception、Mobilenets unit
b)ShuffleNet unit
c) ShuffleNet unit with stride=2 (改add操作爲concat,channel合併)
網絡結構
實驗數據:
ImageNet classification and MS COCO object detection
實驗結果:
ShuffleNet sx表示將ShuffleNet 1x的filter個數變成s倍。
重要結論:
group個數的線性增長並不會帶來分類準確率的線性增長。
模型對比: