keras-team/keras · error · ValueError
When the height of the images is unknown, `target_height` mu
Error message
When the height of the images is unknown, `target_height` must be specified.Received images.shape={images_shape} and target_height={self.target_height} What it means
Error "When the height of the images is unknown, `target_height` must be specified.Received images.shape={images_shape} and target_height={self.target_height}" thrown in keras-team/keras.
Source
Thrown at keras/src/ops/image.py:1928
f"Received: images.shape={images_shape}"
)
_validate_crop_images_args(
self.top_cropping,
self.left_cropping,
self.bottom_cropping,
self.right_cropping,
self.target_height,
self.target_width,
)
if self.data_format == "channels_last":
height_axis, width_axis = -3, -2
else:
height_axis, width_axis = -2, -1
height, width = images_shape[height_axis], images_shape[width_axis]
if height is None and self.target_height is None:
raise ValueError(
"When the height of the images is unknown, `target_height` "
"must be specified."
f"Received images.shape={images_shape} and "
f"target_height={self.target_height}"
)
if width is None and self.target_width is None:
raise ValueError(
"When the width of the images is unknown, `target_width` "
"must be specified."
f"Received images.shape={images_shape} and "
f"target_width={self.target_width}"
)
target_height = self.target_height
if target_height is None:
target_height = height - self.top_cropping - self.bottom_cropping
target_width = self.target_width
if target_width is None:View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/ops/image.py:1928 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/ddcbf70158dd47ca.
Report an issue: GitHub.