Extract features from 3D medical or scientific images.
Volumetric image processing
Keras · Class
Conv3D applies a learned kernel across three spatial or temporal dimensions to produce volumetric feature maps. It supports configurable filters, kernel size, strides, padding, dilation, activation, bias, grouping, initialization, regularization, and constraints.
Conv3D slides a learned kernel across three spatial or temporal dimensions and emits one value per output filter at each location. It can add a bias and apply an activation after convolution; the input and output are rank-5 tensors, with channel placement determined by data_format.
keras.layers.Conv3D(filters, kernel_size, strides=(1, 1, 1), padding="valid", data_format=None, dilation_rate=(1, 1, 1), groups=1, activation=None, use_bias=True, kernel_initializer="glorot_uniform", bias_initializer="zeros", kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None, **kwargs)| Name | Type | Description |
|---|---|---|
filters | int | Number of output filters. |
kernel_size | int or tuple/list of 3 integers | 3D convolution window size; an integer or three integers. |
strides | int or tuple/list of 3 integers | Convolution stride; an integer or three integers. |
padding | string | Padding mode: valid or same. |
data_format | string or None | Channel ordering, such as channels_last or channels_first. |
dilation_rate | int or tuple/list of 3 integers | Dilation rate; an integer or three integers. |
groups | int | Number of groups for grouped convolution. |
activation | activation function or None | Activation function. |
use_bias | bool | Whether to include a bias vector. |
kernel_initializer | initializer | Initializer for the kernel. |
bias_initializer | initializer | Initializer for the bias. |
kernel_regularizer | regularizer or None | Regularizer for the kernel. |
A 5D tensor representing activation(conv3d(inputs, kernel) + bias).
import keras
x = keras.Input(shape=(16, 32, 32, 3))
y = keras.layers.Conv3D(32, 3, activation="relu")(x)
model = keras.Model(x, y)
print(model.output_shape)Creates a 3D convolution with 32 output filters and a cubic kernel of size 3, then applies ReLU.
Volumetric image processing
Video or spatiotemporal modeling
3D encoder networks
Conv3D performs convolution over three dimensions and produces one output channel for each filter. With bias enabled, it computes the convolution, adds the bias, and then applies the optional activation.
Follow-up: What constraint applies to strides and dilation_rate? They cannot both use values greater than 1.
filters determines the output-space size, or number of convolution filters. kernel_size determines the 3D window dimensions and may be one integer or a sequence of three integers.
Follow-up: How can one integer be used for kernel_size? It specifies the same window size in all three dimensions.
The layer returns a rank-5 tensor representing activation(conv3d(inputs, kernel) + bias). The exact spatial arrangement depends on padding, strides, data_format, and the input shape.
Follow-up: What changes when data_format is channels_last? The channels dimension is placed last in the rank-5 tensor.
Conv1DConv2DConv3DTransposeConvLSTM3D