Models · Semantic segmentation
BiSeNet face parsing
BiSeNet face parsing (Yu et al., ECCV 2018; zllrunning's face-parsing.PyTorch checkpoint as shipped by facexlib): labels skin, brows, eyes, glasses, ears, nose, mouth, lips, neck, cloth, hair and hat in a face crop (19 classes, CelebAMask-HQ). MIT code and weights.
experimental Fork of xinntao/facexlib@260620a · backends: portable, kernels
- Paper BiSeNet: Bilateral Segmentation Network for Real-time Semantic Segmentation ECCV 2018 · first released 2 Aug 2018
- Authors’ code zllrunning/face-parsing.PyTorch (PyTorch), not the code forked here: The network and the 79999_iter checkpoint are face-parsing.PyTorch's; facexlib carries them with a pinned GitHub release URL (the original is a Google Drive file). The test protocol (512 x 512 PIL bilinear, ImageNet normalisation, net(x)[0]) is test.py's.
Checkpoint bisenet-face-parsing
Paper 2018 Added in 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("bisenet-face-parsing") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend # what ran: mode, device, dtype, kernels fastforks bench bisenet-face-parsing 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.
Input: synthetic, 512x512
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16.half() on 1 modules, fp16 inputs; face-parsing.PyTorch test.py: PIL resize 512 x 512 on the CPU, Normalize, net(x)[0], float32 | fp16 | 5.94 | – | 69 MiB/94 MiB | 0.1 | 0.02 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 2.41 | 2.5× | 51 MiB/72 MiB | 0.2 | 0.28 |
| Kernels | not measured | – | – | – | – | |
| Portable + torch.compile | 1.34 | 4.4× | 76 MiB/110 MiB | 6 (build) | – | |
| TensorRT fp16 | fp16 | 0.678 | 8.8× | 44 MiBenginenot comparable | 13 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14. 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-14 | Original | fp32 | 23.7 | 1,466 MiB process | – | 512x512 |
| Portable | fp16 | 13.6 | 440 MiB process | matches | 512x512 | |
| Portable | fp32 | 15.8 | 1,434 MiB process | matches | 512x512 | |
| Kernels | fp32 | not implemented | – | 512x512 | ||
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
- MIT LICENSE
- Weights
- MIT source
- Training data
-
- ImageNet-1k (ILSVRC 2012 classification) noncommercial, non-commercial
- CelebAMask-HQ (30 000 CelebA-HQ faces, 19 face-part masks) noncommercial, non-commercial
Our reading of the licences, not legal advice.
Weights
parsing_bisenet.pth 53.3 MB· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download bisenet-face-parsing).
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.
Accuracy not measured for bisenet-face-parsing.
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| <= 2.6e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0042 and p99 <= 0.02 (absolute error of the output logits).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.000026 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.0042 | 0.00292 |
| GPU default dtypes, p99 |diff| | ≤ 0.02 | 0.01313 |
Recorded for bisenet-face-parsing on RTX 5060 Ti, torch 2.10.0+cu130, 2026-11-17, with these kernels: cudnn_hacccutlass_convigev
Details
BiSeNet (Yu et al. 2018) face parsing from face-parsing.PyTorch: a ResNet-18 context path with attention refinement and feature fusion, 19 CelebAMask-HQ face-part classes (skin, brows, eyes, glasses, ears, earrings, nose, mouth, lips, neck, necklace, cloth, hair, hat) on a 512 x 512 face crop. The parser that GFPGAN / CodeFormer pipelines use through facexlib; MIT code and weights.
- 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 512x512 (51 MiB allocated)
- Outputs
logits- CUDA kernels
igevIGEV stereo: convolution epilogues, correlation lookups, GRU gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Limitations
- No accuracy measurement: face parsing is scored on CelebAMask-HQ, which is not part of the evaluation data here (no public mirror with a clear licence); tiers are compared by output parity and speed only.
Full reference, generated from the repository
BiSeNet face parsing (Yu et al., ECCV 2018; zllrunning's face-parsing.PyTorch checkpoint as shipped by facexlib): labels skin, brows, eyes, glasses, ears, nose, mouth, lips, neck, cloth, hair and hat in a face crop (19 classes, CelebAMask-HQ). MIT code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
bisenet-face-parsing | synthetic (512x512) | original portable kernels portable + torch.compile TensorRT fp16 | 5.94 2.41 – 1.34 0.678 | 69 / 94 51 / 72 – 76 / 110 85 / 110 |
Details
- Original code: https://github.com/xinntao/facexlib at
260620ae9399 - Code licence: MIT (permissive); files:
LICENSE - Weights licence: MIT
- Licence evidence: https://github.com/zllrunning/face-parsing.PyTorch/blob/d2e684cf1588b46145635e8fe7bcc29544e5537e/LICENSE ; https://github.com/xinntao/facexlib/blob/260620ae93990a300f4b16448df9bb459f1caba9/LICENSE ; https://github.com/xinntao/facexlib/blob/260620ae93990a300f4b16448df9bb459f1caba9/facexlib/parsing/__init__.py
- Training data: ImageNet-1k (ILSVRC 2012 classification), CelebAMask-HQ (30 000 CelebA-HQ faces, 19 face-part masks) (face-parsing.PyTorch train.py: CelebAMask-HQ (non-commercial research only), ResNet-18 initialised from torchvision's ImageNet weights.)
- Kernel libraries:
igev,cutlass_conv,cudnn_hacc - Variants:
bisenet-face-parsing - Outputs: logits; label_set:
celebamask-hq-19-bisenet - Input size: any H x W >= 1, resized or padded inside the model
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
bisenet-face-parsing512x512 (0.0 GiB peak allocated, 0.1 reserved) bisenet-face-parsing512x512, first call: portable + torch.compile 6 s (cold Inductor cache), TensorRT fp16 13 s (ONNX + engine).bisenet-face-parsingoriginal 512x512: .half() on 1 modules, fp16 inputs; face-parsing.PyTorch test.py: PIL resize 512 x 512 on the CPU, Normalize, net(x)[0], float32bisenet-face-parsingload / first call: original 0.31 s / 0.405 s (512x512), portable 0.2 s / 0.275 s (512x512)- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Parity
CPU, float32: max |diff| <= 2.6e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0042 and p99 <= 0.02 (absolute error of the output logits).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
bisenet-face-parsing | 0.00292 / 0.01313 | RTX 5060 Ti, torch 2.10.0+cu130 | cudnn_hacc@cudnn91501, cutlass_conv@988138e042cb:sm_120, igev@f075827d68c6:sm_120 |
Limitations
- No accuracy measurement: face parsing is scored on CelebAMask-HQ, which is not part of the evaluation data here (no public mirror with a clear licence); tiers are compared by output parity and speed only.
Example output
No example rendered for this checkpoint yet.