Models · Semantic segmentation

SegNeXt

SegNeXt (Guo et al. 2022; tiny, small, base, large; the MMSegmentation ADE20K checkpoints): convolutional scene segmentation with multi-scale strip-convolution attention. Apache-2.0.

stable Fork of open-mmlab/mmsegmentation@c685fe6 · backends: portable, kernels

Checkpoint

Paper 2022 Added in 0.2.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 9.02 ms 1024x2048, fp16
vs the faster original 2.3× original fp32: 21.1 ms
Peak memory 110 MiB original: 1,585 MiB
Accuracy vs original fp32 −0.02 kernels mIoU %, ADE20K val (39.88 original)

Use it

pip install fastforks

Lean install with only what this model needs: pip install fastforks-core

from fastforks import segmentation

model = segmentation.load("segnext-mscan-t-ade20k")  # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend  # what ran: mode, device, dtype, kernels
fastforks bench segnext-mscan-t-ade20k

Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.

Speed and memory

Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.

BackenddtypeTime per call (ms)vs original fp32Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callfp32 21.1–1,585 MiB/1,622 MiB3.70.04
Original fp16torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callfp16 23.80.89×1,593 MiB/1,648 MiB0.20.34
Portable fp32fp32not measured ––––
Portablefp16 15.91.3×332 MiB/378 MiB0.10.07
Kernelsfp16 9.022.3×110 MiB/158 MiB0.40.01
Portable + torch.compile 16.61.3×446 MiB/480 MiB19 (build)–
TensorRT fp16fp16 16.01.3×788 MiBenginenot comparable60 (build)–

Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-11 to 2026-11-16. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.

Other devices

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12Originalfp32cannot run here–1024x2048
Portablefp16118 1,445 MiB processmatches1024x2048
Portablefp32128 1,482 MiB processmatches1024x2048
Kernelsfp16not implemented–1024x2048

CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.

Licence and weights

Commercial use allowed

Code
Apache-2.0 LICENSE
Weights
Apache-2.0 source
Training data

Our reading of the licences, not legal advice.

Weights

segnext-mscan-t-ade20k.pth 17.3 MB· hosted on OpenMMLab

fastforks downloads and checks these files on first use (fastforks download segnext-mscan-t-ade20k).

Accuracy

The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.

ADE20K val

every 4th image, mIoU / aAcc %

RundtypemIoU % ↑aAcc % ↑Δ mIoU % vs fp32 originalimagesms / image
Original fp32fp3239.8879.20 reference 500 15.5
Original fp16fp1639.8879.20 ±0.00 500 23.2
Portable fp32fp3239.8879.20 ±0.00 500 17.2
Portablefp1639.8679.18 −0.02 500 13.6
Kernelsfp1639.8679.18 −0.02 500 9.14

Each image at its own size, argmax of the logits. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7ba7307f, 2026-11-11; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 95e72cc0, 2026-11-11.

Closeness to the original

Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. 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).

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.00078 not recorded
GPU default dtypes, mean |diff|≤ 0.14 0.03512
GPU default dtypes, p99 |diff|≤ 0.47 0.1318

Recorded for segnext-mscan-t-ade20k on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3seg_convseg_up

Details

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).

Input / output
Input: one RGB image. Output: per-pixel class labels (logits with logits=True).
Input size
any H x W >= 1, resized or padded inside the model; tested up to 1024x2048 (449 MiB allocated)
Outputs
logits
Checkpoint
arch="mscan-t"
CUDA kernels
  • seg_convfused convolutions for segmentation CNNs
  • fvm_convfused convolutions for image classifiers
  • fvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)
  • fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)
  • fvm_r3further fused classifier blocks
  • seg_upfused resize and argmax of segmentation scores
Apple (MPS)
fp32, fp16
Full reference, generated from the repository

SegNeXt (Guo et al. 2022; tiny, small, base, large; the MMSegmentation ADE20K checkpoints): convolutional scene segmentation with multi-scale strip-convolution attention. Apache-2.0.

