tensorflow/models · error · ValueError

When negatives are in between matched and unmatched threshol

Error message

When negatives are in between matched and unmatched thresholds, these cannot be of equal value. matched: %s, unmatched: %s

What it means

Error "When negatives are in between matched and unmatched thresholds, these cannot be of equal value. matched: %s, unmatched: %s" thrown in tensorflow/models.

Source

Thrown at official/vision/utils/object_detection/argmax_matcher.py:95

    Raises:
      ValueError: if unmatched_threshold is set but matched_threshold is not set
        or if unmatched_threshold > matched_threshold.
    """
    if (matched_threshold is None) and (unmatched_threshold is not None):
      raise ValueError('Need to also define matched_threshold when'
                       'unmatched_threshold is defined')
    self._matched_threshold = matched_threshold
    if unmatched_threshold is None:
      self._unmatched_threshold = matched_threshold
    else:
      if unmatched_threshold > matched_threshold:
        raise ValueError('unmatched_threshold needs to be smaller or equal'
                         'to matched_threshold')
      self._unmatched_threshold = unmatched_threshold
    if not negatives_lower_than_unmatched:
      if self._unmatched_threshold == self._matched_threshold:
        raise ValueError('When negatives are in between matched and '
                         'unmatched thresholds, these cannot be of equal '
                         'value. matched: %s, unmatched: %s',
                         self._matched_threshold, self._unmatched_threshold)
    self._force_match_for_each_row = force_match_for_each_row
    self._negatives_lower_than_unmatched = negatives_lower_than_unmatched

  def _match(self, similarity_matrix):
    """Tries to match each column of the similarity matrix to a row.

    Args:
      similarity_matrix: tensor of shape [N, M] representing any similarity
        metric.

    Returns:
      Match object with corresponding matches for each of M columns.
    """

    def _match_when_rows_are_empty():

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Use distinct matched and unmatched thresholds when negatives can fall between them.
  2. Set use_matrices/defaults so the thresholds differ, or ensure no negatives fall in between.

When it happens

Trigger: Thrown at official/vision/utils/object_detection/argmax_matcher.py:95 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/1b8d19ad8938b6c9. Report an issue: GitHub.