fastforks – fast vision models
fastforks: fast, memory-saving vision nodes for ComfyUI. One node per task with a model dropdown, weights download on first use, and the same nodes run on Windows, Linux and macOS (NVIDIA CUDA, Apple silicon via MPS or MLX, CPU). 471 checkpoints from about 160 network families, each run with the authors' own weights and checked against their code. Instead of one node pack per model you get one node per task, and the same model usually runs 2x to 30x faster with 1.3x to 10x less peak VRAM. HOW FAST: the "Nx" after a network is the typical speed-up over the authors' own code with the same weights (median over image sizes, RTX 5060 Ti 16 GB, warm runs; 1x-2x is left unmarked). Against popular ComfyUI packs: Metric3D v2 normals 29x vs comfyui_controlnet_aux, Depth Anything V2 6x vs kijai/ComfyUI-DepthAnythingV2, BiRefNet 3.6x vs ComfyUI-RMBG, Real-ESRGAN 3.6x vs ComfyUI's own upscale node. Numbers differ per GPU, image size and model; each node tooltip and docs/comfyui.md say more. TASKS
fastforks
Faster versions of published vision models behind one API: stereo matching, monocular and multi-view depth, image classification, semantic and promptable segmentation (SAM), object detection and feature backbones (DINOv2, DINOv3). You load a model by its id and get the original network's output, faster.
Docs, model tables and benchmarks: fastforks.dev.
Every model has two backends; kernels run only where the GPU and driver fit (otherwise auto uses portable):
- portable: the original network in plain PyTorch, checked against the authors' code. Validated on CPU, NVIDIA CUDA and Apple MPS; other PyTorch devices are untested.
- kernels: the same network with our CUDA kernels (NVIDIA sm_80 or newer, Linux or Windows x86-64) and, for 19 families, Metal kernels on Apple silicon. Across the models and sizes we measured, the median is 1.9x faster than portable, with a quarter at 2.5x or more and the best at 10x (small classifiers at batch 1). A few plain ViT classifiers gain nothing (benchmarks).
By default (mode="auto") fastforks uses kernels where they can run and the recorded measurements prefer them, and portable everywhere else.
| task | package | call → result | example models |
|---|---|---|---|
| stereo matching | fastforks.stereo | model(left, right) → disparity | igev-stereo-sceneflow, raft-stereo-middlebury, las2-s |
| optical flow | fastforks.flow | model(image1, image2) → per-pixel motion [2, H, W] (dx, dy in pixels) | raft-large, raft-small |
| dense matching | fastforks.matching | model(image1, image2) → for every pixel of image1 its position in image2 [2, H1, W1] (pixels) and a certainty [H1, W1] | romav2, romav1 |
| structure from motion | fastforks.matching.sfm | colmap_database(images, db) → COLMAP database (retrieval, matching, verification); reconstruct(images, out) → camera poses + sparse points | loma-b (default), aliked-lightglue (fast), disk-lightglue |
| monocular depth | fastforks.depth | model(image) → depth or inverse depth | depth-anything-v2-s, moge-2-vitl-normal, depth-pro |
| multi-view depth | fastforks.multiview | model(images) → depth, points, cameras per view; calibrated MVS (mvsanywhere, patchmatchnet) also take intrinsics=, cam_to_world= (patchmatchnet also needs depth_range=(near, far) and returns the reference view only); VGGT / MapAnything / AnySplat: images only; AnySplat also returns result.gaussians (3DGS, .save("x.ply")) | mvsanywhere, vggt-1b, mapanything-apache |
| image classification | fastforks.classification | model(image) → logits, top(k) | resnet50.tv2_in1k, efficientnet_b0.tv_in1k, vit_base_patch16_224.augreg2_in21k_ft_in1k, wd-vit-tagger-v3, falconsai-nsfw-vit |
| semantic segmentation | fastforks.segmentation | model(image) → label map | segformer-b0-ade20k, mask2former-swinl-ade20k, eomt-l-dinov2-ade20k, segformer-b2-clothes, bisenet-face-parsing |
| promptable segmentation: SAM / SAM 2 | fastforks.promptable_segmentation | model(image, input_points=[[x, y]], input_labels=[1]) or input_boxes= → masks [3, H, W] bool + iou_scores [3] (one point) | sam-vit-b, sam2.1-hiera-large |
| promptable segmentation: SAM 3 concepts | fastforks.promptable_segmentation | model(image, text="cat") and / or exemplar boxes input_boxes= → every instance of the concept | sam3 |
| object detection | fastforks.detection | model(image) → boxes, labels, scores | faster-rcnn-r50-fpn-3x-coco, mask-rcnn-r50-fpn-3x-coco |
| matting / background removal | fastforks.matting | model(image) → alpha [H, W] in [0, 1] (1 = foreground) | birefnet, birefnet-lite, ben2, isnet-general-use, u2net, inspyrenet |
| line art / edge maps | fastforks.edges | model(image) → edges [H, W] in [0, 1] (1 = line), ControlNet preprocessors | lineart, lineart-coarse |
| text recognition (OCR) | fastforks.ocr | model(image) → text lines in reading order: quads [N, 4, 2], texts, scores | ppocrv5-server, ppocrv5-mobile, parseq |
| point tracking | fastforks.tracking | model(frames, queries) with queries [Q, 3] (t, x, y) → tracks [T, Q, 2] (pixels) + visibility [T, Q] | tapnext, tapnext-pp, bootstapir, tapir, alltracker, alltracker-tiny, track-on2, track-on-r, locotrack-b, locotrack-s |
| frame interpolation | fastforks.interpolation | model(frame1, frame2, timestep=0.5) → frame [3, H, W] RGB in [0, 1] | rife-4.25, rife-4.26, rife-4.25-lite, gimm-vfi-r, gimm-vfi-r-p, ema-vfi, ema-vfi-small, ema-vfi-t, ema-vfi-small-t, film |
| image retrieval / place recognition | fastforks.retrieval | model(image) → descriptor [D] (unit norm); retrieval.top_k(queries, database), retrieval.pairs(descriptors) | megaloc |
| camera calibration | fastforks.calibration | model(image) → intrinsics [3, 3], gravity [3], roll / pitch / vertical FoV (rad) | geocalib-pinhole, anycalib-pinhole |
| image restoration / upscaling | fastforks.restoration | model(image) (tile=512 for large images) → image [3, sH, sW] RGB in [0, 1], s = model.scale | realesrgan-x4plus, realesrgan-x2plus, realesrgan-x4plus-anime-6b, hat-x4, dat-x4, codeformer, realesr-general-x4v3, realplksr-nomoswebphoto-x4, gfpgan-v1.4 |
| human pose | fastforks.pose | model(image, boxes=person_boxes) → 17 COCO keypoints (133 whole-body for DWPose) with scores per person | rtmpose-m, vitpose-plus-base, rtmpose-l-384 |
| 3D medical segmentation | fastforks.volume | model(ct, meta=meta) (volume.read_nifti) or model(ct, spacing=...) → labels [D, H, W] per voxel (117 TotalSegmentator classes); volume.load(folder) for any nnU-Net v2 export | totalsegmentator-total, totalsegmentator-total-3mm |
| feature backbones | fastforks.features | model(image) → token features, image embedding | dinov2-vitb14, dinov3-vitl16, dinov3-convnext-small |
The task links go to the model pages, which list every model of the task with its licences, accuracy, speed and memory. Not sure which model to use? The overview compares them per task and names the fastest, the most accurate and the best commercially usable ones.
from fastforks import stereo
model = stereo.load("igev-stereo-sceneflow") # kernels on a supported NVIDIA GPU or Apple silicon, else portable
result = model("left.png", "right.png")
result.disparity # [H, W] float32 tensor, pixels
result.backend # which backend ran, on which device
cpu_model = stereo.load("igev-stereo-sceneflow", device="cpu") # also with a CUDA build of PyTorch
One line per task (families built on timm, torchvision or transformers need that extra; see the install table below):
# needs: pip install "fastforks-core[torchvision]"
from fastforks import classification, depth, detection, segmentation
depth.load("depth-anything-v2-s")("room.jpg").inverse_depth # [H, W] float32 relative inverse depth
detection.load("rtdetrv2-s-coco")("street.jpg", score_threshold=0.5).to_list() # dicts: box, class_name, score
classification.load("resnet50.tv2_in1k")("cat.jpg").top(3) # [(class name, probability), ...]
segmentation.load("dinov2-s-linear-ade20k")("street.jpg").labels # [H, W] class index per pixel
mode="kernels" or mode="portable" forces a backend; kernels raises with the reason if it cannot run here instead of
silently falling back. fastforks bench igev-stereo-sceneflow times both on your machine. For deployment, TensorRT can
be faster than kernels for a few models (see export).
The usage guide has a quickstart per task and covers
precision, batches, video, several GPUs, torch.compile, ONNX and TensorRT export, and loading your own weights.
Install
Install PyTorch for your platform first (pytorch.org); fastforks uses the build you have, CUDA or CPU-only. Then:
pip install fastforks # everything: all models + timm, torchvision, transformers, ONNX
pip install "fastforks[tensorrt]" # everything + TensorRT export
pip install fastforks-core # lean: every model whose code licence is permissive, no extra libraries
pip install "fastforks-core[nc]" # + models with non-commercial or GPL code (S2M2, FoundationStereo, MonSter, CoEx, ...)
pip install "fastforks-core[timm]" # libraries some model families are built on
pip install "fastforks-core[torchvision]"
pip install "fastforks-core[transformers]"
pip install "fastforks-core[onnx]" # ONNX export
pip install "fastforks-core[tensorrt]" # TensorRT export
pip install "fastforks-core[sfm]" # pycolmap: `fastforks sfm --reconstruct` (the COLMAP mapper)
pip install "fastforks-core[nifti]" # nibabel: `fastforks.volume.read_nifti` / `write_nifti`
pip install "fastforks-core[dicom]" # + pydicom: `fastforks.volume.read_dicom`
pip install "fastforks-core[mlx]" # Apple MLX backend (device="mlx", Apple silicon)
pip install "fastforks-core[libs]" # timm, torchvision, transformers and ONNX at once
Without an extra, every task works except these (MissingDependencyError names the extra when one is missing):
| Task | Needs |
| --- | --- |
| classification | [timm] (11 models) or [torchvision] (15 models) |
| segmentation | [transformers] (SegFormer, Mask2Former, ...); the other 10 models need none |
| detection | [torchvision] for the R-CNN models |
| volume | [nifti] for read_nifti / write_nifti, [dicom] for read_dicom |
| stereo, depth, features, promptable segmentation, multi-view | none |
| ONNX / TensorRT export | [onnx] / [tensorrt] |
pip install fastforks pulls a default torch build, which may be CPU-only on your platform. For a CUDA build install torch
first from pytorch.org (e.g. pip install torch --index-url https://download.pytorch.org/whl/cu130); python -c "import torch; print(torch.cuda.is_available())" should print True.
From a git checkout (every model, like fastforks):
uv pip install -e '.[libs]' # or pip install -e '.[libs]'; `pip install .` (no -e) works too
fastforks is fastforks-core[nc,libs]; both install the same import fastforks. For commercial products start from
fastforks-core. Weights with a non-commercial licence (S2M2, FoundationStereo, but also bridgedepth-sf with
permissive code) are never downloaded unless you set FASTFORKS_NONCOMMERCIAL=1; weights=PATH uses a copy you have.
A model whose library is missing fails in load with the extra to install. Weights and kernels are downloaded on first use
into ~/.cache/fastforks and checked against a recorded SHA-256; fastforks download MODEL fetches them ahead of
time, and the Docker guide covers offline machines
and Docker images. Weights you already have are used in place: files in the Hugging Face hub cache (e.g. from
hf download) or in a directory on FASTFORKS_WEIGHTS_PATH, or one file passed as load(..., weights=PATH).
Gated weights (e.g. DINOv3): accept the licence on the model's Hugging Face page, log in (hf auth login, or
huggingface_hub.login() in Python), and load the model; the download goes through huggingface_hub. fastforks never
handles your Hugging Face token.
Requirements: Python >= 3.11 and PyTorch >= 2.8. Metal kernels run on Apple silicon (see the usage guide). The CUDA kernels need Linux or Windows on x86-64, an NVIDIA GPU of compute
capability 8.0 or newer (RTX 30 series, A100 and later) and a driver >= 570. So far it is tested only on an
RTX 5060 Ti: fastforks env shows what your GPU would use, and
Other GPUs explains how to measure it and send
us the numbers.
Models and licences
Many models are licensed for non-commercial use only. Each model page lists the code licence, the weights licence,
the training data and a commercial-use flag, which is yes only if both the code and the weights licence allow
commercial use. Each model directory keeps the original licence file, and weights are downloaded from the authors'
own hosts (a few from a mirror of the same files).
import fastforks
from fastforks import stereo
stereo.list_models(commercial="yes") # stereo models whose code and weights licences allow commercial use
print(fastforks.describe_models(stereo.list_models("igev*"))) # licences, and what blocks a "yes"
Training-data terms (SceneFlow, KITTI, ImageNet, ...) are shown as a note next to the flag; the usage guide explains how the flag is set. None of this is legal advice.
Command line
fastforks list [PATTERN] [--task TASK] [--commercial yes|no|unclear] [--tier stable|experimental|deprecated] [--format text|json|csv]
fastforks info depth-anything-v2-s # one model in detail
fastforks download [MODEL ...] [--kernels] # fetch weights and kernels ahead of time
fastforks stereo run LEFT RIGHT --model MODEL --out DIR # a stereo model over many pairs (folders or globs)
fastforks sfm IMAGES OUT [--reconstruct] [--matcher MODEL] # image folder -> COLMAP database (-> poses + points)
fastforks bench igev-stereo-sceneflow [--mode auto|portable|kernels] [--size HxW] # portable and kernels side by side
fastforks export MODEL --format onnx|trt [--size HxW] [--fp16] [-o FILE]
fastforks doctor # which models can run here, and what blocks the others
fastforks env # versions, GPU, kernel binaries (for bug reports)
fastforks COMMAND --help lists all options.
Licence
The fastforks core, the wrappers and our kernels are Apache-2.0 (LICENSE). Vendored model code keeps its original
licence (the LICENSE* file in each model directory), and so do our modifications of it.
Contributing
See CONTRIBUTING.md; the checklist for adding a model is there. What changed between releases: CHANGELOG.md.