|
Download README.md from fastforks/cfnet: direct link, hf CLI and curl.
- Browser
- Download file 5.53 kB
-
https://huggingface.co/fastforks/cfnet/resolve/main/README.md
- Command line
-
hf download hf://fastforks/cfnet/README.md
-
curl -L -o README.md https://huggingface.co/fastforks/cfnet/resolve/main/README.md
5.53 kB
| library_name: "fastforks" | |
| pipeline_tag: "depth-estimation" | |
| license: "other" | |
| license_name: "mit-code-weights-unstated" | |
| license_link: "https://github.com/gallenszl/CFNet/blob/982230dd360583fc35743d0b7ed528982fe5fd38/README.md#L72" | |
| tags: | |
| - "stereo" | |
| - "stereo-matching" | |
| - "disparity" | |
| - "cuda" | |
| - "pytorch" | |
| - "fastforks" | |
| # CFNet (fastforks) | |
| CFNet (Shen et al. 2021): cascade and fused cost volumes (fused 1/8-1/32 3-D volumes), then two refinement stages that adapt to the uncertainty of the disparity (max disparity 192). | |
| 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/gallenszl/CFNet> at `982230dd3605`. | |
| Task: stereo. Tier: experimental. Outputs: `disparity`. Backends: `portable`, `kernels`. | |
| Input: a rectified left / right image pair. Output: a disparity map (pixels, left view). | |
| ## Variants | |
| Weights are the authors' files (not hosted here). SHA-256 shortened to 12 hex digits; the full hashes are in [`card.toml`](https://github.com/kleinicke/fastforks/blob/main/src/fastforks/stereo/models/cfnet/card.toml). | |
| | variant | weights (author link) | SHA-256 | weights licence | commercial use | | |
| |---|---|---|---|---| | |
| | `cfnet-sceneflow@1` | [sceneflow_pretraining.ckpt](https://drive.usercontent.google.com/download?export=download&confirm=t&id=1gFNUc4cOCFXbGv6kkjjcPw2cJWmodypv) | `07ea542501a7` | MIT (assumed from code) | yes | | |
| ## Licence | |
| Original-code strings, recorded as they are (research-use package; check them before any other use). Code: MIT. Files: `LICENSE`. | |
| Code licence: MIT; the authors do not state a separate weights licence. | |
| Training data: Freiburg SceneFlow (FlyingThings3D, Driving, Monkaa). | |
| Licence evidence: <https://github.com/gallenszl/CFNet/blob/982230dd360583fc35743d0b7ed528982fe5fd38/README.md#L72> | |
| ## Input size | |
| any H x W >= 64, padded to a multiple of 64 | |
| Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `cfnet-sceneflow` 1988x2880 (8.2 GiB peak allocated, 11.5 reserved) | |
| ## Speed and memory | |
| ### Stereo, Middlebury 2014 half, 994x1482 | |
| | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | `cfnet-sceneflow` | 659.5 | – | 484.31 | 400.67 | – | 1.2x | – | 3441 / 4376 | 3662 / 4718 | | |
| ### Startup and first call | |
| | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | |
| | --- | --- | --- | --- | --- | --- | --- | | |
| | `cfnet-sceneflow` | 0.39 (375x1242) | 0.94 | 0.21† | 0.24 (375x1242) | 0.48† | 0.40† | | |
| ### torch.compile and TensorRT | |
| | model | input | portable ms | compile ms | compile s (cold) | TensorRT fp16 ms | ONNX + build s | kernels ms | peak MiB (alloc / reserved): portable | compile | TensorRT (device) | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | `cfnet-sceneflow` | 994x1482 | 484.31 | 249.2 | 53.0 | 170.9 | 139 | 400.67 | 3441 / 4376 | 1026 / 1398 | 1238 | | |
| ### Fixed-size speed and peak memory, all models | |
| | model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 | | |
| | --- | --- | --- | --- | --- | --- | | |
| | `cfnet-sceneflow` | portable | 73.6 ms / 1070 / 1588 | 284.0 ms / 2640 / 4342 | 758.8 ms / 4508 / 5956 | OOM | | |
| | `cfnet-sceneflow` | kernels | 59.3 ms / 1118 / 1618 | 229.9 ms / 2778 / 4362 | 634.1 ms / 4801 / 5976 | OOM | | |
| ### Apple silicon (MPS) | |
| | model | `portable` | `kernels` | speed-up | | |
| | --- | --- | --- | --- | | |
| | `cfnet-sceneflow` | 2228 ms / 5463 MiB (float16) | 758 ms / 2931 MiB | 2.94x | | |
| Fixed-size cells: time (ms) / peak allocated / peak reserved memory (MiB). | |
| Hardware, protocol and caveats: [benchmarks](https://github.com/kleinicke/fastforks/blob/main/docs/benchmarks.md) (RTX 5060 Ti 16 GB, sm_120). Original = the authors' code 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 | |
| ### Parity with the original code | |
| Every variant is checked against golden 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.05 px and p99 <= 0.5 px. | |
| ## Usage | |
| ```python | |
| from fastforks import stereo | |
| model = stereo.load("cfnet-sceneflow") # mode="auto": the preferred backend from recorded measurements | |
| result = model("left.png", "right.png") | |
| result.disparity # [H, W] float32 tensor, 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: `cfnet-sceneflow`. | |
| ## Kernels backend | |
| `stereo.load("cfnet-sceneflow", mode="kernels")` runs our CUDA kernels (`igev`, `cutlass_conv`, `cudnn_hacc`). 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. | |
| <!-- staged from fastforks 03e6fdbc (2026-11-05) --> | |