keras-team/keras · error · ValueError
Input size must be at least 32x32; Received `input_shape=
Error message
Input size must be at least 32x32; Received `input_shape={input_shape}` What it means
MobileNetV3 builder in keras/src/applications/mobilenet_v3.py: after resolving input_shape (from arguments or input_tensor), any spatial dimension below 32 is rejected, because the MobileNetV3 stem and downsampling stages require at least 32x32 pixels to produce usable feature maps.
Solutions
- Resize images to at least 32x32 (ideally the 224x224 default) before inference/training
- Update input_shape (or the input tensor's shape) to meet the 32x32 minimum
- Choose a lighter model variant instead of shrinking inputs below the limit
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/applications/mobilenet_v3.py:266 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/e3bb6f1a281bb74c.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/applications/mobilenet_v3.py:266
else:
rows = input_tensor.shape[1]
cols = input_tensor.shape[2]
input_shape = (cols, rows, 3)
# If input_shape is None and input_tensor is None using standard shape
if input_shape is None and input_tensor is None:
if backend.image_data_format() == "channels_last":
input_shape = (None, None, 3)
else:
input_shape = (3, None, None)
if backend.image_data_format() == "channels_last":
row_axis, col_axis = (0, 1)
else:
row_axis, col_axis = (1, 2)
rows = input_shape[row_axis]
cols = input_shape[col_axis]
if rows and cols and (rows < 32 or cols < 32):
raise ValueError(
"Input size must be at least 32x32; Received `input_shape="
f"{input_shape}`"
)
if weights == "imagenet":
if (
not minimalistic
and alpha not in [0.75, 1.0]
or minimalistic
and alpha != 1.0
):
raise ValueError(
"If imagenet weights are being loaded, "
"alpha can be one of `0.75`, `1.0` for non minimalistic "
"or `1.0` for minimalistic only."
)
if rows != cols or rows != 224:
warnings.warn(View on GitHub (pinned to 7a34a03db6)