The computed masks by Mask R-CNN are of fixed size $m \times m$ each. How are they projected back to the image?

  • $\begingroup$ Is this the same question as your previous one https://ai.stackexchange.com/q/34551/2444? If not, can you clarify why. If yes, I recommend that you delete one of the two. $\endgroup$
    – nbro
    Commented Feb 18, 2022 at 9:10
  • $\begingroup$ No it's a different question, about how the masks are back-projected to the input image. $\endgroup$
    – orbit
    Commented Feb 19, 2022 at 6:16

1 Answer 1


Each computed mask is simply resized to the corresponding computed bounding-box. For example, using OpenCV:

mask = cv2.resize(mask, (bboxW, bboxH), interpolation=cv2.INTER_NEAREST)

Then, after converting it to a binary mask by thresholding it, you can overlay this mask on the input image using the coordinates of the corresponding computed bounding-box.

See here for more details.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .