Skip to content

Commit

Permalink
Raise error if no GT or proposals available during training (facebook…
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassa authored Dec 4, 2018
1 parent a6ce936 commit cea827e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions maskrcnn_benchmark/modeling/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ def __call__(self, match_quality_matrix):
be matched.
"""
if match_quality_matrix.numel() == 0:
# handle empty case
device = match_quality_matrix.device
return torch.empty((0,), dtype=torch.int64, device=device)
# empty targets or proposals not supported during training
if match_quality_matrix.shape[0] == 0:
raise ValueError(
"No ground-truth boxes available for one of the images "
"during training")
else:
raise ValueError(
"No proposal boxes available for one of the images "
"during training")

# match_quality_matrix is M (gt) x N (predicted)
# Max over gt elements (dim 0) to find best gt candidate for each prediction
Expand Down

0 comments on commit cea827e

Please sign in to comment.