tensorflow/models · error · ValueError

If masks are included you cannot convert coco from the91 cla

Error message

If masks are included you cannot convert coco from the91 class format to the 80 class format.

What it means

Error "If masks are included you cannot convert coco from the91 class format to the 80 class format." thrown in tensorflow/models.

Source

Thrown at official/projects/yolo/dataloaders/tf_example_decoder.py:79

  def __init__(self,
               coco91_to_80=None,
               include_mask=False,
               regenerate_source_id=False,
               mask_binarize_threshold=None):
    """Initialize the example decoder.

    Args:
      coco91_to_80: `bool` indicating whether to convert coco from its 91 class
        format to the 80 class format.
      include_mask: `bool` indicating if the decoder should also decode instance
        masks for instance segmentation.
      regenerate_source_id: `bool` indicating if the source id needs to be
        recreated for each image sample.
      mask_binarize_threshold: `float` for binarizing mask values.
    """
    if coco91_to_80 and include_mask:
      raise ValueError('If masks are included you cannot convert coco from the'
                       '91 class format to the 80 class format.')

    self._coco91_to_80 = coco91_to_80
    super().__init__(
        include_mask=include_mask,
        regenerate_source_id=regenerate_source_id,
        mask_binarize_threshold=mask_binarize_threshold)

  def decode(self, serialized_example):
    """Decode the serialized example.

    Args:
      serialized_example: a single serialized tf.Example string.

    Returns:
      decoded_tensors: a dictionary of tensors with the following fields:
        - source_id: a string scalar tensor.
        - image: a uint8 tensor of shape [None, None, 3].

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/yolo/dataloaders/tf_example_decoder.py:79 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/f21ba34ef69093ed. Report an issue: GitHub.