Models · Semantic segmentation

SegFormer

NVIDIA's SegFormer: a transformer for ADE20K scene segmentation, sizes B0 and B5. Non-commercial weights.

Commercial use: no (weights: LicenseRef-NVIDIA-Source-Code-License-NC).

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
segformer-b0-ade20k (resize 2048x512)synthetic (1024x2048)original (fp32)
original
portable
kernels
portable + torch.compile
TensorRT fp16
17.2
17.4
11.4
3.48
9.27
5.51
1583 / 1638
1590 / 1766
339 / 376
148 / 238
336 / 356
792 (engine)
segformer-b5-ade20k (resize 2048x640)synthetic (1024x2048)original (fp32)
original
portable
kernels
132
72.0
38.7
25.3
2529 / 2538
2531 / 2620
546 / 590
407 / 534
Details
  • Original code: https://github.com/huggingface/transformers at c4c4605f9618
  • Code licence: Apache-2.0 (permissive); files:
  • Weights licence: LicenseRef-NVIDIA-Source-Code-License-NC
  • Licence evidence: https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512/blob/489d5cd81a0b59fab9b7ea758d3548ebe99677da/README.md
  • Training data: ImageNet-1k (ILSVRC 2012 classification), ADE20K (SceneParsing, 150 classes)
  • Kernel libraries: cudnn_hacc, fvm_conv, fvm_extra, fvm_mb, fvm_r3, seg_up
  • Variants: segformer-b0-ade20k, segformer-b5-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): segformer-b0-ade20k 3000x4000 (3.8 GiB peak allocated, 4.0 reserved); segformer-b5-ade20k 3000x4000 (4.0 GiB peak allocated, 4.3 reserved)
  • segformer-b0-ade20k 1024x2048, first call: portable + torch.compile 12 s (cold Inductor cache), TensorRT fp16 61 s (ONNX + engine).
  • segformer-b0-ade20k original 1024x2048: torch.autocast(fp16) around the forward
  • segformer-b5-ade20k original 1024x2048: torch.autocast(fp16) around the forward
  • segformer-b0-ade20k load / first call: original 4.83 s / 2.232 s (512x512), portable 2.55 s / 0.082 s, kernels 2.92 s / 0.009 s
  • segformer-b5-ade20k load / first call: original 1.24 s / 0.501 s (512x512), portable 3.09 s / 0.077 s, kernels 3.43 s / 0.032 s
  • Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5 (tools/speed_check.py), synthetic CUDA input (bench_inputs); peak = max over the first call and the timed calls

Measured

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

variantdatasetoriginal fp32original fp16portablekernelsnote
segformer-b0-ade20kADE20K val, every 4th image, mIoU / aAcc %34.68 / 76.4134.68 / 76.4134.67 / 76.4134.67 / 76.41
segformer-b5-ade20kADE20K val, every 4th image, mIoU / aAcc %48.28 / 82.7548.28 / 82.7548.28 / 82.7548.28 / 82.75

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

Parity

CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.1 (absolute error of the output logits).

variantkernels error vs original, mean / p99GPU, torchkernels used
segformer-b0-ade20k0.00916 / 0.03086RTX 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_up@3e44e71200cd:sm_120
segformer-b5-ade20k0.01145 / 0.03991RTX 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_up@3e44e71200cd:sm_120