tensorflow/models · error · ValueError

input boxlist must have 'scores' field

Error message

input boxlist must have 'scores' field

What it means

Error "input boxlist must have 'scores' field" thrown in tensorflow/models.

Source

Thrown at official/vision/utils/object_detection/box_list_ops.py:755

  Args:
    boxlist: BoxList holding N boxes.  Must contain a 'scores' field
      representing detection scores.
    thresh: scalar threshold
    max_output_size: maximum number of retained boxes
    scope: name scope.

  Returns:
    a BoxList holding M boxes where M <= max_output_size
  Raises:
    ValueError: if thresh is not in [0, 1]
  """
  with tf.name_scope(scope or 'NonMaxSuppression'):
    if not 0 <= thresh <= 1.0:
      raise ValueError('thresh must be between 0 and 1')
    if not isinstance(boxlist, box_list.BoxList):
      raise ValueError('boxlist must be a BoxList')
    if not boxlist.has_field('scores'):
      raise ValueError('input boxlist must have \'scores\' field')
    selected_indices = tf.image.non_max_suppression(
        boxlist.get(),
        boxlist.get_field('scores'),
        max_output_size,
        iou_threshold=thresh)
    return gather(boxlist, selected_indices)


def _copy_extra_fields(boxlist_to_copy_to, boxlist_to_copy_from):
  """Copies the extra fields of boxlist_to_copy_from to boxlist_to_copy_to.

  Args:
    boxlist_to_copy_to: BoxList to which extra fields are copied.
    boxlist_to_copy_from: BoxList from which fields are copied.

  Returns:
    boxlist_to_copy_to with extra fields.
  """

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Add a 'scores' field to the boxlist before pruning.
  2. Call boxlist.add_field('scores', scores) with the detection scores.

When it happens

Trigger: Thrown at official/vision/utils/object_detection/box_list_ops.py:755 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/2e7119595b19ce82. Report an issue: GitHub.