Demo
Sections
Inside Mask R-CNN
The two sections below take a COCO-trained Mask R-CNN apart. The first follows COCO images through the training pipeline, from instance masks to mask targets and anchors. The second follows one image through the trained network and rebuilds each stage by hand, from anchor matching and proposals to per-class non-maximum suppression and mask prediction, then looks at activations, weights and mean average precision.Training data
COCO masks and boxes, resizing and batching, augmentation, 28x28 mask targets and anchors.
Model internals
RPN targets and proposals, proposal classification, box refinement, NMS, masks, activations, weights and mAP.
Libraries
There are two main PyTorch implementations of Mask R-CNN. Detectron2 is aimed at research projects: it is more flexible but harder to learn. The model shipped with torchvision, used in the two sections above, is simpler to use and less configurable.Detectron2 Inference
Shows how an existing pretrained model can be used to do instance segmentation on new classes and how video can be processed via a relevant pipeline.
TorchVision Inference
Runs a pretrained Mask R-CNN on a single image and draws the predicted masks and boxes.
PyTorch reference
Key references: (Ren et al., 2015; He et al., 2017; Chen et al., 2018; Peng et al., 2017)
References
- Chen, L., Zhu, Y., Papandreou, G., Schroff, F., Adam, H. (2018). Encoder-decoder with atrous separable convolution for semantic image segmentation. arXiv [cs.CV]. Link
- He, K., Gkioxari, G., Dollár, P., Girshick, R. (2017). Mask R-CNN. arXiv [cs.CV]. Link
- Peng, C., Xiao, T., Li, Z., Jiang, Y., Zhang, X., et al. (2017). MegDet: A Large Mini-Batch Object Detector. arXiv [cs.CV]. Link
- Ren, S., He, K., Girshick, R., Sun, J. (2015). Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks. arXiv [cs.CV]. Link
Found an error on this page? Report an issue.

