Unverified Commit 6e5599e4 authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Rename mask field to masks (#934)

This makes it consistent with the other models, which returns nouns in plurial
parent cb99fe30
...@@ -101,7 +101,7 @@ class CocoEvaluator(object): ...@@ -101,7 +101,7 @@ class CocoEvaluator(object):
scores = prediction["scores"] scores = prediction["scores"]
labels = prediction["labels"] labels = prediction["labels"]
masks = prediction["mask"] masks = prediction["masks"]
masks = masks > 0.5 masks = masks > 0.5
......
...@@ -43,7 +43,7 @@ class MaskRCNN(FasterRCNN): ...@@ -43,7 +43,7 @@ class MaskRCNN(FasterRCNN):
0 and H and 0 and W 0 and H and 0 and W
- labels (Tensor[N]): the predicted labels for each image - labels (Tensor[N]): the predicted labels for each image
- scores (Tensor[N]): the scores or each prediction - scores (Tensor[N]): the scores or each prediction
- mask (Tensor[N, H, W]): the predicted masks for each instance, in 0-1 range. In order to - masks (Tensor[N, H, W]): the predicted masks for each instance, in 0-1 range. In order to
obtain the final segmentation masks, the soft masks can be thresholded, generally obtain the final segmentation masks, the soft masks can be thresholded, generally
with a value of 0.5 (mask >= 0.5) with a value of 0.5 (mask >= 0.5)
...@@ -249,7 +249,7 @@ def maskrcnn_resnet50_fpn(pretrained=False, progress=True, ...@@ -249,7 +249,7 @@ def maskrcnn_resnet50_fpn(pretrained=False, progress=True,
``0`` and ``H`` and ``0`` and ``W`` ``0`` and ``H`` and ``0`` and ``W``
- labels (``Tensor[N]``): the predicted labels for each image - labels (``Tensor[N]``): the predicted labels for each image
- scores (``Tensor[N]``): the scores or each prediction - scores (``Tensor[N]``): the scores or each prediction
- mask (``Tensor[N, H, W]``): the predicted masks for each instance, in ``0-1`` range. In order to - masks (``Tensor[N, H, W]``): the predicted masks for each instance, in ``0-1`` range. In order to
obtain the final segmentation masks, the soft masks can be thresholded, generally obtain the final segmentation masks, the soft masks can be thresholded, generally
with a value of 0.5 (``mask >= 0.5``) with a value of 0.5 (``mask >= 0.5``)
......
...@@ -573,7 +573,7 @@ class RoIHeads(torch.nn.Module): ...@@ -573,7 +573,7 @@ class RoIHeads(torch.nn.Module):
labels = [r["labels"] for r in result] labels = [r["labels"] for r in result]
masks_probs = maskrcnn_inference(mask_logits, labels) masks_probs = maskrcnn_inference(mask_logits, labels)
for mask_prob, r in zip(masks_probs, result): for mask_prob, r in zip(masks_probs, result):
r["mask"] = mask_prob r["masks"] = mask_prob
losses.update(loss_mask) losses.update(loss_mask)
......
...@@ -109,10 +109,10 @@ class GeneralizedRCNNTransform(nn.Module): ...@@ -109,10 +109,10 @@ class GeneralizedRCNNTransform(nn.Module):
boxes = pred["boxes"] boxes = pred["boxes"]
boxes = resize_boxes(boxes, im_s, o_im_s) boxes = resize_boxes(boxes, im_s, o_im_s)
result[i]["boxes"] = boxes result[i]["boxes"] = boxes
if "mask" in pred: if "masks" in pred:
masks = pred["mask"] masks = pred["masks"]
masks = paste_masks_in_image(masks, boxes, o_im_s) masks = paste_masks_in_image(masks, boxes, o_im_s)
result[i]["mask"] = masks result[i]["masks"] = masks
if "keypoints" in pred: if "keypoints" in pred:
keypoints = pred["keypoints"] keypoints = pred["keypoints"]
keypoints = resize_keypoints(keypoints, im_s, o_im_s) keypoints = resize_keypoints(keypoints, im_s, o_im_s)
......
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