{"record":{"id":"3cb6cd2b96a78a54","repo":"tensorflow/models","slug":"iou-thresh-must-be-between-0-and-1","errorCode":null,"errorMessage":"iou_thresh must be between 0 and 1","messagePattern":"iou_thresh must be between 0 and 1","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/vision/utils/object_detection/box_list_ops.py","lineNumber":975,"sourceCode":"  Args:\n    selected_boxes: BoxList containing a subset of boxes in pool_boxes. These\n      boxes are usually selected from pool_boxes using non max suppression.\n    pool_boxes: BoxList containing a set of (possibly redundant) boxes.\n    iou_thresh: (float scalar) iou threshold for matching boxes in\n      selected_boxes and pool_boxes.\n\n  Returns:\n    BoxList containing averaged locations and scores for each box in\n    selected_boxes.\n\n  Raises:\n    ValueError: if\n      a) selected_boxes or pool_boxes is not a BoxList.\n      b) if iou_thresh is not in [0, 1].\n      c) pool_boxes does not have a scores field.\n  \"\"\"\n  if not 0.0 <= iou_thresh <= 1.0:\n    raise ValueError('iou_thresh must be between 0 and 1')\n  if not isinstance(selected_boxes, box_list.BoxList):\n    raise ValueError('selected_boxes must be a BoxList')\n  if not isinstance(pool_boxes, box_list.BoxList):\n    raise ValueError('pool_boxes must be a BoxList')\n  if not pool_boxes.has_field('scores'):\n    raise ValueError('pool_boxes must have a \\'scores\\' field')\n\n  iou_ = iou(selected_boxes, pool_boxes)\n  match_indicator = tf.cast(tf.greater(iou_, iou_thresh), dtype=tf.float32)\n  num_matches = tf.reduce_sum(match_indicator, 1)\n  # TODO(kbanoop): Handle the case where some boxes in selected_boxes do not\n  # match to any boxes in pool_boxes. For such boxes without any matches, we\n  # should return the original boxes without voting.\n  match_assert = tf.Assert(\n      tf.reduce_all(tf.greater(num_matches, 0)),\n      'Each box in selected_boxes must match with at least one box '\n      'in pool_boxes.')\n","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/vision/utils/object_detection/box_list_ops.py#L957-L993","documentation":"Error \"iou_thresh must be between 0 and 1\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/vision/utils/object_detection/box_list_ops.py:975 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set iou_thresh to a value between 0 and 1.","Clip the IoU threshold into [0, 1] in the config."],"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"}