<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/box_matcher.py#L22-L202) |

Matcher based on highest value.

    tfm.vision.box_matcher.BoxMatcher(
        thresholds: List[float],
        indicators: List[int],
        force_match_for_each_col: bool = False
    )

This class computes matches from a similarity matrix. Each column is matched
to a single row.

To support object detection target assignment this class enables setting both
positive_threshold (upper threshold) and negative_threshold (lower thresholds)
defining three categories of similarity which define whether examples are
positive, negative, or ignored, for example:
(1) thresholds=\[negative_threshold, positive_threshold\], and
indicators=\[negative_value, ignore_value, positive_value\]: The similarity
metrics below negative_threshold will be assigned with negative_value,
the metrics between negative_threshold and positive_threshold will be
assigned ignore_value, and the metrics above positive_threshold will be
assigned positive_value.
(2) thresholds=\[negative_threshold, positive_threshold\], and
indicators=\[ignore_value, negative_value, positive_value\]: The similarity
metric below negative_threshold will be assigned with ignore_value,
the metrics between negative_threshold and positive_threshold will be
assigned negative_value, and the metrics above positive_threshold will be
assigned positive_value.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `thresholds` | A list of thresholds to classify the matches into different types (e.g. positive or negative or ignored match). The list needs to be sorted, and will be prepended with -Inf and appended with +Inf. |
| `indicators` | A list of values representing match types (e.g. positive or negative or ignored match). len(`indicators`) must equal to len(`thresholds`) + 1. |
| `force_match_for_each_col` | If True, ensures that each column is matched to at least one row (which is not guaranteed otherwise if the positive_threshold is high). Defaults to False. If True, all force matched row will be assigned to `indicators[-1]`. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `threshold` not sorted, or len(indicators) != len(threshold) + 1 |

<br />

## Methods

### `__call__`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/vision/ops/box_matcher.py#L81-L188)

    __call__(
        similarity_matrix: tf.Tensor
    ) -> Tuple[tf.Tensor, tf.Tensor]

Tries to match each column of the similarity matrix to a row.

<br />

<br />

<br />

| Args ||
|---|---|
| `similarity_matrix` | A float tensor of shape \[num_rows, num_cols\] or \[batch_size, num_rows, num_cols\] representing any similarity metric. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `matched_columns` | An integer tensor of shape \[num_rows\] or \[batch_size, num_rows\] storing the index of the matched column for each row. |
| `match_indicators` | An integer tensor of shape \[num_rows\] or \[batch_size, num_rows\] storing the match type indicator (e.g. positive or negative or ignored match). |

<br />