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
- Paper SegNeXt: Rethinking Convolutional Attention Design for Semantic Segmentation NeurIPS 2022 · first released 18 Sept 2022
- Authors’ code Visual-Attention-Network/SegNeXt (PyTorch), not the code forked here: The mmsegmentation port carries the architecture and the model-zoo checkpoints without the authors' mmsegmentation fork.
Paper 2022 Added in 0.2.0 Evaluated with 0.2.0
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.
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call | fp32 | 21.1 | – | 1,585 MiB/1,622 MiB | 3.7 | 0.04 |
| Original fp16torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every call | fp16 | 23.8 | 0.89× | 1,593 MiB/1,648 MiB | 0.2 | 0.34 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 15.9 | 1.3× | 332 MiB/378 MiB | 0.1 | 0.07 |
| Kernels | fp16 | 9.02 | 2.3× | 110 MiB/158 MiB | 0.4 | 0.01 |
| Portable + torch.compile | 16.6 | 1.3× | 446 MiB/480 MiB | 19 (build) | – | |
| TensorRT fp16 | fp16 | 16.0 | 1.3× | 788 MiBenginenot comparable | 60 (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
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-12 | Original | fp32 | cannot run here | – | 1024x2048 | |
| Portable | fp16 | 118 | 1,445 MiB process | matches | 1024x2048 | |
| Portable | fp32 | 128 | 1,482 MiB process | matches | 1024x2048 | |
| Kernels | fp16 | not 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
-
- ImageNet-1k (ILSVRC 2012 classification) noncommercial, non-commercial
- ADE20K (SceneParsing, 150 classes) noncommercial, non-commercial
Our reading of the licences, not legal advice.
Weights
segnext-mscan-t-ade20k.pth 17.3 MB· hosted on OpenMMLabfastforks 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 %
| Run | dtype | mIoU % ↑ | aAcc % ↑ | Δ mIoU % vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 39.88 | 79.20 | reference | 500 | 15.5 |
| Original fp16 | fp16 | 39.88 | 79.20 | ±0.00 | 500 | 23.2 |
| Portable fp32 | fp32 | 39.88 | 79.20 | ±0.00 | 500 | 17.2 |
| Portable | fp16 | 39.86 | 79.18 | −0.02 | 500 | 13.6 |
| Kernels | fp16 | 39.86 | 79.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).
| Check | Tolerance | Measured |
|---|---|---|
| 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 CNNsfvm_convfused convolutions for image classifiersfvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)fvm_r3further fused classifier blocksseg_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.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
segnext-mscan-t-ade20k | synthetic (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-ade20k | synthetic (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-ade20k | synthetic (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-ade20k | synthetic (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-ade20k1024x2048 (0.4 GiB peak allocated, 0.5 reserved);segnext-mscan-s-ade20k1024x2048 (0.5 GiB peak allocated, 0.5 reserved);segnext-mscan-b-ade20k1024x2048 (0.5 GiB peak allocated, 0.5 reserved);segnext-mscan-l-ade20k1024x2048 (0.5 GiB peak allocated, 0.5 reserved) segnext-mscan-t-ade20k1024x2048, first call: portable + torch.compile 19 s (cold Inductor cache), TensorRT fp16 60 s (ONNX + engine).segnext-mscan-s-ade20k1024x2048, first call: portable + torch.compile 17 s (cold Inductor cache), TensorRT fp16 57 s (ONNX + engine).segnext-mscan-b-ade20k1024x2048, first call: portable + torch.compile 24 s (cold Inductor cache), TensorRT fp16 66 s (ONNX + engine).segnext-mscan-l-ade20k1024x2048, first call: portable + torch.compile 35 s (cold Inductor cache), TensorRT fp16 82 s (ONNX + engine).segnext-mscan-t-ade20koriginal (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-t-ade20koriginal 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-s-ade20koriginal (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-s-ade20koriginal 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-b-ade20koriginal (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-b-ade20koriginal 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-l-ade20koriginal (fp32) 1024x2048: mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-l-ade20koriginal 1024x2048: torch.autocast(float16) around the call; mmsegmentation 1.2.2 encode_decode, NMF start bases seeded (0) on every callsegnext-mscan-t-ade20kload / 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-ade20kload / 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-ade20kload / 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-ade20kload / 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.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | 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.88 / 79.20 | 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.81 / 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.96 / 82.21 | 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 | 48.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).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
segnext-mscan-t-ade20k | 0.03512 / 0.1318 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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-ade20k | 0.076 / 0.27469 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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-ade20k | 0.06862 / 0.23942 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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-ade20k | 0.04729 / 0.17984 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_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).
- table 54%
- plate 46%
- floor 0.5%
- wall 0.2%
Input: A cup of coffee, Rachel Michetti (CC0).