IS-Net (fastforks)
IS-Net (Qin et al., ECCV 2022): dichotomous image segmentation, a U²-Net-style encoder-decoder of residual U-blocks at 1024 x 1024 (strided stem), trained with intermediate supervision. isnet-general-use is the authors' general-purpose model (rembg's isnet-general-use), isnet the academic DIS5K model.
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/xuebinqin/DIS at b6764e20381f.
Task: matting. Tier: experimental. Outputs: alpha. Backends: portable, kernels.
Input: one RGB image (trimap-guided models also a trimap: background / unknown / foreground). Output: an alpha matte [H, W] in [0, 1] at the input size: 1 = foreground (background removal, dichotomous / salient object segmentation).
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 |
|---|---|---|---|---|
isnet@1 |
isnet.pth | ea0889743a78 |
Apache-2.0 | yes |
isnet-general-use@1 |
isnet-general-use.pth | 9e1aafea58f0 |
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: DIS5K (dichotomous image segmentation) (README: the general-use model is "optimized ... for general use" (training data not named); isnet.pth is the academic model trained on DIS5K V1.0 (DIS-TR). DIS5K ships its own terms of use (DIS5K-Dataset-Terms-of-Use.pdf).).
Licence evidence: https://github.com/xuebinqin/DIS/blob/b6764e20381f6f42a70f83fa3324181529ed1403/LICENSE.md ; https://github.com/xuebinqin/DIS/blob/b6764e20381f6f42a70f83fa3324181529ed1403/README.md
Input size
any H x W >= 32, padded to a multiple of 32
Tested up to (portable, fp16, RTX 5060 Ti 16 GB): isnet 3000x4000 (0.9 GiB peak allocated, 1.0 reserved); isnet-general-use 3000x4000 (0.9 GiB peak allocated, 1.0 reserved)
Speed and memory
Matting, synthetic, 1080x1920
| model | time (ms): original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels |
|---|---|---|---|---|---|---|---|---|
isnet |
38.5 | 21.0 | 12.1 | 3.2x | 1.7x | 993 / 1042 | 512 / 562 | 487 / 522 |
Startup and first call
| model | load (s): original | portable | kernels | first call (s): original | portable | kernels |
|---|---|---|---|---|---|---|
isnet |
1.58 | 0.23 | 1.54 | 0.41 | 0.34 | 0.12 |
isnet-general-use |
1.58 | 0.24 | 1.32 | 0.41 | 0.29 | 0.09 |
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) |
|---|---|---|---|---|---|---|---|---|---|---|---|
isnet |
1080x1920 | 21.0 ms | 13.1 ms | 6.70 ms | 12.1 ms | 33.8 s | 34.4 s | 512 / 562 | 350 / 400 | 487 / 522 | 404 / 436 |
isnet-general-use |
1080x1920 | 21.0 ms | 13.1 ms | 6.66 ms | 12.1 ms | 33.9 s | 32.3 s | 512 / 562 | 350 / 400 | 487 / 522 | 404 / 436 |
Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB).
isnet-general-use: same network and settings asisnet, measured once (rows not repeated).
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 against its binary mask: MAE of the alpha, max F-beta (beta^2 = 0.3) over 256 thresholds (BiRefNet's evaluation). Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | portable | kernels | note |
|---|---|---|---|---|---|
isnet-general-use |
DIS5K validation (DIS-VD), every 2nd image (235), MAE / max F-beta | 0.0157 / 0.9624 | 0.0157 / 0.9624 | 0.0157 / 0.9624 | |
isnet |
DIS5K validation (DIS-VD), every 2nd image (235), MAE / max F-beta | 0.0768 / 0.7820 | 0.0768 / 0.7821 | 0.0768 / 0.7821 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 45a5c91f, 2026-11-13.
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.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output alpha).
Usage
from fastforks import matting
model = matting.load("isnet") # mode="auto": the preferred backend from recorded measurements
result = model("photo.jpg")
result.alpha # [H, W] float32 in [0, 1], input resolution
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: isnet, isnet-general-use.
Kernels backend
matting.load("isnet", mode="kernels") runs our CUDA kernels (cudnn_hacc, igev, cutlass_conv). 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.