facebookresearch /maskrcnn-benchmark
Fast, modular reference implementation of Instance Segmentation and Object Detection algorithms in PyTorch.
★ 9,358⑂ 2,447👁 2⑃ 294● 1,062▤ 1
+0
Daily
9,358
stars
2,447
forks
2
watchers
294
prs
1,062
issues
1
releases
README
Faster R-CNN and Mask R-CNN in PyTorch 1.0
maskrcnn-benchmark has been deprecated. Please see detectron2, which includes implementations for all models in maskrcnn-benchmark
This project aims at providing the necessary building blocks for easily
creating detection and segmentation models using PyTorch 1.0.
!alt text
Highlights
- PyTorch 1.0: RPN, Faster R-CNN and Mask R-CNN implementations that matches or exceeds Detectron accuracies
- Very fast: up to 2x faster than Detectron and 30% faster than mmdetection during training. See MODEL_ZOO.md for more details.
- Memory efficient: uses roughly 500MB less GPU memory than mmdetection during training
- Multi-GPU training and inference
- Mixed precision training: trains faster with less GPU memory on NVIDIA tensor cores.
- Batched inference: can perform inference using multiple images per batch per GPU
- CPU support for inference: runs on CPU in inference time. See our webcam demo for an example
- Provides pre-trained models for almost all reference Mask R-CNN and Faster R-CNN configurations with 1x schedule.
Webcam and Jupyter notebook demo
We provide a simple webcam demo that illustrates how you can use maskrcnn_benchmark for inference:
bash
cd demo
by default, it runs on the GPU
for best results, use min-image-size 800
python webcam.py --min-image-size 800
can also run it on the CPU
python webcam.py --min-image-size 300 MODEL.DEVICE cpu
or change the model that you want to use
python webcam.py --config-file ../configs/caffe2/e2e_mask_rcnn_R_101_FPN_1x_caffe2.yaml --min-image-size 300 MODEL.DEVICE cpu
in order to see the probability heatmaps, pass --show-mask-heatmaps
python webcam.py --min-image-size 300 --show-mask-heatmaps MODEL.DEVICE cpu
for the keypoint demo
python webcam.py --config-file ../configs/caffe2/e2e_keypoint_rcnn_R_50_FPN_1x_caffe2.yaml --min-image-size 300 MODEL.DEVICE cpu
A notebook with the demo can be found in demo/Mask_R-CNN_demo.ipynb.
Installation
Check INSTALL.md for installation instructions.
Model Zoo and Baselines
Pre-trained models, baselines and comparison with Detectron and mmdetection
can be found in MODEL_ZOO.md
Inference in a few lines
We provide a helper class to simplify writing inference pipelines using pre-trained models.
Here is how we would do it. Run this from the demo folder:
python
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
config_file = "../configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml"
update the config options with the config file
cfg.merge_from_file(config_file)
manual override some options
cfg.merge_from_list(["MODEL.DEVICE", "cpu"])
coco_demo = COCODemo(
cfg,
min_image_size=800,
confidence_threshold=0.7,
)
load image and then run prediction
image = ...
predictions = coco_demo.run_on_opencv_image(image)
Perform training on COCO dataset
For the following examples to work, you need to first install maskrcnn_benchmark.
You will also need to download the COCO dataset.
We reTop issues
#521Step-by-step tutorial - How to train your own dataset67 comments · 2019-03-01#167Docker Runtime Error: Not Compiled with GPU support57 comments · 2018-11-17#169How to train with negative samples of my training set?47 comments · 2018-11-18#256Support instance mask annotation with mask.png43 comments · 2018-12-10#318distributed error encountered34 comments · 2019-01-04#77change dataset, 32 comments · 2018-10-31#711build error:apex31 comments · 2019-04-23#315multi nodes GPU training issue: Connection reset by peer27 comments · 2019-01-02
Latest release
Initial release v0.1 2019-09-10Initial (pinned) release of maskrcnn-benchmark