• Stars
    star
    106
  • Rank 325,871 (Top 7 %)
  • Language
    C++
  • Created over 7 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Caffe re-implementation of ShuffleNet

Caffe Re-implementation of ShuffleNet: An Extremely Efficient CNN for Mobile Devices

Reimplementation of ShuffleNet, may differ from Zhang's idea.

How to understand Channel Shuffle?

Our narrow view:

  • [Pattern 0 (Deprecated)] Output Featuremap from N x C x [H x W] to N x [H x W] x C but still keeps former shape format.*
    *: Based on paper's description "Tansposing and then flattening it back ...", to be honest, we didn't get it, just a Pretty Naive re-implementation. In this pattern, next layer won't know the input data structure has been changed to N x [H x W] x C, the spatial relationship of next layer input featuremap will be different.
  • [Pattern 1] Output Featuremap keeps the previous shape N x C x [H x W], just exchange some channels between different groups.**
    **:This pattern will shuffle channels between all groups under the constraint of CHECK((channels/group)%group == 0). In other cases, one may trun to Camel's implementation for more details.

Pattern 1 Diagram

Group 1 Group 2 Group 3 State
1 2 3 4 5 6 7 8 9 Before Shuffle
1 4 7 2 5 8 3 6 9 After that

How to use?

caffe.proto:

message LayerParameter {
...
optional ChannelShuffleParameter channel_shuffle_param = 164;
...
}
...
message ChannelShuffleParameter {
  optional int32 shuffle_pattern = 1 [default = 1]; // 0 or 1, so far two patterns.
  optional int32 shuffle_channel_num = 2 [default = 1]; // exchange how many channels each time [pattern 1]
  // group number, the same as previous ConV layer setting [pattern 1]
  optional uint32 group = 3 [default = 1]; 
}

.prototxt :

layer {
  name: "ChnlShf"
  type: "ChannelShuffle"
  bottom: "Gconv"
  top: "ChnlShf"
  channel_shuffle_param {
    shuffle_pattern: 0 # 0 or 1 as explained above
    group: 4 # the same as previous GConV Layer
    shuffle_channel_num: 1 # exchange how many channels each time
  }
}

Citation

@article{ShuffleNet,
  Author = {Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, Jian Sun},
  Journal = {arXiv preprint arXiv:1707.01083},
  Title = {ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices},
  Year = {2017}
}

Acknowledgement

Thanks Camel007 for idea sharing.

More Repositories

1

ResNet-18-Caffemodel-on-ImageNet

ResNet-18 Caffemodel @ilsvrc12 shrt 256 with Top-1 69% Top-5 89%
190
star
2

CNN-Inference-Engine-Quick-View

A quick view of high-performance convolution neural networks (CNNs) inference engines on mobile devices.
151
star
3

OISR-PyTorch

PyTorch implementation of "ODE-inspired Network Design for Single Image Super-Resolution"(CVPR2019)
Python
134
star
4

Training-Tricks-for-Binarized-Neural-Networks

The collection of training tricks of binarized neural networks.
71
star
5

Location-aware-Upsampling-for-Semantic-Segmentation

The Pytorch implementation of "Location-aware Upsampling for Semantic Segmentation" (LaU)
Jupyter Notebook
52
star
6

SNNs-Self-Normalizing-Neural-Networks-Caffe-Reimplementation

Caffe re-implementation of SNNs.
C++
46
star
7

Zero-shot-Style-Transfer-via-Attention-Rearrangement

Official implementation of the paper "Zβˆ—: Zero-shot Style Transfer via Attention Rearrangement" a.k.a. "Zβˆ—: Zero-shot Style Transfer via Attention Reweighting" (CVPR2024)
Python
42
star
8

EDSR-ssim

Different SSIM metrics in CNN-based super resolution algorithms (e.g., EDSR CVPRW2017, RDN CVPR2018, MSRN ECCV2018).
38
star
9

Caffe-Computation-Graph-Optimization

Caffe Computation Graph Optimization.
Python
29
star
10

K-Nearest-Neighbors-Hashing

Matlab implementation of "K-Nearest Neighbors Hashing" (CVPR2019)
MATLAB
28
star
11

Compact-Global-Descriptor

Pytorch implementation of "Compact Global Descriptor for Neural Networks" (CGD).
Python
25
star
12

AIM2020-Real-Super-Resolution

Our solution to AIM2020 Real Image Super-Resolution Challenge (x2)
Python
21
star
13

Dynamic-Network-Surgery-Caffe-Reimplementation

Caffe re-implementation of dynamic network surgery.
C++
18
star
14

A-Variation-of-Dice-coefficient-Loss-Caffe-Layer

Compute the variation of dice coefficient loss for real-value regression task.
C++
18
star
15

Optimal-Ternary-Weights-Approximation

Caffe implementation of Optimal-Ternary-Weights-Approximation in "Two-Step Quantization for Low-bit Neural Networks" (CVPR2018).
Cuda
14
star
16

PyTorch-MixNet-SS

Extremely light-weight MixNet with Top-1 75.7% and 2.5M params
Python
7
star
17

AlexNet-BN-Caffemodel-on-ImageNet

AlexNet-BN Caffemodel @ilsvrc12 shrt 256 with Top-1 60.43% Top-5 82.47%
6
star
18

UCAS-Pattern-Recognition

The implementations of programming homeworks in UCAS PR class. (Autumn 2017-2018).
MATLAB
6
star
19

Label-free-Network-Compression

Caffe implementation of "Learning Compression from Limited Unlabeled Data" (ECCV2018).
Python
6
star
20

News-Spider

Tencent NetEase SouHu etc. news spider. Including date, title, body and comments of the news.
Python
5
star
21

Bias-Variance-Decomposition-for-KL-Divergence

This repository includes some detailed proofs of "Bias Variance Decomposition for KL Divergence".
3
star