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
PythonMITCreated 2018-10-24
下载:Initial releaseInitial-0.1 ↓0.12019-09-10
+0
日增长
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 re

Top issues

Latest release

Initial release v0.1 2019-09-10
Initial (pinned) release of maskrcnn-benchmark

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON