Unverified Commit c3be98eb authored by Peter Jung's avatar Peter Jung Committed by GitHub
Browse files

Fix cost condition in DetrHungarianMatcher and YolosHungarianMatcher to allow zero-cost (#18647)

* Fix loss condition in DetrHungarianMatcher

* Fix costs condition in YolosHungarianMatcher
parent fea4636c
...@@ -2153,7 +2153,7 @@ class DetrHungarianMatcher(nn.Module): ...@@ -2153,7 +2153,7 @@ class DetrHungarianMatcher(nn.Module):
self.class_cost = class_cost self.class_cost = class_cost
self.bbox_cost = bbox_cost self.bbox_cost = bbox_cost
self.giou_cost = giou_cost self.giou_cost = giou_cost
if class_cost == 0 or bbox_cost == 0 or giou_cost == 0: if class_cost == 0 and bbox_cost == 0 and giou_cost == 0:
raise ValueError("All costs of the Matcher can't be 0") raise ValueError("All costs of the Matcher can't be 0")
@torch.no_grad() @torch.no_grad()
......
...@@ -1145,7 +1145,7 @@ class YolosHungarianMatcher(nn.Module): ...@@ -1145,7 +1145,7 @@ class YolosHungarianMatcher(nn.Module):
self.class_cost = class_cost self.class_cost = class_cost
self.bbox_cost = bbox_cost self.bbox_cost = bbox_cost
self.giou_cost = giou_cost self.giou_cost = giou_cost
if class_cost == 0 or bbox_cost == 0 or giou_cost == 0: if class_cost == 0 and bbox_cost == 0 and giou_cost == 0:
raise ValueError("All costs of the Matcher can't be 0") raise ValueError("All costs of the Matcher can't be 0")
@torch.no_grad() @torch.no_grad()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment