Instructions to use WeReCooking/sapiens2-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sapiens2
How to use WeReCooking/sapiens2-onnx with sapiens2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Initial commit
Browse files- .gitattributes +15 -0
- README.md +57 -0
- normal/normal_0.4b_fp32.onnx +3 -0
- normal/normal_0.4b_fp32.onnx.data +3 -0
- normal/normal_0.8b_fp32.onnx +3 -0
- normal/normal_0.8b_fp32.onnx.data +3 -0
- normal/normal_1b_fp32.onnx +3 -0
- normal/normal_1b_fp32.onnx.data +3 -0
- normal/normal_5b_int8.onnx +3 -0
- normal/normal_5b_int8.onnx.data +3 -0
- pointmap/pointmap_0.4b_fp32.onnx +3 -0
- pointmap/pointmap_0.4b_fp32.onnx.data +3 -0
- pointmap/pointmap_0.8b_fp32.onnx +3 -0
- pointmap/pointmap_0.8b_fp32.onnx.data +3 -0
- pointmap/pointmap_1b_fp32.onnx +3 -0
- pointmap/pointmap_1b_fp32.onnx.data +3 -0
- pointmap/pointmap_5b_int8.onnx +3 -0
- pointmap/pointmap_5b_int8.onnx.data +3 -0
- pose/pose_0.4b_fp32.onnx +3 -0
- pose/pose_0.4b_fp32.onnx.data +3 -0
- pose/pose_0.8b_fp32.onnx +3 -0
- pose/pose_0.8b_fp32.onnx.data +3 -0
- pose/pose_1b_fp32.onnx +3 -0
- pose/pose_1b_fp32.onnx.data +3 -0
- seg/seg_0.4b_fp16.onnx +3 -0
- seg/seg_0.4b_fp16.onnx.data +3 -0
- seg/seg_0.8b_fp32.onnx +3 -0
- seg/seg_0.8b_fp32.onnx.data +3 -0
- seg/seg_1b_fp32.onnx +3 -0
- seg/seg_1b_fp32.onnx.data +3 -0
- seg/seg_5b_int8.onnx +3 -0
- seg/seg_5b_int8.onnx.data +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,18 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
seg/seg_0.4b_fp16.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
seg/seg_0.8b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
seg/seg_1b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
seg/seg_5b_int8.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
normal/normal_0.4b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
normal/normal_0.8b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
normal/normal_1b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
normal/normal_5b_int8.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
pointmap/pointmap_0.4b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
pointmap/pointmap_0.8b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
pointmap/pointmap_1b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
pointmap/pointmap_5b_int8.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
pose/pose_0.4b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
pose/pose_0.8b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
pose/pose_1b_fp32.onnx.data filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
tags:
|
| 4 |
+
- onnx
|
| 5 |
+
- sapiens2
|
| 6 |
+
- cpu
|
| 7 |
+
- segmentation
|
| 8 |
+
- pose-estimation
|
| 9 |
+
- normal-estimation
|
| 10 |
+
- depth-estimation
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Sapiens2 ONNX
|
| 14 |
+
|
| 15 |
+
CPU-friendly ONNX exports of Meta's `facebook/sapiens2-*`. 15 task heads across 4 tasks and 4 sizes.
|
| 16 |
+
|
| 17 |
+
## Folder layout
|
| 18 |
+
|
| 19 |
+
Each task has its own folder. Each model is split into a small `.onnx` graph file plus a `.onnx.data` external sidecar (both must live in the same directory at download time).
|
| 20 |
+
|
| 21 |
+
| Task | 0.4b | 0.8b | 1b | 5b |
|
| 22 |
+
|---|---|---|---|---|
|
| 23 |
+
| seg | `seg/seg_0.4b_fp16.onnx` (777 MB, fp16) | `seg/seg_0.8b_fp32.onnx` (3.3 GB) | `seg/seg_1b_fp32.onnx` (5.9 GB) | `seg/seg_5b_int8.onnx` (5.2 GB) |
|
| 24 |
+
| normal | `normal/normal_0.4b_fp32.onnx` (1.7 GB) | `normal/normal_0.8b_fp32.onnx` (3.5 GB) | `normal/normal_1b_fp32.onnx` (6.2 GB) | `normal/normal_5b_int8.onnx` (6.1 GB) |
|
| 25 |
+
| pointmap | `pointmap/pointmap_0.4b_fp32.onnx` (2.0 GB) | `pointmap/pointmap_0.8b_fp32.onnx` (3.9 GB) | `pointmap/pointmap_1b_fp32.onnx` (6.5 GB) | `pointmap/pointmap_5b_int8.onnx` (6.2 GB) |
|
| 26 |
+
| pose | `pose/pose_0.4b_fp32.onnx` (1.6 GB) | `pose/pose_0.8b_fp32.onnx` (3.4 GB) | `pose/pose_1b_fp32.onnx` (6.1 GB) | not shipped |
|
| 27 |
+
|
| 28 |
+
Cosine similarity vs the PyTorch reference is 0.999 or better on every shipped file.
|
| 29 |
+
|
| 30 |
+
## Precision notes
|
| 31 |
+
|
| 32 |
+
* seg-0.4b is fp16 (50 percent smaller than fp32 and verified cos 0.99999)
|
| 33 |
+
* 0.4b/0.8b/1b for normal, pointmap, pose are fp32. Naive fp16 cast produces NaN (normal L2-normalize divides near zero) or cos around 0.7 (pointmap metric scale, pose sigmoid heatmaps saturate)
|
| 34 |
+
* 5B variants are INT8 (per-channel symmetric, MatMulIntegerToFloat)
|
| 35 |
+
* pose-5b is not shipped (the int8 quantize attempt did not complete on the available hardware)
|
| 36 |
+
|
| 37 |
+
## Inference
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
import numpy as np
|
| 41 |
+
import onnxruntime as ort
|
| 42 |
+
from huggingface_hub import hf_hub_download
|
| 43 |
+
|
| 44 |
+
# Download both the .onnx graph and the .onnx.data sidecar side by side
|
| 45 |
+
for fn in ("seg/seg_0.4b_fp16.onnx", "seg/seg_0.4b_fp16.onnx.data"):
|
| 46 |
+
hf_hub_download(repo_id="WeReCooking/sapiens2-onnx", filename=fn, local_dir=".")
|
| 47 |
+
|
| 48 |
+
sess = ort.InferenceSession("seg/seg_0.4b_fp16.onnx", providers=["CPUExecutionProvider"])
|
| 49 |
+
# Input expects (N, 3, 1024, 768) fp32 BGR mean-subtracted preprocessed tensor
|
| 50 |
+
out = sess.run(None, {"input": preprocessed})
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
For a standalone CLI without sapiens2 or PyTorch, see `app.py onnx ...` in the source Space `WeReCooking/sapiens2-cpu`.
|
| 54 |
+
|
| 55 |
+
## License
|
| 56 |
+
|
| 57 |
+
Same as upstream `facebook/sapiens2-*`.
|
normal/normal_0.4b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a6a98218a68ad85c9f3bee5ab193e4cbc34d82c3ee963399479c8fd52a293fa0
|
| 3 |
+
size 3764421
|
normal/normal_0.4b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e786a5caba89d7df98bafa02980c1b2622e2e4f94ccaa6aae2c955ed7b8ce08b
|
| 3 |
+
size 1813839872
|
normal/normal_0.8b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04fbfdd8d825ced3bed76e65b4fd060e7badaf1793f409bbceed6b307b8a689b
|
| 3 |
+
size 5062864
|
normal/normal_0.8b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8864316fffbaefcf406bf0c79c5b5677de2fa1a8c309b1e64cf65b4d35a97b3
|
| 3 |
+
size 3538878464
|
normal/normal_1b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b05e410dcbc6ac005043e543b80708c903cd5eecd23573f9a12f39b84487126
|
| 3 |
+
size 6384132
|
normal/normal_1b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71f857f5b5fcb4ec417eff0709e7b282412402412cc8726b391dac2f4669464e
|
| 3 |
+
size 6157762560
|
normal/normal_5b_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:225dd119e0619ebc3b218dca6d7a54320e5ef02caefc8b84bfe408d068c6c599
|
| 3 |
+
size 16435117
|
normal/normal_5b_int8.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d7185b19b7b6121cd5a5f81bd21826a442bb7eae3ee126404a434edd761ed8a
|
| 3 |
+
size 6077154301
|
pointmap/pointmap_0.4b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:edd61f29cec8b9b6357056d0c93bad09376ead463466c3ef99c18bb263ccd6c8
|
| 3 |
+
size 3829289
|
pointmap/pointmap_0.4b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b09043fb2d65a6ff00849badd543627660476bf68e771e082f02c9dc13d6d4f2
|
| 3 |
+
size 2115174400
|
pointmap/pointmap_0.8b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9141804c5d560847a82cc52dad1a5793a68659869b2f01f78cd7dafa6152e7ca
|
| 3 |
+
size 5135100
|
pointmap/pointmap_0.8b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e1fe86174568e7b1deecc75a247ec0239a0a59d2fb0585be74a0b800981f6fd
|
| 3 |
+
size 3870031872
|
pointmap/pointmap_1b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a2c1323d7d6bfee2917555514f18abceee3e3405963f421530e9472a518481a3
|
| 3 |
+
size 6463539
|
pointmap/pointmap_1b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:df9c4313af95dcf3c0f6b754549cedc30d4aa917cad45adbdd7cc3716085fb0e
|
| 3 |
+
size 6518800384
|
pointmap/pointmap_5b_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8991b83b92e8e84a5f3b88722b3d3bfe2419f300a95ea1a5c2a5b9a5398ac7f
|
| 3 |
+
size 16521512
|
pointmap/pointmap_5b_int8.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ec675354c3a018cc491872e6b3fffaf0971796ee88666ee962a2b465a70d8ae
|
| 3 |
+
size 6195479548
|
pose/pose_0.4b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a995a2c503d41d3323b9e6f2218197bad9a2b51533f90e511ca551c185fc361b
|
| 3 |
+
size 3771752
|
pose/pose_0.4b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1d45dc8db765a2a8dc04a1e6b5f288be103da9ec99ad404d55c9d0ae57d33be
|
| 3 |
+
size 1703149568
|
pose/pose_0.8b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4ab377312ef6973dd92e1330ba48dadb49950b46520450d7173ff7f490e28e6a
|
| 3 |
+
size 5087421
|
pose/pose_0.8b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6c829320ce456925e371afc8938a794dfc8f7ae95f67e99a1e0d5ac2e4062bae
|
| 3 |
+
size 3395354624
|
pose/pose_1b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:273c7606612ee269a38fc4b33f0b04c0e665883edcf1762fa676f0ebd681b113
|
| 3 |
+
size 6426602
|
pose/pose_1b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:caf5e3fd7b01a74a3ad4005c9e0aad0bb4918727a9cb7dceb6ab9bb76f85bc99
|
| 3 |
+
size 6079578112
|
seg/seg_0.4b_fp16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b2cf9f8076e42c6994383a974b37ce866bfbd055432004981d292bc2e6b4ca19
|
| 3 |
+
size 3765586
|
seg/seg_0.4b_fp16.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9845fe46d00ec728765d45775c42a44d55d8f8943c07772f470043498b0a7560
|
| 3 |
+
size 813395582
|
seg/seg_0.8b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6674eed65c8350cddd0ede3ff1f0a604c935586bd2bbba5ea8f81bfa3f9b61be
|
| 3 |
+
size 4986578
|
seg/seg_0.8b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab2154cd824b1c905f030467577c8e11ece1f8385c27512fefa81c9beeb81716
|
| 3 |
+
size 3310682112
|
seg/seg_1b_fp32.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25c3dda389316b87ac9e1a80254af337155bc3e0d7e9af74393d9c392bc77db2
|
| 3 |
+
size 6297140
|
seg/seg_1b_fp32.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:63e267ab8bd7631abe3c227e6d4bb2d8902902f591124836777b7d16434f62db
|
| 3 |
+
size 5883691008
|
seg/seg_5b_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:366c320c66574795baa4e56c77463aa6753da7c92180a4789254a9b4e9634db9
|
| 3 |
+
size 16526759
|
seg/seg_5b_int8.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:623f89266c2d563f31e9f47d75ff804b905686c1c947d26a8e77e34bebf059ce
|
| 3 |
+
size 5170038526
|