keras-team/keras · error · ValueError
Invalid images dtype: expected float dtype. Received: images
Error message
Invalid images dtype: expected float dtype. Received: images.dtype={backend.standardize_dtype(dtype)} What it means
Error "Invalid images dtype: expected float dtype. Received: images.dtype={backend.standardize_dtype(dtype)}" thrown in keras-team/keras.
Source
Thrown at keras/src/backend/numpy/ops/image.py:139
rgb_planes_to_hsv_planes(red, green, blue), axis=channels_axis
)
return images.astype(dtype)
def hsv_to_rgb(images, data_format=None):
# Ref: dm_pix
images = convert_to_tensor(images)
dtype = images.dtype
data_format = standardize_data_format(data_format)
channels_axis = -1 if data_format == "channels_last" else -3
if len(images.shape) not in (3, 4):
raise ValueError(
"Invalid images rank: expected rank 3 (single image) "
"or rank 4 (batch of images). Received input with shape: "
f"images.shape={images.shape}"
)
if not backend.is_float_dtype(dtype):
raise ValueError(
"Invalid images dtype: expected float dtype. "
f"Received: images.dtype={backend.standardize_dtype(dtype)}"
)
hue, saturation, value = np.split(images, 3, channels_axis)
hue = np.squeeze(hue, channels_axis)
saturation = np.squeeze(saturation, channels_axis)
value = np.squeeze(value, channels_axis)
def hsv_planes_to_rgb_planes(hue, saturation, value):
dh = np.mod(hue, 1.0) * 6.0
dr = np.clip(np.abs(dh - 3.0) - 1.0, 0.0, 1.0)
dg = np.clip(2.0 - np.abs(dh - 2.0), 0.0, 1.0)
db = np.clip(2.0 - np.abs(dh - 4.0), 0.0, 1.0)
one_minus_s = 1.0 - saturation
red = value * (one_minus_s + saturation * dr)
green = value * (one_minus_s + saturation * dg)
blue = value * (one_minus_s + saturation * db)View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/backend/numpy/ops/image.py:139 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/72a08705af056000.
Report an issue: GitHub.