Performs the matching Params: outputs: This is a dict that contains at least these entries: "pred_logits": Tensor of dim [batch_size, num_queries, num_classes] with the classification logits "pred_masks": Tensor of dim [batch_size, num_queries,
(self, outputs, targets, cost=["cls", "box", "mask"], mode='default', extra={})
| 194 | |
| 195 | @torch.no_grad() |
| 196 | def forward(self, outputs, targets, cost=["cls", "box", "mask"], mode='default', extra={}): |
| 197 | """Performs the matching |
| 198 | |
| 199 | Params: |
| 200 | outputs: This is a dict that contains at least these entries: |
| 201 | "pred_logits": Tensor of dim [batch_size, num_queries, num_classes] with the classification logits |
| 202 | "pred_masks": Tensor of dim [batch_size, num_queries, H_pred, W_pred] with the predicted masks |
| 203 | |
| 204 | targets: This is a list of targets (len(targets) = batch_size), where each target is a dict containing: |
| 205 | "labels": Tensor of dim [num_target_boxes] (where num_target_boxes is the number of ground-truth |
| 206 | objects in the target) containing the class labels |
| 207 | "masks": Tensor of dim [num_target_boxes, H_gt, W_gt] containing the target masks |
| 208 | |
| 209 | Returns: |
| 210 | A list of size batch_size, containing tuples of (index_i, index_j) where: |
| 211 | - index_i is the indices of the selected predictions (in order) |
| 212 | - index_j is the indices of the corresponding selected targets (in order) |
| 213 | For each batch element, it holds: |
| 214 | len(index_i) = len(index_j) = min(num_queries, num_target_boxes) |
| 215 | """ |
| 216 | if mode == 'default': |
| 217 | return self.memory_efficient_forward(outputs, targets, cost) |
| 218 | else: |
| 219 | assert False, "Mode {} is not supported.".format(mode) |
| 220 | |
| 221 | def __repr__(self, _repr_indent=4): |
| 222 | head = "Matcher " + self.__class__.__name__ |
nothing calls this directly
no test coverage detected