Tor*_*nny 8 neural-network reshape deep-learning caffe
如何重塑形状的团块N x C x H x W,以N x 1 x (C*H) x W在来自Caffe?
我想制作一个卷积层,其权重在通道之间是相同的.
一种方法我想出是重塑形的底部BLOB N x C x H x W,以N x 1 x (C*H) x W和在其上面放置一个卷积层.但我只是不知道如何重塑一个blob.
请帮帮我,谢谢.
正如whjxnyzh所指出的,你可以使用"Reshape"图层.Caffe在允许您定义输出形状方面非常灵活.
请参阅caffe.proto`中的声明reshap_param:
Run Code Online (Sandbox Code Playgroud)// Specify the output dimensions. If some of the dimensions are set to 0, // the corresponding dimension from the bottom layer is used (unchanged). // Exactly one dimension may be set to -1, in which case its value is // inferred from the count of the bottom blob and the remaining dimensions.
在你的情况下,我猜你会有一个像这样的层:
layer {
name: "my_reshape"
type: "Reshape"
bottom: "in"
top: "reshaped_in"
reshape_param { shape: {dim: 0 dim: 1 dim: -1 dim: 0 } }
}
Run Code Online (Sandbox Code Playgroud)
另见caffe.help.
不确定这是否完全符合您的规格,但 Caffe 确实有扁平化层。该斑点从 n * c * h * w 到 n * (c h w) * 1 * 1。
请参阅http://caffe.berkeleyvision.org/tutorial/layers.html