tensorflow/models · error · ValueError

centered_crop is only supported when resize_eval_groundtruth

Error message

centered_crop is only supported when resize_eval_groundtruth is True.

What it means

Error "centered_crop is only supported when resize_eval_groundtruth is True." thrown in tensorflow/models.

Source

Thrown at official/vision/dataloaders/segmentation_input.py:138

      )
    self._gt_is_matting_map = gt_is_matting_map
    self._groundtruth_padded_size = groundtruth_padded_size
    self._ignore_label = ignore_label
    self._preserve_aspect_ratio = preserve_aspect_ratio

    # Data augmentation.
    self._aug_rand_hflip = aug_rand_hflip
    self._aug_scale_min = aug_scale_min
    self._aug_scale_max = aug_scale_max

    # dtype.
    self._dtype = dtype

    self._image_feature = image_feature
    self._additional_dense_features = additional_dense_features
    self._centered_crop = centered_crop
    if self._centered_crop and not self._resize_eval_groundtruth:
      raise ValueError(
          'centered_crop is only supported when resize_eval_groundtruth is'
          ' True.'
      )

  def _prepare_image_and_label(self, data):
    """Prepare normalized image and label."""
    height = data['image/height']
    width = data['image/width']

    label = tf.io.decode_image(
        data['image/segmentation/class/encoded'], channels=1
    )
    label = tf.reshape(label, (1, height, width))
    label = tf.cast(label, tf.float32)

    image = tf.io.decode_image(
        data[self._image_feature.feature_name],
        channels=self._image_feature.num_channels,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/vision/dataloaders/segmentation_input.py:138 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/98eea843dddf600b. Report an issue: GitHub.