{"record":{"id":"fa0356ba12992b9c","repo":"tensorflow/models","slug":"need-to-also-define-matched-threshold-whenunmatche","errorCode":null,"errorMessage":"Need to also define matched_threshold whenunmatched_threshold is defined","messagePattern":"Need to also define matched_threshold whenunmatched_threshold is defined","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/utils/object_detection/argmax_matcher.py","lineNumber":83,"sourceCode":"      unmatched_threshold: Threshold for negative matches. Negative if\n        sim < unmatched_threshold. Defaults to matched_threshold\n        when set to None.\n      negatives_lower_than_unmatched: Boolean which defaults to True. If True\n        then negative matches are the ones below the unmatched_threshold,\n        whereas ignored matches are in between the matched and unmatched\n        threshold. If False, then negative matches are in between the matched\n        and unmatched threshold, and everything lower than unmatched is ignored.\n      force_match_for_each_row: If True, ensures that each row is matched to\n        at least one column (which is not guaranteed otherwise if the\n        matched_threshold is high). Defaults to False. See\n        argmax_matcher_test.testMatcherForceMatch() for an example.\n\n    Raises:\n      ValueError: if unmatched_threshold is set but matched_threshold is not set\n        or if unmatched_threshold > matched_threshold.\n    \"\"\"\n    if (matched_threshold is None) and (unmatched_threshold is not None):\n      raise ValueError('Need to also define matched_threshold when'\n                       'unmatched_threshold is defined')\n    self._matched_threshold = matched_threshold\n    if unmatched_threshold is None:\n      self._unmatched_threshold = matched_threshold\n    else:\n      if unmatched_threshold > matched_threshold:\n        raise ValueError('unmatched_threshold needs to be smaller or equal'\n                         'to matched_threshold')\n      self._unmatched_threshold = unmatched_threshold\n    if not negatives_lower_than_unmatched:\n      if self._unmatched_threshold == self._matched_threshold:\n        raise ValueError('When negatives are in between matched and '\n                         'unmatched thresholds, these cannot be of equal '\n                         'value. matched: %s, unmatched: %s',\n                         self._matched_threshold, self._unmatched_threshold)\n    self._force_match_for_each_row = force_match_for_each_row\n    self._negatives_lower_than_unmatched = negatives_lower_than_unmatched\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/utils/object_detection/argmax_matcher.py#L65-L101","documentation":"Error \"Need to also define matched_threshold whenunmatched_threshold is defined\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/utils/object_detection/argmax_matcher.py:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define matched_threshold together with unmatched_threshold.","Set unmatched_threshold to None if you do not want a separate unmatched threshold."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}