Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Raise error if no GT or proposals available during training (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassa authored Dec 4, 2018
1 parent 38ce7a1 commit d74fad1
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 d74fad1

Please sign in to comment.