Comments (4)
增加: 对于Depthwise Convolution, 也就是group卷积, 即将输入feature map 与卷积核分组. 例子中是分为三组(分组的时候保证能整除), 然后对应的卷积核与特征图进行普通卷积, 也就是例子中的每个卷积核针对一个通道.
from bobo-y.github.io.
shufflenet 也是基于group 卷积的, 但多了channel shuffle, 这么做的原因在于, ShuffleNet的本质是将卷积运算限制在每个Group内, 因此模型的计算量取得了显著的下降. 然而导致模型的信息流限制在各个Group内, 组与组之间没有信息交换, 影响模型的表示能力. 因此引入组间信息交换的机制
from bobo-y.github.io.
group convolution层另一个问题是不同组之间的特征图需要通信,否则就好像分了几个互不相干的路,大家各走各的,会降低网络的特征提取能力,这也可以解释为什么Xception,MobileNet等网络采用密集的1x1 pointwise convolution,因为要保证group convolution之后不同组的特征图之间的信息交流。
为达到特征通信的目的,shufflenet的channel shuffle, 其含义就是对group convolution之后的特征图进行“重组”,这样可以保证接下了采用的group convolution其输入来自不同的组,因此信息可以在不同组之间流转。
其过程为reshape,转置,reshape,分组groups一般设置为2
def channel_shuffle(x, groups):
# type: (torch.Tensor, int) -> torch.Tensor
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
from bobo-y.github.io.
如数组 [[1, 2, 3],[4, 5, 6]], 行列转置后 [[1, 4],[2, 5],[3, 6]], 再reshape 为原形得到 [[1, 4, 2],[5, 3, 6]], 进行了特征的洗牌
from bobo-y.github.io.
Related Issues (7)
- post/cyclegan/ HOT 1
- about/ HOT 3
- post/docker%E5%B0%8F%E8%AE%B0/ HOT 1
- post/reid%E4%B9%8B%E8%B7%AF%E4%B8%80/ HOT 2
- post/reid%E4%B9%8B%E8%B7%AF%E4%BA%8C-loss/ HOT 2
- post/keras_dataload/ HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bobo-y.github.io.