Skip to content

Commit 6e5599e

Browse files
authored
Rename mask field to masks (#934)
This makes it consistent with the other models, which returns nouns in plurial
1 parent cb99fe3 commit 6e5599e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

references/detection/coco_eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def prepare_for_coco_segmentation(self, predictions):
101101

102102
scores = prediction["scores"]
103103
labels = prediction["labels"]
104-
masks = prediction["mask"]
104+
masks = prediction["masks"]
105105

106106
masks = masks > 0.5
107107

torchvision/models/detection/mask_rcnn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class MaskRCNN(FasterRCNN):
4343
0 and H and 0 and W
4444
- labels (Tensor[N]): the predicted labels for each image
4545
- scores (Tensor[N]): the scores or each prediction
46-
- mask (Tensor[N, H, W]): the predicted masks for each instance, in 0-1 range. In order to
46+
- masks (Tensor[N, H, W]): the predicted masks for each instance, in 0-1 range. In order to
4747
obtain the final segmentation masks, the soft masks can be thresholded, generally
4848
with a value of 0.5 (mask >= 0.5)
4949
@@ -249,7 +249,7 @@ def maskrcnn_resnet50_fpn(pretrained=False, progress=True,
249249
``0`` and ``H`` and ``0`` and ``W``
250250
- labels (``Tensor[N]``): the predicted labels for each image
251251
- scores (``Tensor[N]``): the scores or each prediction
252-
- mask (``Tensor[N, H, W]``): the predicted masks for each instance, in ``0-1`` range. In order to
252+
- masks (``Tensor[N, H, W]``): the predicted masks for each instance, in ``0-1`` range. In order to
253253
obtain the final segmentation masks, the soft masks can be thresholded, generally
254254
with a value of 0.5 (``mask >= 0.5``)
255255

torchvision/models/detection/roi_heads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def forward(self, features, proposals, image_shapes, targets=None):
573573
labels = [r["labels"] for r in result]
574574
masks_probs = maskrcnn_inference(mask_logits, labels)
575575
for mask_prob, r in zip(masks_probs, result):
576-
r["mask"] = mask_prob
576+
r["masks"] = mask_prob
577577

578578
losses.update(loss_mask)
579579

torchvision/models/detection/transform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ def postprocess(self, result, image_shapes, original_image_sizes):
109109
boxes = pred["boxes"]
110110
boxes = resize_boxes(boxes, im_s, o_im_s)
111111
result[i]["boxes"] = boxes
112-
if "mask" in pred:
113-
masks = pred["mask"]
112+
if "masks" in pred:
113+
masks = pred["masks"]
114114
masks = paste_masks_in_image(masks, boxes, o_im_s)
115-
result[i]["mask"] = masks
115+
result[i]["masks"] = masks
116116
if "keypoints" in pred:
117117
keypoints = pred["keypoints"]
118118
keypoints = resize_keypoints(keypoints, im_s, o_im_s)

0 commit comments

Comments
 (0)