SegNeXt (fastforks)

SegNeXt (Guo et al. 2022): the mmsegmentation ADE20K checkpoints of the MSCAN convolutional-attention backbones (tiny to large) with the light Hamburger head; network 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 labels (logits with logits=True).

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
segnext-mscan-b-ade20k@1 segnext-mscan-b-ade20k.pth 647a0cda7678 Apache-2.0 yes
segnext-mscan-l-ade20k@1 segnext-mscan-l-ade20k.pth 6593bd76d60d Apache-2.0 yes
segnext-mscan-s-ade20k@1 segnext-mscan-s-ade20k.pth ae9f7baa3081 Apache-2.0 yes
segnext-mscan-t-ade20k@1 segnext-mscan-t-ade20k.pth 226138b43873 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. Licence 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): segnext-mscan-b-ade20k 1024x2048 (0.5 GiB peak allocated, 0.5 reserved); segnext-mscan-l-ade20k 1024x2048 (0.5 GiB peak allocated, 0.5 reserved); segnext-mscan-s-ade20k 1024x2048 (0.5 GiB peak allocated, 0.5 reserved); segnext-mscan-t-ade20k 1024x2048 (0.4 GiB peak allocated, 0.5 reserved)

Speed and memory

Segmentation, synthetic

model input time (ms): original fp32 original portable kernels kernels speed-up: vs original vs portable peak memory (MiB, allocated / reserved): original portable kernels
segnext-mscan-b-ade20k 1024x2048 44.8 33.9 28.3 12.2 2.8x 2.3x 1727 / 1838 376 / 424 229 / 332
segnext-mscan-l-ade20k 1024x2048 69.7 52.2 43.1 20.6 2.5x 2.1x 1849 / 1894 417 / 458 314 / 428
segnext-mscan-s-ade20k 1024x2048 28.6 23.3 18.5 8.04 2.9x 2.3x 1649 / 1700 350 / 402 202 / 290
segnext-mscan-t-ade20k 1024x2048 21.1 23.8 15.9 8.99 2.3x 1.8x 1593 / 1648 332 / 378 147 / 206

Startup and first call

model load (s): original portable kernels first call (s): original portable kernels
segnext-mscan-b-ade20k 0.37 0.26 (512x512) 1.34 (512x512) 0.19 0.58 (512x512) 0.18 (512x512)
segnext-mscan-l-ade20k 0.57 0.57 (512x512) 1.51 (512x512) 0.06 0.41 (512x512) 0.10 (512x512)
segnext-mscan-s-ade20k 0.23 0.15 (512x512) 1.29 (512x512) 0.32 0.72 (512x512) 0.19 (512x512)
segnext-mscan-t-ade20k 0.19 0.13 (512x512) 1.26 (512x512) 0.34 0.65 (512x512) 0.20 (512x512)

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)
segnext-mscan-b-ade20k 1024x2048 28.3 ms 40.7 ms 23.3 ms 12.2 ms 24.1 s 66.3 s 376 / 424 491 / 526 229 / 332 1553 / 1622
segnext-mscan-l-ade20k 1024x2048 43.1 ms 63.6 ms 32.3 ms 20.6 ms 34.9 s 82.2 s 417 / 458 532 / 578 314 / 428 1634 / 1694
segnext-mscan-s-ade20k 1024x2048 18.5 ms 24.9 ms 18.0 ms 8.04 ms 17.2 s 56.6 s 350 / 402 465 / 482 202 / 290 1493 / 1544
segnext-mscan-t-ade20k 1024x2048 15.9 ms 16.6 ms 16.0 ms 8.99 ms 19.1 s 59.6 s 332 / 378 446 / 480 147 / 206 1476 / 1498

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

Each image at its own size, argmax of the logits. Original = the original code named under Details, same checkpoint and protocol.

variant dataset original fp32 original fp16 portable kernels note
segnext-mscan-t-ade20k ADE20K val, every 4th image, mIoU / aAcc % 39.88 / 79.20 39.88 / 79.20 39.86 / 79.18 39.86 / 79.18
segnext-mscan-s-ade20k ADE20K val, every 4th image, mIoU / aAcc % 42.81 / 80.65 42.81 / 80.65 42.82 / 80.65 42.82 / 80.64
segnext-mscan-b-ade20k ADE20K val, every 4th image, mIoU / aAcc % 46.96 / 82.22 46.95 / 82.21 46.98 / 82.22 46.98 / 82.22
segnext-mscan-l-ade20k ADE20K val, every 4th image, mIoU / aAcc % 48.88 / 83.23 48.87 / 83.23 48.89 / 83.23 48.88 / 83.23

Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 95e72cc0, 2026-11-11.

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.00078 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.14 and p99 <= 0.47 (absolute error of the output logits).

Usage

from fastforks import segmentation

model = segmentation.load("segnext-mscan-b-ade20k")  # mode="auto": the preferred backend from recorded measurements
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: segnext-mscan-b-ade20k, segnext-mscan-l-ade20k, segnext-mscan-s-ade20k, segnext-mscan-t-ade20k.

Kernels backend

segmentation.load("segnext-mscan-b-ade20k", mode="kernels") runs our CUDA kernels (seg_conv, fvm_conv, fvm_extra, fvm_mb, fvm_r3, 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

Collection including fastforks/segnext