|
Download README.md from fastforks/patchmatchnet: direct link, hf CLI and curl.
- Browser
- Download file 6.26 kB
-
https://huggingface.co/fastforks/patchmatchnet/resolve/main/README.md
- Command line
-
hf download hf://fastforks/patchmatchnet/README.md
-
curl -L -o README.md https://huggingface.co/fastforks/patchmatchnet/resolve/main/README.md
6.26 kB
| library_name: "fastforks" | |
| pipeline_tag: "image-to-3d" | |
| license: "other" | |
| license_name: "mit-code-weights-unstated" | |
| license_link: "https://github.com/FangjinhuaWang/PatchmatchNet/blob/8dc6cb4/LICENSE" | |
| tags: | |
| - "multiview" | |
| - "multi-view-stereo" | |
| - "3d-reconstruction" | |
| - "camera-pose-estimation" | |
| - "cuda" | |
| - "pytorch" | |
| - "fastforks" | |
| # PatchmatchNet (fastforks) | |
| PatchmatchNet (Wang et al. 2021): learned PatchMatch multi-view stereo, the depth of a reference view from posed, calibrated source views and a depth search range. Three coarse-to-fine PatchMatch stages (random initialisation, adaptive propagation, group-wise correlation with pixel-wise view weights, adaptive spatial cost aggregation) on FPN features, then a depth refinement net at full resolution. | |
| 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/FangjinhuaWang/PatchmatchNet> at `8dc6cb4`. | |
| Task: multiview. Tier: experimental. Outputs: `depth`, `confidence`. Backends: `portable`, `kernels`. | |
| Input: several images of one scene (posed and calibrated for multi-view stereo, unposed otherwise). Output: depth maps and, where the model predicts them, cameras and 3-D points. | |
| ## 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/multiview/models/patchmatchnet/card.toml). | |
| | variant | weights (author link) | SHA-256 | weights licence | commercial use | | |
| |---|---|---|---|---| | |
| | `patchmatchnet@1` | [params_000007.ckpt](https://github.com/FangjinhuaWang/PatchmatchNet/raw/8dc6cb40bdb7053e856598b378425c76a9dcf5e0/checkpoints/params_000007.ckpt) | `477b056c6235` | 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: DTU Robot Image Data Sets (MVS 2014) (The released checkpoint (checkpoints/params_000007.ckpt) is trained on DTU (README); the paper evaluates it zero-shot on Tanks and Temples and ETH3D). | |
| - Licence note: The code is MIT; the checkpoint ships in the repository without a licence of its own (MIT assumed) and is trained on DTU, whose terms of use are not stated. | |
| Licence evidence: https://github.com/FangjinhuaWang/PatchmatchNet/blob/8dc6cb4/LICENSE and README.md (the checkpoint ships in the repository) | |
| ## Input size | |
| any H x W >= 5, resized or padded inside the model | |
| Tested up to (portable, fp16, RTX 5060 Ti 16 GB): `patchmatchnet` 1988x2880 (7.9 GiB peak allocated, 9.4 reserved) | |
| ## Speed and memory | |
| ### Multiview, synthetic, 1536x1024 | |
| | model | time (ms): original fp32 | original | portable | kernels | kernels speed-up: vs original | vs portable | peak memory (MiB, allocated / reserved): original | portable | kernels | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | `patchmatchnet` | 248.06 | 219.74 | 201.66 | 29.57 | 7.4x | 6.8x | 1228 / 1272 | 1806 / 2096 | 740 / 856 | | |
| ### Startup and first call | |
| | model | load (s): original | portable | kernels | first call (s): original | portable | kernels | | |
| | --- | --- | --- | --- | --- | --- | --- | | |
| | `patchmatchnet` | 0.04 (1536x1024) | 0.06 (1536x1024) | 0.05† (1536x1024) | 0.92 (1536x1024) | 0.25 (1536x1024) | 0.04 (1536x1024) | | |
| ### 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) | | |
| | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | |
| | `patchmatchnet` | 1536x1024 | 201.66 | 175.0 | 29.4 | 28.2 | 54 | 29.57 | 1806 / 2096 | 1798 / 1888 | 790 | | |
| ### Fixed-size speed and peak memory, all models | |
| | model | mode | 640x480 | 1280x720 | 1920x1080 | 12 MP 4000x3000 | | |
| | --- | --- | --- | --- | --- | --- | | |
| | `patchmatchnet` | portable | 43.1 ms / 439 / 522 | 154.4 ms / 1242 / 1534 | 408.6 ms / 2753 / 3346 | OOM | | |
| | `patchmatchnet` | kernels | 9.2 ms / 253 / 328 | 24.4 ms / 693 / 942 | 56.7 ms / 1520 / 2016 | 378.6 ms / 8628 / 11332 | | |
| 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.5 % and p99 <= 3 % of the reference's median |value| (absolute error of the output `depth`). | |
| ## Usage | |
| ```python | |
| from fastforks import multiview | |
| model = multiview.load("patchmatchnet") # mode="auto": the preferred backend from recorded measurements | |
| result = model(["ref.jpg", "src1.jpg", "src2.jpg"], intrinsics=K, cam_to_world=c2w, depth_range=(0.5, 5.0)) | |
| result.depth # [1, H, W] float32 tensor; views[0] = reference, K [N, 3, 3] pixels, c2w [N, 4, 4] OpenCV | |
| 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: `patchmatchnet`. | |
| ## Kernels backend | |
| `multiview.load("patchmatchnet", mode="kernels")` runs our CUDA kernels (`patchmatchnet`). 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 7204e33f (2026-11-05) --> | |