Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Keras · Class

layers.Conv3D

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.

How it works

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.

Syntax

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)

Parameters

NameTypeDescription
filtersintNumber of output filters.
kernel_sizeint or tuple/list of 3 integers3D convolution window size; an integer or three integers.
stridesint or tuple/list of 3 integersConvolution stride; an integer or three integers.
paddingstringPadding mode: valid or same.
data_formatstring or NoneChannel ordering, such as channels_last or channels_first.
dilation_rateint or tuple/list of 3 integersDilation rate; an integer or three integers.
groupsintNumber of groups for grouped convolution.
activationactivation function or NoneActivation function.
use_biasboolWhether to include a bias vector.
kernel_initializerinitializerInitializer for the kernel.
bias_initializerinitializerInitializer for the bias.
kernel_regularizerregularizer or NoneRegularizer for the kernel.

Returns

A 5D tensor representing activation(conv3d(inputs, kernel) + bias).

Key points

  • The kernel operates across three spatial or temporal axes.
  • filters sets how many output feature channels the layer produces.
  • kernel_size accepts one integer or three integers describing the window.
  • strides controls the step size along each convolution axis.
  • dilation_rate spaces kernel elements for dilated convolution.
  • use_bias adds a trainable bias vector when enabled.
  • activation is applied after convolution and bias addition when provided.

Common mistakes

  • Do not combine a stride greater than 1 with a dilation rate greater than 1.
  • The documented padding choices are only valid and same.

Example: Basic 3D convolution

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.

When to use it

Extract features from 3D medical or scientific images.

Volumetric image processing

Learn local patterns across depth, height, and width or time-related axes.

Video or spatiotemporal modeling

Build feature-extraction stages for volumetric classification or segmentation models.

3D encoder networks

Interview questions

QWhat does Conv3D compute?

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.

QWhat do filters and kernel_size control?

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.

QWhat is the output of Conv3D?

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.

  • Conv1D
  • Conv2D
  • Conv3DTranspose
  • ConvLSTM3D

Source: Keras documentation: Conv3D layer. Checked 2026-10-15.