Commercial use: yes.

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
segnext-mscan-t-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
21.1
23.8
15.9
9.02
16.6
16.0
1585 / 1622
1593 / 1648
332 / 378
110 / 158
446 / 480
1476 / 1498
segnext-mscan-s-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
28.6
23.3
18.5
8.04
24.9
18.0
1622 / 1672
1649 / 1700
350 / 402
164 / 202
465 / 482
1493 / 1544
segnext-mscan-b-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
44.8
33.9
28.3
12.1
40.7
23.3
1674 / 1728
1727 / 1838
376 / 424
192 / 226
491 / 526
1553 / 1622
segnext-mscan-l-ade20ksynthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
69.7
52.2
43.1
20.7
63.6
32.3
1756 / 1810
1849 / 1894
417 / 458
277 / 320
532 / 578
1634 / 1694
Details
  • Original code: https://github.com/open-mmlab/mmsegmentation at c685fe6767c4
  • Code licence: Apache-2.0 (permissive); files: LICENSE
  • Weights licence: Apache-2.0
  • Licence evidence: https://github.com/open-mmlab/mmsegmentation/blob/c685fe6767c4cadf6b051983ca6208f1b9d1ccb8/README.md#license
  • Training data: ImageNet-1k (ILSVRC 2012 classification), ADE20K (SceneParsing, 150 classes)
  • Kernel libraries: seg_conv, fvm_conv, fvm_extra, fvm_mb, fvm_r3, seg_up
  • Variants: segnext-mscan-t-ade20k, segnext-mscan-s-ade20k, segnext-mscan-b-ade20k, segnext-mscan-l-ade20k
  • Outputs: logits; label_set: ade20k-150
  • 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-t-ade20k 1024x2048 (0.4 GiB peak allocated, 0.5 reserved); segnext-mscan-s-ade20k 1024x2048 (0.5 GiB peak allocated, 0.5 reserved); 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-t-ade20k 1024x2048, first call: portable + torch.compile 19 s (cold Inductor cache), TensorRT fp16 60 s (ONNX + engine).
  • segnext-mscan-s-ade20k 1024x2048, first call: portable + torch.compile 17 s (cold Inductor cache), TensorRT fp16 57 s (ONNX + engine).
  • segnext-mscan-b-ade20k 1024x2048, first call: portable + torch.compile 24 s (cold Inductor cache), TensorRT fp16 66 s (ONNX + engine).
  • segnext-mscan-l-ade20k 1024x2048, first call: portable + torch.compile 35 s (cold Inductor cache), TensorRT fp16 82 s (ONNX + engine).
  • segnext-mscan-t-ade20k original (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-t-ade20k original 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-s-ade20k original (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-s-ade20k original 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-b-ade20k original (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-b-ade20k original 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-l-ade20k original (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-l-ade20k original 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call
  • segnext-mscan-t-ade20k load / first call: original 0.19 s / 0.335 s, portable 0.13 s / 0.649 s (512x512), kernels 1.26 s / 0.199 s (512x512)
  • segnext-mscan-s-ade20k load / first call: original 0.23 s / 0.316 s, portable 0.15 s / 0.722 s (512x512), kernels 1.29 s / 0.187 s (512x512)
  • segnext-mscan-b-ade20k load / first call: original 0.37 s / 0.186 s, portable 0.26 s / 0.578 s (512x512), kernels 1.34 s / 0.18 s (512x512)
  • segnext-mscan-l-ade20k load / first call: original 0.57 s / 0.063 s, portable 0.57 s / 0.409 s (512x512), kernels 1.51 s / 0.099 s (512x512)
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5

Measured

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

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
segnext-mscan-t-ade20kADE20K val, every 4th image, mIoU / aAcc %39.88 / 79.2039.88 / 79.2039.86 / 79.1839.88 / 79.2039.86 / 79.18
segnext-mscan-s-ade20kADE20K val, every 4th image, mIoU / aAcc %42.81 / 80.6542.81 / 80.6542.82 / 80.6542.81 / 80.6542.82 / 80.64
segnext-mscan-b-ade20kADE20K val, every 4th image, mIoU / aAcc %46.96 / 82.2246.95 / 82.2146.98 / 82.2246.96 / 82.2146.98 / 82.22
segnext-mscan-l-ade20kADE20K val, every 4th image, mIoU / aAcc %48.88 / 83.2348.87 / 83.2348.89 / 83.2348.88 / 83.2348.88 / 83.23

Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 95e72cc0, 2026-11-11; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 7ba7307f, 2026-11-11; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 95e72cc0, 2026-11-11.

Parity

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).

variantkernels error vs original, mean / p99GPU, torchkernels used
segnext-mscan-t-ade20k0.03512 / 0.1318RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120, seg_conv@8eec95783e28:sm_120, seg_up@3e44e71200cd:sm_120
segnext-mscan-s-ade20k0.076 / 0.27469RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120, seg_conv@8eec95783e28:sm_120, seg_up@3e44e71200cd:sm_120
segnext-mscan-b-ade20k0.06862 / 0.23942RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120, seg_conv@8eec95783e28:sm_120, seg_up@3e44e71200cd:sm_120
segnext-mscan-l-ade20k0.04729 / 0.17984RTX 5060 Ti, torch 2.14.1+cu130cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120, seg_conv@8eec95783e28:sm_120, seg_up@3e44e71200cd:sm_120

Example output

One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).

Input
Output
  • table 54%
  • plate 46%
  • floor 0.5%
  • wall 0.2%
A cup of coffee, input
Input · 100%

Input: A cup of coffee, Rachel Michetti (CC0).