detectron2 Mask / Faster R-CNN (R50-FPN) (fastforks)

Mask R-CNN (He et al. 2017) and Faster R-CNN (Ren et al. 2015) from the detectron2 model zoo, COCO, ResNet-50 + FPN backbone, RPN proposals, ROIAlign box head (+ mask head); returns boxes, classes and instance masks at the input size. The portable module() is backbone + FPN.

This repo is the model card only: it holds no weights. fastforks downloads the authors' weights from the links below and checks them against the SHA-256 in the model card. Code: https://github.com/kleinicke/fastforks. Kernels for the kernels backend: https://huggingface.co/fastforks/kernels. Original code: https://github.com/facebookresearch/detectron2 at 1e3e13b.

Task: detection. Tier: stable. Outputs: boxes, scores, labels, masks. Backends: portable, kernels.

Input: one RGB image. Output: boxes, class labels, scores and instance masks.

Variants

Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in card.toml.

variant weights (author link) SHA-256 weights licence commercial use
faster-rcnn-r50-fpn-3x-coco@1 faster_rcnn_R_50_FPN_3x.pkl 3c25caca37ba CC-BY-SA-3.0 yes
mask-rcnn-r50-fpn-3x-coco@1 mask_rcnn_R_50_FPN_3x.pkl 9a737e290372 CC-BY-SA-3.0 yes

Licence

Original-code strings, recorded as they are (research-use package; check them before any other use). Code: Apache-2.0. Licence files: LICENSE.

Training data: COCO 2017 (train, instance annotations) (COCO 2017 train (3x schedule); the ResNet-50 backbone was initialised from MSRA's ImageNet-1k model).

  • Licence note: The detectron2 model-zoo weights are CC-BY-SA-3.0 (share-alike), and the COCO images carry their own licences.

Licence evidence: https://github.com/facebookresearch/detectron2/blob/1e3e13bbf607b54f62205c4c33922521822fb298/MODEL_ZOO.md (License section)

Input size

any H x W >= 32, padded to a multiple of 32 Tested up to (portable, fp16, RTX 5060 Ti 16 GB): faster-rcnn-r50-fpn-3x-coco 3000x4000 (0.6 GiB peak allocated, 0.7 reserved); mask-rcnn-r50-fpn-3x-coco 3000x4000 (0.6 GiB peak allocated, 0.7 reserved)

Speed and memory

Detection, synthetic, 800x1344

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
faster-rcnn-r50-fpn-3x-coco 83.6 41.4 22.8 19.5 2.1x 1.2x 626 / 708 390 / 490 391 / 450
mask-rcnn-r50-fpn-3x-coco 85.4 43.5 24.6 21.0 2.1x 1.2x 604 / 650 352 / 440 353 / 400

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
faster-rcnn-r50-fpn-3x-coco 0.73 0.53 0.14โ€  0.04 0.25 0.04
mask-rcnn-r50-fpn-3x-coco 0.97 1.50 0.22โ€  0.84 0.42 0.04

torch.compile and TensorRT

model input time: portable compile TensorRT fp16 kernels preparation: compile (cold first call) ONNX + engine build peak MiB (alloc / reserved): portable compile kernels TensorRT (engine + torch)
faster-rcnn-r50-fpn-3x-coco 800x1344 22.8 ms 18.9 ms 5.35 ms (backbone + FPN only) 19.5 ms 26.0 s 15.6 s 390 / 490 413 / 438 391 / 450 439 / 494
mask-rcnn-r50-fpn-3x-coco 800x1344 24.6 ms 21.5 ms 5.34 ms (backbone + FPN only) 21.0 ms 29.3 s 18.3 s 352 / 440 333 / 358 353 / 400 444 / 496

Fixed-size speed and peak memory, all models

model mode 480x640 720x1280 1080x1920 12 MP 3000x4000
faster-rcnn-r50-fpn-3x-coco portable 18.5 ms / 309 / 420 21.5 ms / 338 / 426 22.2 ms / 352 / 454 27.2 ms / 602 / 734
faster-rcnn-r50-fpn-3x-coco kernels 16.1 ms / 310 / 422 18.7 ms / 339 / 460 18.4 ms / 353 / 488 24.6 ms / 602 / 736
mask-rcnn-r50-fpn-3x-coco portable 18.1 ms / 314 / 422 23.1 ms / 348 / 440 25.1 ms / 413 / 536 27.1 ms / 607 / 736
mask-rcnn-r50-fpn-3x-coco kernels 15.6 ms / 315 / 422 19.6 ms / 349 / 472 22.3 ms / 414 / 568 24.6 ms / 607 / 736

Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).

Hardware, protocol and caveats: benchmarks (RTX 5060 Ti 16 GB, sm_120). Original = the original code named above at the precision of portable (fp16, or (fp32) where fp16 is unsupported or not finite); original fp32 = its default fp32 run. Peak memory is the torch allocator's.

Accuracy

On public datasets

pycocotools COCOeval of the top 100 detections per image. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
mask-rcnn-r50-fpn-3x-coco COCO val2017, every 10th image, box mAP / mask mAP 42.13 / 38.67 42.13 / 38.66 42.12 / 38.65 42.10 / 38.64
faster-rcnn-r50-fpn-3x-coco COCO val2017, every 10th image, box mAP 41.54 41.44 41.58 41.58

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 939adfe8, 2026-11-06.

Parity with the original code

Every variant is checked against reference outputs of the original code at its pinned commit. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 1.0 and p99 <= 2.0 (absolute error of the output boxes).

Usage

from fastforks import detection

model = detection.load("faster-rcnn-r50-fpn-3x-coco")  # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.boxes, result.scores, result.labels  # [N, 4], [N], [N]
result.backend  # what ran, e.g. Backend(mode='portable', device='cuda:0', dtype='float16')

Install with pip install fastforks (see https://github.com/kleinicke/fastforks). Other variants: faster-rcnn-r50-fpn-3x-coco, mask-rcnn-r50-fpn-3x-coco.

Kernels backend

detection.load("faster-rcnn-r50-fpn-3x-coco", mode="kernels") runs our CUDA kernels (cudnn_hacc). It needs a prebuilt kernel for your GPU architecture (downloaded from https://huggingface.co/fastforks/kernels on first use) and a recent NVIDIA driver; if there is none it raises BackendUnavailableError with the reason and never falls back silently. mode="auto" picks kernels when it can run and logs the choice.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Collection including fastforks/rcnn