I would like to split the Blob channels in Caffe, so that I can split one Blob of (N, c, w, h)
into two output Blobs of size (N, c/2, w, h)
.
What I have described above is very general, what I want to do actually is to separate a two-channel input image into two different images. One goes to a convolutional layer and the other goes to a pooling layer. Finally, I concatenate the outputs.
So I am wondering if a Caffe layer that allows the user to do such thing exists, and how to define it in the prototxt file.
Mathematically, a blob is an N-dimensional array stored in a C-contiguous fashion. Caffe stores and communicates data using blobs. Blobs provide a unified memory interface holding data; e.g., batches of images, model parameters, and derivatives for optimization.
Caffe is released under the BSD 2-Clause license. Expressive architecture encourages application and innovation. Models and optimization are defined by configuration without hard-coding. Switch between CPU and GPU by setting a single flag to train on a GPU machine then deploy to commodity clusters or mobile devices.
Yes, the Slice
layer is for that purpose. From the Layer Catalogue:
The
Slice
layer is a utility layer that slices an input layer to multiple output layers along a given dimension (currentlynum
orchannel
only) with given slice indices.
To slice a Blob of size N x 2 x H x W
into two Blobs of size N x 1 x H x W
, you have to slice axis: 1
(along channels) at slice_point: 1
(after the first channel):
layer {
name: "slice-conv-pool"
type: "Slice"
bottom: "data"
top: "conv1"
top: "pool1"
slice_param {
axis: 1
slice_point: 1
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With