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
2 changes: 1 addition & 1 deletion references/detection/coco_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def prepare_for_coco_segmentation(self, predictions):

scores = prediction["scores"]
labels = prediction["labels"]
masks = prediction["mask"]
masks = prediction["masks"]

masks = masks > 0.5

Expand Down
4 changes: 2 additions & 2 deletions torchvision/models/detection/mask_rcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MaskRCNN(FasterRCNN):
0 and H and 0 and W
- labels (Tensor[N]): the predicted labels for each image
- 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
with a value of 0.5 (mask >= 0.5)

Expand Down Expand Up @@ -249,7 +249,7 @@ def maskrcnn_resnet50_fpn(pretrained=False, progress=True,
``0`` and ``H`` and ``0`` and ``W``
- labels (``Tensor[N]``): the predicted labels for each image
- 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
with a value of 0.5 (``mask >= 0.5``)

Expand Down
2 changes: 1 addition & 1 deletion torchvision/models/detection/roi_heads.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def forward(self, features, proposals, image_shapes, targets=None):
labels = [r["labels"] for r in result]
masks_probs = maskrcnn_inference(mask_logits, labels)
for mask_prob, r in zip(masks_probs, result):
r["mask"] = mask_prob
r["masks"] = mask_prob

losses.update(loss_mask)

Expand Down
6 changes: 3 additions & 3 deletions torchvision/models/detection/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def postprocess(self, result, image_shapes, original_image_sizes):
boxes = pred["boxes"]
boxes = resize_boxes(boxes, im_s, o_im_s)
result[i]["boxes"] = boxes
if "mask" in pred:
masks = pred["mask"]
if "masks" in pred:
masks = pred["masks"]
masks = paste_masks_in_image(masks, boxes, o_im_s)
result[i]["mask"] = masks
result[i]["masks"] = masks
if "keypoints" in pred:
keypoints = pred["keypoints"]
keypoints = resize_keypoints(keypoints, im_s, o_im_s)
Expand Down