Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rfdetr/detr.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ def predict(
predictions = {
"pred_logits": predictions[1],
"pred_boxes": predictions[0],
"pred_masks": predictions[2]
}
if len(predictions) == 3:
predictions["pred_masks"] = predictions[2]
target_sizes = torch.tensor(orig_sizes, device=self.model.device)
results = self.model.postprocess(predictions, target_sizes=target_sizes)

Expand Down
5 changes: 4 additions & 1 deletion rfdetr/models/lwdetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ def forward_export(self, tensors):
if self.segmentation_head is not None:
outputs_masks = self.segmentation_head(srcs[0], [hs_enc,], tensors.shape[-2:], skip_blocks=True)[0]

return outputs_coord, outputs_class, outputs_masks
if outputs_masks is not None:
return outputs_coord, outputs_class, outputs_masks
else:
return outputs_coord, outputs_class

@torch.jit.unused
def _set_aux_loss(self, outputs_class, outputs_coord, outputs_masks):
Expand Down