keras-team/keras · error · ValueError
If imagenet weights are being loaded, depth multiplier must
Error message
If imagenet weights are being loaded, depth multiplier must be 1. Received depth_multiplier={depth_multiplier} What it means
Error "If imagenet weights are being loaded, depth multiplier must be 1. Received depth_multiplier={depth_multiplier}" thrown in keras-team/keras.
Source
Thrown at keras/src/applications/mobilenet.py:160
input_shape = imagenet_utils.obtain_input_shape(
input_shape,
default_size=default_size,
min_size=32,
data_format=backend.image_data_format(),
require_flatten=include_top,
weights=weights,
)
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 weights == "imagenet":
if depth_multiplier != 1:
raise ValueError(
"If imagenet weights are being loaded, "
"depth multiplier must be 1. "
f"Received depth_multiplier={depth_multiplier}"
)
if alpha not in [0.25, 0.50, 0.75, 1.0]:
raise ValueError(
"If imagenet weights are being loaded, "
"alpha can be one of"
"`0.25`, `0.50`, `0.75` or `1.0` only. "
f"Received alpha={alpha}"
)
if rows != cols or rows not in [128, 160, 192, 224]:
rows = 224
warnings.warn(
"`input_shape` is undefined or non-square, "
"or `rows` is not in [128, 160, 192, 224]. "View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/applications/mobilenet.py:160 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/1851179b21f60744.
Report an issue: GitHub.