mmseg CNN classics (fastforks)

The mmsegmentation ADE20K checkpoints of the CNN classics: FCN, PSPNet, DeepLabV3 and DeepLabV3+ on a dilated ResNet-101 (output stride 8), and HRNetV2-W48 with an FCN head; networks vendored from mmsegmentation (no mmseg / mmcv dependency).

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/open-mmlab/mmsegmentation at c685fe6767c4.

Task: segmentation. Tier: stable. Outputs: logits. Backends: portable, kernels.

Input: one RGB image. Output: per-pixel class logits.

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
deeplabv3-r101-d8-ade20k@1 deeplabv3-r101-d8-ade20k.pth b1f72b3ba583 Apache-2.0 yes
deeplabv3plus-r101-d8-ade20k@1 deeplabv3plus-r101-d8-ade20k.pth 38ed86bbd468 Apache-2.0 yes
fcn-r101-d8-ade20k@1 fcn-r101-d8-ade20k.pth fd192bd5eced Apache-2.0 yes
hrnet-w48-fcn-ade20k@1 hrnet-w48-fcn-ade20k.pth a52fc02c6328 Apache-2.0 yes
pspnet-r101-d8-ade20k@1 pspnet-r101-d8-ade20k.pth 967c316f8cd5 Apache-2.0 yes

Licence

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

Training data: ImageNet-1k (ILSVRC 2012 classification), ADE20K (SceneParsing, 150 classes).

Licence evidence: https://github.com/open-mmlab/mmsegmentation/blob/c685fe6767c4cadf6b051983ca6208f1b9d1ccb8/README.md#license

Input size

any H x W >= 1, resized or padded inside the model Tested up to (portable, fp16, RTX 5060 Ti 16 GB): deeplabv3-r101-d8-ade20k 3000x4000 (7.3 GiB peak allocated, 7.5 reserved); deeplabv3plus-r101-d8-ade20k 3000x4000 (7.2 GiB peak allocated, 7.5 reserved); fcn-r101-d8-ade20k 3000x4000 (7.2 GiB peak allocated, 7.5 reserved); hrnet-w48-fcn-ade20k 3000x4000 (7.2 GiB peak allocated, 7.5 reserved); pspnet-r101-d8-ade20k 3000x4000 (7.2 GiB peak allocated, 7.5 reserved)

Speed and memory

Segmentation, synthetic, 1024x2048

model time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
deeplabv3-r101-d8-ade20k 108.41 54.83 48.14 20.06 2.7x 2.4x 2031 / 2162 531 / 572 362 / 518
deeplabv3plus-r101-d8-ade20k 104.1 53.36 47.34 18.02 3.0x 2.6x 1891 / 2024 491 / 552 365 / 560
fcn-r101-d8-ade20k 94.21 47.05 40.99 16.65 2.8x 2.5x 1925 / 2102 495 / 532 294 / 478
hrnet-w48-fcn-ade20k 48.09 54.8 32.28 11.86 4.1x 2.7x 1915 / 2010 502 / 548 274 / 430
pspnet-r101-d8-ade20k 92.52 47.17 49.34 24.96 1.9x 2.0x 1922 / 2222 494 / 552 341 / 494

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
deeplabv3-r101-d8-ade20k 1.64 (512x512) 0.94 0.91โ€  0.03 (512x512) 0.10โ€  0.02โ€ 
deeplabv3plus-r101-d8-ade20k 4.72 (512x512) 0.88 0.75โ€  0.66 (512x512) 0.12โ€  0.02โ€ 
fcn-r101-d8-ade20k 4.72 (512x512) 1.14 0.91โ€  0.39 (512x512) 0.10โ€  0.02โ€ 
hrnet-w48-fcn-ade20k 1.48 (512x512) 0.73 0.85โ€  0.08 (512x512) 0.10โ€  0.01โ€ 
pspnet-r101-d8-ade20k 1.35 (512x512) 0.93 0.77โ€  0.09 (512x512) 0.10โ€  0.03โ€ 

Fixed-size speed and peak memory, all models

model mode 640x480 1280x720 1920x1080 12 MP 4000x3000
deeplabv3-r101-d8-ade20k portable 33.5 ms / 550 / 784 45.5 ms / 978 / 1282 52.4 ms / 1650 / 1966 103.8 ms / 7442 / 7698
deeplabv3-r101-d8-ade20k kernels 20.0 ms / 583 / 718 28.5 ms / 1012 / 1196 35.5 ms / 1684 / 1880 90.5 ms / 7476 / 7708
deeplabv3plus-r101-d8-ade20k portable 35.4 ms / 513 / 766 48.8 ms / 944 / 1272 55.8 ms / 1616 / 1944 105.7 ms / 7396 / 7644
deeplabv3plus-r101-d8-ade20k kernels 23.8 ms / 546 / 716 34.0 ms / 977 / 1222 41.0 ms / 1649 / 1902 94.4 ms / 7429 / 7668
fcn-r101-d8-ade20k portable 28.6 ms / 515 / 720 38.9 ms / 943 / 1230 46.0 ms / 1614 / 1894 99.2 ms / 7407 / 7662
fcn-r101-d8-ade20k kernels 17.6 ms / 549 / 692 25.5 ms / 977 / 1154 32.5 ms / 1649 / 1854 88.2 ms / 7441 / 7682
hrnet-w48-fcn-ade20k portable 31.0 ms / 523 / 696 36.1 ms / 954 / 1194 42.8 ms / 1626 / 1836 101.5 ms / 7406 / 7632
hrnet-w48-fcn-ade20k kernels 23.0 ms / 523 / 652 27.7 ms / 955 / 1114 35.1 ms / 1627 / 1824 93.3 ms / 7406 / 7694
pspnet-r101-d8-ade20k portable 31.8 ms / 513 / 810 46.8 ms / 941 / 1296 53.8 ms / 1613 / 1976 102.4 ms / 7406 / 7632
pspnet-r101-d8-ade20k kernels 20.5 ms / 548 / 722 32.6 ms / 975 / 1178 39.5 ms / 1647 / 1838 91.2 ms / 7439 / 7668

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 authors' code 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

Parity with the original code

Every variant is checked against golden 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| <= 0.04 px and p99 <= 0.15 px.

Usage

from fastforks import segmentation

model = segmentation.load("deeplabv3-r101-d8-ade20k")  # portable PyTorch on the GPU if there is one, else the CPU
result = model("photo.jpg")
result.labels  # [H, W] per-pixel class index
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: deeplabv3-r101-d8-ade20k, deeplabv3plus-r101-d8-ade20k, fcn-r101-d8-ade20k, hrnet-w48-fcn-ade20k, pspnet-r101-d8-ade20k.

Kernels backend

segmentation.load("deeplabv3-r101-d8-ade20k", mode="kernels") runs our CUDA kernels (igev, cutlass_conv, cudnn_hacc, seg_conv, seg_up). 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