<p>Each computed mask is simply resized to the corresponding computed bounding-box. For example, using OpenCV:</p>
<pre><code>mask = cv2.resize(mask, (bboxW, bboxH), interpolation=cv2.INTER_NEAREST)
</code></pre>
<p>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.</p>
<p>See <a href="https://pyimagesearch.com/2018/11/19/mask-r-cnn-with-opencv/" rel="nofollow noreferrer">here</a> for more details.</p>

CC BY-SA 4.0
2022-02-19T08:47:20.673Z
2022-02-20T10:33:30.813Z
2022-02-20T10:33:30.813Z
kuzand
<p>The computed masks by Mask R-CNN are of fixed size <span class="math-container">$m \times m$</span> each. How are they projected back to the image?</p>

CC BY-SA 4.0
2022-02-18T09:10:31.243Z
Is this the same question as your previous one [https://ai.stackexchange.com/q/34551/2444](https://ai.stackexchange.com/q/34551/2444)? If not, can you clarify why. If yes, I recommend that you delete one of the two.
nbro
CC BY-SA 4.0
2022-02-19T06:16:44.113Z
No it's a different question, about how the masks are back-projected to the input image.
orbit
<deep-learning><object-detection><instance-segmentation><mask-rcnn>
Mask R-CNN: How are the computed masks projected back to the input image?
orbit
# Mask R-CNN: How are the computed masks projected back to the input image?

(Asked by: username_0 on 2022-02-17)

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

**Tags:** deep-learning, object-detection, instance-segmentation, mask-rcnn

> **Comments:**
> **username_1**: Is this the same question as your previous one [https://ai.stackexchange.com/q/34551/2444](https://ai.stackexchange.com/q/34551/2444)? If not, can you clarify why. If yes, I recommend that you delete one of the two.  
> **username_0**: No it's a different question, about how the masks are back-projected to the input image.  

---

## 1 answers

### Answer by username_2 on 2022-02-19. Score: 0

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.


---

