Convolutions
Conv1D
-
layer eddl::Conv1D(layer parent, int filters, vector<int> kernel_size, vector<int> strides = {1}, string padding = "same", bool use_bias = true, int groups = 1, const vector<int> dilation_rate = {1}, string name = "")
1D Convolution layer.
- Parameters
parent – Parent layer
filters – Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution)
kernel_size – Vector of 1 integers, specifying the height and width of the 2D convolution window
strides – Vector of 1 integers, specifying the strides of the convolution along the height and width
padding – One of “none”, “valid” or “same”
use_bias – Boolean, whether the layer uses a bias vector
groups – Number of blocked connections from input channels to output channels
dilation_rate – Vector of 1 integers, specifying the dilation rate to use for dilated convolution
name – A name for the operation
- Returns
Convolution layer
Example:
l = Conv1D(l, 16, {3}, {1});
Conv2D
-
layer eddl::Conv2D(layer parent, int filters, const vector<int> &kernel_size, const vector<int> &strides = {1, 1}, string padding = "same", bool use_bias = true, int groups = 1, const vector<int> &dilation_rate = {1, 1}, string name = "")
2D Convolution layer.
- Parameters
parent – Parent layer
filters – Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution)
kernel_size – Vector of 2 integers, specifying the height and width of the 2D convolution window
strides – Vector of 2 integers, specifying the strides of the convolution along the height and width
padding – One of “none”, “valid” or “same”
use_bias – Boolean, whether the layer uses a bias vector
groups – Number of blocked connections from input channels to output channels
dilation_rate – Vector of 2 integers, specifying the dilation rate to use for dilated convolution
name – A name for the operation
- Returns
Convolution layer
Example:
l = Conv2D(l, 32, {3,3}, {1,1});
Conv3D
-
layer eddl::Conv3D(layer parent, int filters, const vector<int> &kernel_size, const vector<int> &strides = {1, 1, 1}, string padding = "same", bool use_bias = true, int groups = 1, const vector<int> &dilation_rate = {1, 1, 1}, string name = "")
3D Convolution layer.
- Parameters
parent – Parent layer
filters – Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution)
kernel_size – Vector of 3 integers, specifying the depth, height and width of the 3D convolution window
strides – Vector of 3 integers, specifying the strides of the convolution along the depth, height and width
padding – One of “none”, “valid” or “same”
use_bias – Boolean, whether the layer uses a bias vector
groups – Number of blocked connections from input channels to output channels
dilation_rate – Vector of 3 integers, specifying the dilation rate to use for dilated convolution
name – A name for the operation
- Returns
Convolution layer
l = Conv3D(l, 32, {3, 3, 3}, {1, 1, 1}, "same");
Pointwise Convolution 2D
-
layer eddl::PointwiseConv2D(layer parent, int filters, const vector<int> &strides = {1, 1}, bool use_bias = true, int groups = 1, const vector<int> &dilation_rate = {1, 1}, string name = "")
Pointwise 2D convolution.
- Parameters
parent – Parent layer
filters – Integer, the dimensionality of the output space (i.e. the number of output filters in the convolution)
strides – Vector of 2 integers, specifying the strides of the convolution along the height and width
use_bias – Boolean, whether the layer uses a bias vector
groups – Number of blocked connections from input channels to output channels
dilation_rate – Vector of 2 integers, specifying the dilation rate to use for dilated convolution
name – A name for the operation
- Returns
Convolution layer
Example:
l = PointwiseConv2D(l, 32, {3,3}, {1,1});
Depthwise Convolution 2D
-
layer eddl::DepthwiseConv2D(layer parent, const vector<int> &kernel_size, const vector<int> &strides = {1, 1}, string padding = "same", bool use_bias = true, const vector<int> &dilation_rate = {1, 1}, string name = "")
DepthwiseConv 2D convolution.
- Parameters
parent – Parent layer
kernel_size – The depth, height and width of the convolution window
strides – Vector of 2 integers, specifying the strides of the convolution along the height and width
use_bias – Boolean, whether the layer uses a bias vector
dilation_rate – Vector of 2 integers, specifying the dilation rate to use for dilated convolution
name – A name for the operation
- Returns
Convolution layer
Example:
l = DepthwiseConv2D(l, {3,3}, {1,1});
2D UpSampling
Soon to be deprecated. We recommend the use of the Resize layer.
-
layer eddl::UpSampling2D(layer parent, const vector<int> &size, string interpolation = "nearest", string name = "")
2D Upsampling layer.
Identical to the
scale
transformation, it is an alias of the Resize layer.- Parameters
parent – Parent layer
size – Vector of 2 integers. The upsampling factors for rows and columns
interpolation – (Deprecated) A string, only “nearest” is valid
name – A name for the operation
- Returns
Output layer after upsampling operation
Example:
l = UpSampling2D(l, {2, 2});
3D UpSampling
UpSampling for 3D images
-
layer eddl::UpSampling3D(layer parent, vector<int> new_shape, bool reshape = true, string da_mode = "constant", float constant = 0.0f, string coordinate_transformation_mode = "asymmetric", string name = "")
3D Upsampling layer. Similar to Resize but for 3D images
- Parameters
parent – Parent layer
new_shape – Vector with layer/images desired new shape
reshape – If True, the output shape will be new_shape (classical scale; recommended). If False, the output shape will be the input shape (scale<100%: scale + padding; scale >100%: crop + scale)
da_mode – One of “nearest”, “constant”, (ToDo: “mirror”, “reflect”, “wrap”, “original”)
constant – Fill value for area outside the resized image, it is used for all channels respectively
coordinate_transformation_mode – This attribute describes how to transform the coordinate in the resized tensor to the coordinate in the original tensor.
- Returns
Output of scale transformation
Example:
l = UpSampling3D(l, {32, 32, 32});
2D Convolutional Transpose
-
layer eddl::ConvT2D(layer parent, int filters, const vector<int> &kernel_size, const vector<int> &strides = {1, 1}, string padding = "same", bool use_bias = true, int groups = 1, const vector<int> &dilation_rate = {1, 1}, string name = "")
2D Transposed convolution layer (sometimes called Deconvolution).
The need for transposed convolutions generally arises from the desire to use a transformation going in the opposite direction of a normal convolution, i.e., from something that has the shape of the output of some convolution to something that has the shape of its input while maintaining a connectivity pattern that is compatible with said convolution.
- Parameters
parent – Parent layer
filters – The dimensionality of the output space (i.e. the number of output filters in the convolution)
kernel_size – The height and width of the 2D convolution window
padding – One of “valid” or “same”
dilation_rate – The dilation rate to use for dilated convolution. Spacing between kernel elements
strides – The strides of the convolution along the height and width
use_bias – Boolean, whether the layer uses a bias vector
name – A name for the operation
- Returns
Output layer after upsampling operation
l = ConvT2D(l, 32, {3, 3}, {1, 1}, "same");
3D Convolutional Transpose
-
layer eddl::ConvT3D(layer parent, int filters, const vector<int> &kernel_size, const vector<int> &strides = {1, 1, 1}, string padding = "same", bool use_bias = true, int groups = 1, const vector<int> &dilation_rate = {1, 1, 1}, string name = "")
3D Transposed convolution layer (sometimes called Deconvolution).
The need for transposed convolutions generally arises from the desire to use a transformation going in the opposite direction of a normal convolution, i.e., from something that has the shape of the output of some convolution to something that has the shape of its input while maintaining a connectivity pattern that is compatible with said convolution.
- Parameters
parent – Parent layer
filters – The dimensionality of the output space (i.e. the number of output filters in the convolution)
kernel_size – The depth, height and width of the 3D convolution window
padding – One of “valid” or “same”
dilation_rate – The dilation rate to use for dilated convolution. Spacing between kernel elements
strides – The strides of the convolution along the depth, height and width
use_bias – Boolean, whether the layer uses a bias vector
name – A name for the operation
- Returns
Output layer after upsampling operation
l = ConvT3D(l, 32, {3, 3, 3}, {1, 1, 1}, "same");