tensorflow/models · error · ValueError

The length of attribute_heads should be 1 or 3, found {}

Error message

The length of attribute_heads should be 1 or 3, found {}

What it means

Error "The length of attribute_heads should be 1 or 3, found {}" thrown in tensorflow/models.

Source

Thrown at official/projects/pointpillars/utils/wod_detection_evaluator.py:307

    values.append(box2d[:, 0])  # center_x
    values.append(box2d[:, 1])  # center_y
    values.append(box2d[:, 2])  # length
    values.append(box2d[:, 3])  # width
    values.append(attributes['heading'][:, 0])  # heading
    box2d_h = tf.stack(values, axis=-1)
    return box2d_h


def create_evaluator(model_config: cfg.PointPillarsModel) -> _AbstractEvaluator:
  """Create either 2d or 3d evaluator."""
  attr_count = len(model_config.head.attribute_heads)
  if attr_count == 1:
    logging.info('Use 2D detection evaluator.')
    return Wod2dDetectionEvaluator(model_config)
  if attr_count == 3:
    logging.info('Use 3D detection evaluator.')
    return Wod3dDetectionEvaluator(model_config)
  raise ValueError(
      'The length of attribute_heads should be 1 or 3, found {}'.format(
          attr_count))

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/pointpillars/utils/wod_detection_evaluator.py:307 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/eb2ae9b19b261a00. Report an issue: GitHub.