keras-team/keras · error · ValueError
Input size must be at least
Error message
Input size must be at least {min_size}x{min_size}; Received: input_shape={input_shape} What it means
obtain_input_shape in keras/src/applications/imagenet_utils.py: each spatial dimension of input_shape must be at least `min_size` (model-specific, e.g. 32 or 71) because the stack of stride-2 convolutions/pooling would otherwise reduce the feature maps below a usable size. Fires when a declared width or height is smaller than that minimum (or None-checks pass but the value is too small).
Solutions
- Resize input images to at least min_size x min_size, e.g. 32x32 or the model's default 224x224
- Update the input_shape tuple to meet the minimum rather than the data
- Choose a smaller/backbone-free model if your inputs are inherently tiny
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at keras/src/applications/imagenet_utils.py:386 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/d09f49bb5a3489cb.
Report an issue: GitHub.
Appendix: source
Thrown at keras/src/applications/imagenet_utils.py:386
"The input must have 3 channels; Received "
f"`input_shape={input_shape}`"
)
if (
input_shape[1] is not None and input_shape[1] < min_size
) or (input_shape[2] is not None and input_shape[2] < min_size):
raise ValueError(
f"Input size must be at least {min_size}"
f"x{min_size}; Received: "
f"input_shape={input_shape}"
)
else:
if input_shape is not None:
if len(input_shape) != 3:
raise ValueError(
"`input_shape` must be a tuple of three integers."
)
if input_shape[-1] != 3 and weights == "imagenet":
raise ValueError(
"The input must have 3 channels; Received "
f"`input_shape={input_shape}`"
)
if (
input_shape[0] is not None and input_shape[0] < min_size
) or (input_shape[1] is not None and input_shape[1] < min_size):
raise ValueError(
"Input size must be at least "
f"{min_size}x{min_size}; Received: "
f"input_shape={input_shape}"
)
else:
if require_flatten:
input_shape = default_shape
else:
if data_format == "channels_first":
input_shape = (3, None, None)
else:View on GitHub (pinned to 7a34a03db6)