![]() |
Matcher based on highest value.
tfm.vision.box_matcher.BoxMatcher(
thresholds, indicators, force_match_for_each_col=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.
Raises | |
---|---|
ValueError
|
If threshold not sorted,
or len(indicators) != len(threshold) + 1
|
Methods
__call__
__call__(
similarity_matrix
)
Tries to match each column of the similarity matrix to a row.
Args | |
---|---|
similarity_matrix
|
A float tensor of shape [N, M] representing any similarity metric. |
Returns | |
---|---|
A integer tensor of shape [N] with corresponding match indices for each
of M columns, for positive match, the match result will be the
corresponding row index, for negative match, the match will be
negative_value , for ignored match, the match result will be
ignore_value .
|