CReorgLayer Class
June 14, 2020 ยท View on GitHub
This class implements a layer that transforms a set of two-dimensional multi-channel images into a set of images of smaller size but with more channels. This operation is used in YOLO architecture.
Settings
Resize factor
void SetStride( int stride );
Sets the value by which the image size will be divided in the final result. The image size along either dimension should be a multiple of this value. The value should be greater than 1.
Trainable parameters
The layer has no trainable parameters.
Inputs
The single input accepts a blob with the images, of the dimensions:
BatchLength * BatchWidth * ListSizeis equal to the number of imagesHeightis the image height; should be a multiple ofGetStride()Widthis the image width; should be a multiple ofGetStride()Depthis equal to1Channelsis the number of channels in the image format
Outputs
The single output contains a blob with the resulting images, of the dimensions:
BatchLengthis equal to the inputBatchLengthBatchWidthis equal to the inputBatchWidthListSizeis equal to the inputListSizeHeightis equal to the inputHeight / GetStride()Widthis equal to the inputWidth / GetStride()Depthis equal to1Channelsis equal to the inputChannels * GetStride() * GetStride()
Each image in the set is split in the same way as the following sample.
Assume we have a 2-channel image 4 by 6, and GetStride() is 2. The image pixel values are:
// First channel contents
1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24,
// Second channel contents
25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48
This image will be transformed into a 8-channel image 2 by 3, with the contents:
// First channel contents
1, 3, 5,
7, 9, 11,
// Second channel contents
25, 27, 29,
31, 33, 35,
// Third channel contents
13, 15, 17,
19, 21, 23,
// Fourth channel contents
37, 39, 41,
43, 45, 47
// Fifth channel contents
2, 4, 6,
8, 10, 12,
// Sixth channel contents
26, 28, 30,
32, 34, 36,
// Seventh channel contents
14, 16, 18,
20, 22, 24,
// Eighth channel contents
38, 40, 42,
44, 46, 48