{"slug": "show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks", "title": "Show HN: 3–5x faster inference for computer vision models, fastforks", "summary": "Fastforks launched a unified API that serves faster versions of published computer vision models, including stereo matching, monocular and multi-view depth, image classification, SAM/SAM 2 segmentation, object detection and DINOv2/DINOv3 backbones, with documentation and benchmarks at fastforks.dev. Each model ships with two backends: a portable plain-PyTorch implementation validated on CPU, NVIDIA CUDA and Apple MPS, and CUDA kernels (NVIDIA sm_80 or newer, Linux or Windows x86-64) plus Metal kernels for 19 model families on Apple silicon. Across the models and sizes measured, the kernel backend has a median speedup of 1.6x over portable, with a quarter at 2.5x or more and a best case of 11x on small classifiers at batch 1, while a few plain ViT classifiers gain nothing.", "body_md": "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.\n\nDocs, model tables and benchmarks: **[fastforks.dev](https://fastforks.dev)**. Also available as\n[ComfyUI nodes](#comfyui).\n\nEvery model has two backends; kernels run only where the GPU and driver fit (otherwise `auto` uses portable):\n\n- **portable** : the original network in plain PyTorch, checked against the authors' code. Validated on CPU, NVIDIA\nCUDA and Apple MPS; other PyTorch devices are untested. On Apple silicon,\nmany models also have an[MLX](https://fastforks.dev/usage#apple-silicon-mlx) port.\n- **kernels** : the same network with our CUDA kernels (NVIDIA sm_80 or newer, Linux or Windows x86-64) and, for 19 families, Metal\nkernels on Apple silicon. Across the models and sizes we measured, the median is 1.6x faster than portable, with a\nquarter at 2.5x or more and the best at 11x (small classifiers at batch 1). A few plain ViT classifiers gain nothing\n([benchmarks](https://fastforks.dev/benchmarks) ).\n\nBy default (`mode=\"auto\"`) fastforks uses kernels where they can run and the recorded measurements prefer them, and portable everywhere else.\n\n| task | package | call → result | example models | \n|---|---|---|---|\n| [stereo matching](https://fastforks.dev/tasks/stereo) | `fastforks.stereo` | `model(left, right)` → disparity | `igev-stereo-sceneflow` ,`raft-stereo-middlebury` ,`las2-s` | \n| [optical flow](https://fastforks.dev/tasks/flow) | `fastforks.flow` | `model(image1, image2)` → per-pixel motion`[2, H, W]` (dx, dy in pixels) | `raft-large` ,`raft-small` | \n| [dense matching](https://fastforks.dev/tasks/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` | \n| [structure from motion](https://fastforks.dev/sfm) | `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` | \n| [monocular depth](https://fastforks.dev/tasks/depth) | `fastforks.depth` | `model(image)` → depth or inverse depth | `depth-anything-v2-s` ,`moge-2-vitl-normal` ,`depth-pro` | \n| [multi-view depth](https://fastforks.dev/tasks/multiview) | `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` | \n| [image classification](https://fastforks.dev/tasks/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` | \n| [semantic segmentation](https://fastforks.dev/tasks/segmentation) | `fastforks.segmentation` | `model(image)` → label map | `segformer-b0-ade20k` ,`mask2former-swinl-ade20k` ,`eomt-l-dinov2-ade20k` ,`segformer-b2-clothes` ,`bisenet-face-parsing` | \n| [promptable segmentation: SAM / SAM 2](https://fastforks.dev/tasks/promptable_segmentation) | `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` | \n| [promptable segmentation: SAM 3 concepts](https://fastforks.dev/tasks/promptable_segmentation) | `fastforks.promptable_segmentation` | `model(image, text=\"cat\")` and / or exemplar boxes`input_boxes=` → every instance of the concept | `sam3` | \n| [object detection](https://fastforks.dev/tasks/detection) | `fastforks.detection` | `model(image)` → boxes, labels, scores | `faster-rcnn-r50-fpn-3x-coco` ,`mask-rcnn-r50-fpn-3x-coco` | \n| [matting / background removal](https://fastforks.dev/tasks/matting) | `fastforks.matting` | `model(image)` → alpha`[H, W]` in [0, 1] (1 = foreground) | `birefnet` ,`birefnet-lite` ,`ben2` ,`isnet-general-use` ,`u2net` ,`inspyrenet` | \n| [line art / edge maps](https://fastforks.dev/tasks/edges) | `fastforks.edges` | `model(image)` → edges`[H, W]` in [0, 1] (1 = line), ControlNet preprocessors | `lineart` ,`lineart-coarse` | \n| [text recognition (OCR)](https://fastforks.dev/tasks/ocr) | `fastforks.ocr` | `model(image)` → text lines in reading order: quads`[N, 4, 2]` , texts, scores | `ppocrv5-server` ,`ppocrv5-mobile` ,`parseq` | \n| [point tracking](https://fastforks.dev/tasks/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` | \n| [frame interpolation](https://fastforks.dev/tasks/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` | \n| [image retrieval / place recognition](https://fastforks.dev/tasks/retrieval) | `fastforks.retrieval` | `model(image)` → descriptor`[D]` (unit norm);`retrieval.top_k(queries, database)` ,`retrieval.pairs(descriptors)` | `megaloc` | \n| [camera calibration](https://fastforks.dev/tasks/calibration) | `fastforks.calibration` | `model(image)` → intrinsics`[3, 3]` , gravity`[3]` , roll / pitch / vertical FoV (rad) | `geocalib-pinhole` ,`anycalib-pinhole` | \n| [image restoration / upscaling](https://fastforks.dev/tasks/restoration) | `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` | \n| [human pose](https://fastforks.dev/tasks/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` | \n| [3D medical segmentation](https://fastforks.dev/tasks/volume) | `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` | \n| [feature backbones](https://fastforks.dev/tasks/features) | `fastforks.features` | `model(image)` → token features, image embedding | `dinov2-vitb14` ,`dinov3-vitl16` ,`dinov3-convnext-small` | \n\nThe task links go to the model pages, which list every model of the task with its licences, accuracy, speed and\nmemory. Not sure which model to use? The\n[overview](https://fastforks.dev/models) compares them per task and names the\nfastest, the most accurate and the best commercially usable ones.\n\n``` python\nfrom fastforks import stereo\n\nmodel = stereo.load(\"igev-stereo-sceneflow\")  # kernels on a supported NVIDIA GPU or Apple silicon, else portable\nresult = model(\"left.png\", \"right.png\")\nresult.disparity  # [H, W] float32 tensor, pixels\nresult.backend  # which backend ran, on which device\n\ncpu_model = stereo.load(\"igev-stereo-sceneflow\", device=\"cpu\")  # also with a CUDA build of PyTorch\n```\n\nOne line per task (families built on timm, torchvision or transformers need that extra; see the install table below):\n\n``` python\n# needs: pip install \"fastforks-core[torchvision]\"\nfrom fastforks import classification, depth, detection, segmentation\n\ndepth.load(\"depth-anything-v2-s\")(\"room.jpg\").inverse_depth  # [H, W] float32 relative inverse depth\ndetection.load(\"rtdetrv2-s-coco\")(\"street.jpg\", score_threshold=0.5).to_list()  # dicts: box, class_name, score\nclassification.load(\"resnet50.tv2_in1k\")(\"cat.jpg\").top(3)  # [(class name, probability), ...]\nsegmentation.load(\"dinov2-s-linear-ade20k\")(\"street.jpg\").labels  # [H, W] class index per pixel\n```\n\n`mode=\"kernels\"` or `mode=\"portable\"` forces a backend; kernels raises with the reason if it cannot run here instead of\nsilently falling back. `fastforks bench igev-stereo-sceneflow` times both on your machine. For deployment, TensorRT can\nbe faster than kernels for a few models (see [export](https://fastforks.dev/export)).\nThe [usage guide](https://fastforks.dev/usage) has a quickstart per task and covers\nprecision, batches, video, several GPUs, `torch.compile`, ONNX and TensorRT export, and loading your own weights.\n\nInstall PyTorch for your platform first ([pytorch.org](https://pytorch.org/get-started/locally/)); fastforks uses the\nbuild you have, CUDA or CPU-only. Then:\n\n```\npip install fastforks                            # everything: all models + timm, torchvision, transformers, ONNX\npip install \"fastforks[tensorrt]\"                # everything + TensorRT export\n\npip install fastforks-core                       # lean: every model whose code licence is permissive, no extra libraries\npip install \"fastforks-core[nc]\"                 # + models with non-commercial or GPL code (S2M2, FoundationStereo, MonSter, ...)\npip install \"fastforks-core[timm]\"               # libraries some model families are built on\npip install \"fastforks-core[torchvision]\"\npip install \"fastforks-core[transformers]\"\npip install \"fastforks-core[onnx]\"               # ONNX export\npip install \"fastforks-core[tensorrt]\"           # TensorRT export\npip install \"fastforks-core[sfm]\"                # pycolmap: `fastforks sfm --reconstruct` (the COLMAP mapper)\npip install \"fastforks-core[nifti]\"              # nibabel: `fastforks.volume.read_nifti` / `write_nifti`\npip install \"fastforks-core[dicom]\"              # + pydicom: `fastforks.volume.read_dicom`\npip install \"fastforks-core[codes]\"              # tapirscan: `fastforks.ocr.scan_codes` (barcodes, QR / Data Matrix codes)\npip install \"fastforks-core[mlx]\"                # Apple MLX backend (device=\"mlx\", Apple silicon)\npip install \"fastforks-core[libs]\"               # timm, torchvision, transformers and ONNX at once\n```\n\nWithout an extra, every task works except these (`MissingDependencyError` names the extra when one is missing):\n\n| Task | Needs | \n|---|---|\n| classification | `[timm]` (11 models) or`[torchvision]` (15 models) | \n| segmentation | `[transformers]` (SegFormer, Mask2Former, ...); the other 10 models need none | \n| detection | `[torchvision]` for the R-CNN models | \n| volume | `[nifti]` for`read_nifti` /`write_nifti` ,`[dicom]` for`read_dicom` | \n| stereo, depth, features, promptable segmentation, multi-view | none | \n| ONNX / TensorRT export | `[onnx]` /`[tensorrt]` | \n\n`pip install fastforks` pulls a default torch build, which may be CPU-only on your platform. For a CUDA build install torch\nfirst from [pytorch.org](https://pytorch.org/get-started/locally/) (e.g. `pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130`, or `.../whl/cpu` for a CPU-only machine; install `torchvision` from the same index, or the `[torchvision]` extra pulls a mismatched build and `import torchvision` fails); `python -c \"import torch; print(torch.cuda.is_available())\"` should print `True`.\n\nFrom a git checkout (every model, like `fastforks`):\n\n```\nuv pip install -e '.[libs]'                      # or pip install -e '.[libs]'; `pip install .` (no -e) works too\n```\n\n`fastforks` is `fastforks-core[nc,libs]`; both install the same `import fastforks`. For commercial products start from\n`fastforks-core`. Weights with a non-commercial licence (S2M2, FoundationStereo, but also `bridgedepth-sf` with\npermissive code) are never downloaded unless you set `FASTFORKS_NONCOMMERCIAL=1`; `weights=PATH` uses a copy you have.\nA model whose library is missing fails in `load` with the extra to install. Weights and kernels are downloaded on first use\ninto `~/.cache/fastforks` and checked against a recorded SHA-256; `fastforks download MODEL` fetches them ahead of\ntime, and the [Docker guide](https://fastforks.dev/docker) covers offline machines\nand Docker images. Weights you already have are used in place: files in the Hugging Face hub cache (e.g. from\n`hf download`) or in a directory on `FASTFORKS_WEIGHTS_PATH`, or one file passed as `load(..., weights=PATH)`.\nGated weights (e.g. DINOv3): accept the licence on the model's Hugging Face page, log in (`hf auth login`, or\n`huggingface_hub.login()` in Python), and load the model; the download goes through `huggingface_hub`. fastforks never\nhandles your Hugging Face token.\n\nRequirements: 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\ncapability 8.0 or newer (RTX 30 series, A100 and later) and a driver >= 570. So far it is tested only on an\nRTX 5060 Ti: `fastforks env` shows what your GPU would use, and\n[Other GPUs](https://fastforks.dev/other-gpus) explains how to measure it and send\nus the numbers.\n\nThe `fastforks` node pack brings these models to ComfyUI: one node per task with a model dropdown and automatic weight\ndownload, on Windows, Linux and macOS. Install it with ComfyUI-Manager (search for `fastforks`) or with\n\n```\ncomfy node install fastforks\n```\n\nthen restart ComfyUI; example workflows are among its templates. The same models run up to 29x faster than in popular\nnodes, with less VRAM (RTX 5060 Ti: Metric3D v2 normals 29x, Depth Anything V2 6x). Unlike the Python package,\ninstalling the pack allows downloading non-commercial weights (tagged `[non-commercial]`); set\n`FASTFORKS_COMMERCIAL_ONLY=1` to refuse every model not cleared for commercial use. See the\n[nodes and models](https://github.com/kleinicke/fastforks/tree/main/integrations/comfyui) and the\n[node reference](https://github.com/kleinicke/fastforks/blob/main/docs/comfyui.md).\n\nMany models are licensed for non-commercial use only. Each model page lists the code licence, the weights licence,\nthe training data and a commercial-use flag, which is `yes` only if both the code and the weights licence allow\ncommercial use. Each model directory keeps the original licence file, and weights are downloaded from the authors'\nown hosts (a few from a mirror of the same files).\n\n``` python\nimport fastforks\nfrom fastforks import stereo\n\nstereo.list_models(commercial=\"yes\")  # stereo models whose code and weights licences allow commercial use\nprint(fastforks.describe_models(stereo.list_models(\"igev*\")))  # licences, and what blocks a \"yes\"\n```\n\nTraining-data terms (SceneFlow, KITTI, ImageNet, ...) are shown as a note next to the flag; the\n[usage guide](https://fastforks.dev/usage#licences-and-commercial-use) explains how\nthe flag is set. None of this is legal advice.\n\n```\nfastforks list [PATTERN] [--task TASK] [--commercial yes|no|unclear] [--tier stable|experimental|deprecated] [--format text|json|csv]\nfastforks info depth-anything-v2-s                                       # one model in detail\nfastforks download [MODEL ...] [--kernels]                               # fetch weights and kernels ahead of time\nfastforks stereo run LEFT RIGHT --model MODEL --out DIR                  # a stereo model over many pairs (folders or globs)\nfastforks sfm IMAGES OUT [--reconstruct] [--matcher MODEL]               # image folder -> COLMAP database (-> poses + points)\nfastforks bench igev-stereo-sceneflow [--mode auto|portable|kernels] [--size HxW]  # portable and kernels side by side\nfastforks export MODEL --format onnx|trt [--size HxW] [--fp16] [-o FILE]\nfastforks doctor                                                         # which models can run here, and what blocks the others\nfastforks env                                                            # versions, GPU, kernel binaries (for bug reports)\n```\n\n`fastforks COMMAND --help` lists all options.\n\nThe fastforks core, the wrappers and our kernels are Apache-2.0 (LICENSE). Vendored model code keeps its original\nlicence (the `LICENSE*` file in each model directory), and so do our modifications of it.\n\nSee [CONTRIBUTING.md](https://github.com/kleinicke/fastforks/blob/main/CONTRIBUTING.md); the checklist for adding a model\nis there. What changed between releases: [CHANGELOG.md](https://github.com/kleinicke/fastforks/blob/main/CHANGELOG.md).", "url": "https://wpnews.pro/news/show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks", "canonical_source": "https://github.com/kleinicke/fastforks", "published_at": "2026-12-03 16:22:26+00:00", "updated_at": "2026-12-03 16:47:42.691568+00:00", "lang": "en", "topics": ["computer-vision", "ai-infrastructure", "ai-tools", "machine-learning"], "entities": ["Fastforks", "PyTorch", "NVIDIA CUDA", "Apple MPS", "Apple silicon", "MLX", "SAM 2", "DINOv2"], "also_reported_by": [], "takeaway": "Load models by id through fastforks with mode=\"auto\" to get the original network's outputs: the CUDA/Metal kernel backend runs only on NVIDIA sm_80+ or Apple silicon and delivers a median 1.6x speedup over the portable PyTorch path, up to 11x on small classifiers at batch 1.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks", "markdown": "https://wpnews.pro/news/show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks.md", "text": "https://wpnews.pro/news/show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks.txt", "jsonld": "https://wpnews.pro/news/show-hn-3-5x-faster-inference-for-computer-vision-models-fastforks.jsonld"}}