benjipeng commited on
Commit
b679eb0
·
verified ·
1 Parent(s): 0f5fa27

Reorganize layout: put ONNX variants under onnx/ and metadata under metadata/

Browse files
.gitattributes CHANGED
@@ -1,36 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
  *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
  *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz 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
- sharp_ndc_opset18.onnx.data filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.onnx filter=lfs diff=lfs merge=lfs -text
2
+ *.onnx.data filter=lfs diff=lfs merge=lfs -text
 
 
 
 
3
  *.pt filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -2,73 +2,37 @@
2
  library_name: onnxruntime
3
  tags:
4
  - onnx
5
- - apple
6
  - sharp
7
  - view-synthesis
8
  - 3d-gaussian-splatting
9
  base_model: apple/Sharp
10
  ---
11
 
12
- # SHARP (NDC) — ONNX FP32 (opset 18)
13
 
14
- This repository contains an **ONNX FP32** export of Apple's **SHARP** model ("Single-image view synthesis via 3D Gaussians"), exported from the official checkpoint **sharp_2572gikvuh.pt**.
15
 
16
- ## What this ONNX contains (important)
17
- This ONNX exports **only the core predictor network**:
 
18
 
19
- `gaussians_ndc = predictor(image_resized_pt, disparity_factor)`
20
 
21
- It outputs **3D Gaussians in NDC space**.
22
- It does **NOT** include the NDC→metric unprojection step because Apple's unprojection path uses SVD + CPU fp64 conversions, which is not a good fit for ONNX portability.
 
 
23
 
24
- If you want metric-space Gaussians and/or `.ply` export, do that step outside ONNX (e.g., reuse Apple’s `sharp.utils.gaussians.unproject_gaussians` in Python).
25
-
26
- ## Files
27
- - `sharp_ndc_opset18.onnx` (graph)
28
- - `sharp_ndc_opset18.onnx.data` (external weights — required!)
29
- - `export_config.json`, `run_manifest.json`, `parity_metrics.json` for reproducibility
30
-
31
- ## Input contract
32
- **Inputs**
33
- - `image_resized_pt`: float32 tensor of shape **[1, 3, 1536, 1536]**
34
- - RGB
35
- - normalized to **[0, 1]** (divide by 255)
36
- - resized with **bilinear** and **align_corners=True**
37
- - layout **NCHW**
38
- - `disparity_factor`: float32 tensor of shape **[1]**
39
- - computed as: `disparity_factor = f_px / width_original`
40
-
41
- Where:
42
- - `width_original` is the input image width before resizing
43
- - `f_px` is focal length in pixels (Apple code defaults if EXIF is missing)
44
-
45
- **Outputs**
46
- - `mean_vectors`: [1, 1179648, 3]
47
- - `singular_values`: [1, 1179648, 3]
48
- - `quaternions`: [1, 1179648, 4]
49
- - `colors`: [1, 1179648, 3]
50
- - `opacities`: [1, 1179648]
51
-
52
- All outputs are float32.
53
-
54
- ## Minimal ONNX Runtime example
55
-
56
- ```python
57
- import numpy as np
58
- import onnxruntime as ort
59
-
60
- sess = ort.InferenceSession(
61
- "sharp_ndc_opset18.onnx",
62
- providers=["CUDAExecutionProvider", "CPUExecutionProvider"],
63
- )
64
-
65
- # Provide:
66
- # - image_resized_pt as np.float32 [1,3,1536,1536]
67
- # - disparity_factor as np.float32 [1]
68
- outputs = sess.run(
69
- ["mean_vectors","singular_values","quaternions","colors","opacities"],
70
- {"image_resized_pt": image_resized_pt, "disparity_factor": disparity_factor},
71
- )
72
- ```
73
 
 
 
 
74
 
 
 
 
2
  library_name: onnxruntime
3
  tags:
4
  - onnx
 
5
  - sharp
6
  - view-synthesis
7
  - 3d-gaussian-splatting
8
  base_model: apple/Sharp
9
  ---
10
 
11
+ # SHARP (NDC) — ONNX exports (FP32 + INT8)
12
 
13
+ This repo contains ONNX exports of Apples SHARP model **predictor** that outputs **NDC-space 3D Gaussians**.
14
 
15
+ ## What’s included
16
+ - **FP32 (opset18, external data)**: `onnx/fp32/sharp_ndc_opset18.onnx` (+ `.onnx.data`)
17
+ - **INT8 Dynamic (QDQ)**: `onnx/int8_dynamic/sharp_ndc_opset18_int8_dynamic.onnx` (+ optional `.onnx.data`)
18
 
19
+ > **External data note:** if a model has a `.onnx.data` file, it **must** stay in the same folder as its `.onnx`.
20
 
21
+ ## I/O contract (all variants)
22
+ Inputs:
23
+ - `image_resized_pt`: float32 `[1, 3, 1536, 1536]` (NCHW, RGB, normalized to [0,1], resized bilinear with align_corners=True)
24
+ - `disparity_factor`: float32 `[1]` computed as `f_px / width_original`
25
 
26
+ Outputs (float32):
27
+ - `mean_vectors`: `[1, 1179648, 3]`
28
+ - `singular_values`: `[1, 1179648, 3]`
29
+ - `quaternions`: `[1, 1179648, 4]`
30
+ - `colors`: `[1, 1179648, 3]`
31
+ - `opacities`: `[1, 1179648]`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
+ ## Notes
34
+ - These ONNX models output **NDC Gaussians** only. Converting to metric space / writing `.ply` can be done outside ONNX.
35
+ - See `metadata/` for manifests and parity metrics.
36
 
37
+ ## License
38
+ This repository contains model derivatives (ONNX conversions). See `LICENSE`.
examples/onnx_to_ply_cpu.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # TODO: add your CPU-only ONNX->PLY script here
examples/preview_ply_plotly.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # TODO: add your Plotly PLY preview script here
metadata/parity_metrics.json ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "providers": [
3
+ "CUDAExecutionProvider",
4
+ "CPUExecutionProvider"
5
+ ],
6
+ "outputs": {
7
+ "mean_vectors": {
8
+ "shape": [
9
+ 1,
10
+ 1179648,
11
+ 3
12
+ ],
13
+ "dtype": "float32",
14
+ "max_abs": 0.13911914825439453,
15
+ "mean_abs": 0.00018130234093405306,
16
+ "ref_max_abs": 6.372216701507568,
17
+ "nan_out": false,
18
+ "inf_out": false
19
+ },
20
+ "singular_values": {
21
+ "shape": [
22
+ 1,
23
+ 1179648,
24
+ 3
25
+ ],
26
+ "dtype": "float32",
27
+ "max_abs": 0.035487107932567596,
28
+ "mean_abs": 4.6182478399714455e-05,
29
+ "ref_max_abs": 0.07875056564807892,
30
+ "nan_out": false,
31
+ "inf_out": false
32
+ },
33
+ "quaternions": {
34
+ "shape": [
35
+ 1,
36
+ 1179648,
37
+ 4
38
+ ],
39
+ "dtype": "float32",
40
+ "max_abs": 13.2420015335083,
41
+ "mean_abs": 0.008916228078305721,
42
+ "ref_max_abs": 20.611085891723633,
43
+ "nan_out": false,
44
+ "inf_out": false
45
+ },
46
+ "colors": {
47
+ "shape": [
48
+ 1,
49
+ 1179648,
50
+ 3
51
+ ],
52
+ "dtype": "float32",
53
+ "max_abs": 0.06479707360267639,
54
+ "mean_abs": 0.0002580047002993524,
55
+ "ref_max_abs": 0.9927035570144653,
56
+ "nan_out": false,
57
+ "inf_out": false
58
+ },
59
+ "opacities": {
60
+ "shape": [
61
+ 1,
62
+ 1179648
63
+ ],
64
+ "dtype": "float32",
65
+ "max_abs": 0.6220522522926331,
66
+ "mean_abs": 0.008647891692817211,
67
+ "ref_max_abs": 1.0,
68
+ "nan_out": false,
69
+ "inf_out": false
70
+ }
71
+ }
72
+ }
metadata/run_manifest.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "python": "3.12.12 (main, Oct 10 2025, 08:52:57) [GCC 11.4.0]",
3
+ "platform": "Linux-6.6.105+-x86_64-with-glibc2.35",
4
+ "torch": "2.9.0+cu126",
5
+ "torch_cuda": "12.6",
6
+ "cuda_available": true,
7
+ "gpu": "NVIDIA L4",
8
+ "checkpoint_path": "/content/sharp_work/weights/sharp_2572gikvuh.pt",
9
+ "checkpoint_sha256": "94211a75198c47f61fca7d739ba08a215418d8d398d48fddf023baccc24f073d"
10
+ }
metadata/sha256sums.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ cf9fd1ebe78d3effd9f782d053ffbed7f69b033e5260e706c0f216e0bd4675fa LICENSE
2
+ 805ef0cac7c06d877615f80ff86da399f30fb1d73bd3fb6c522605c3400f8eb5 README.md
3
+ 438d4881b4ece849eaea46065aeaa4243a260648a5619b330f31c30b730fbcf4 metadata/parity_metrics.json
4
+ 5613ce0464dfbd2bc0902e2f874a836ea800dc6e2ec1a8e9213d98360e15bab7 metadata/run_manifest.json
5
+ d5e13c449dd15f8538c26566bbbffa10172278b9d5f6e500a27c0c7c837f3d4f onnx/fp32/export_config.json
6
+ 97c7c35a1e5ff1c1d0762556952cfeb5cc0ff3915cd0118b8c1c0359829b59de onnx/fp32/sharp_ndc_opset18.onnx
7
+ 23caa148af9590d4880c47fb69ba1dbd56dde91eab50e2c3d9254ddc1d001604 onnx/fp32/sharp_ndc_opset18.onnx.data
8
+ 9174fe456d17806fc9c37d843f24d928d5a7c11836bd63bc39eef4427ba8b8ca onnx/int8_dynamic/quant_int8_dynamic_config.json
9
+ a4dafd5f2b66caa375c277cce0ee6e9203a729f24edba1a07a9bd3b7cc0cfd88 onnx/int8_dynamic/sharp_ndc_opset18_int8_dynamic.onnx
10
+ 42c516e4c09adb18941cc84ca2459fb8907b4ad3613fc9753d9b77f1b1820432 onnx/int8_dynamic/sharp_ndc_opset18_int8_dynamic.onnx.data
onnx/fp32/export_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "onnx_path": "/content/sharp_work/phase3/onnx/sharp_ndc_opset18.onnx",
3
+ "opset_version": 18,
4
+ "inputs": {
5
+ "image_resized_pt": [
6
+ 1,
7
+ 3,
8
+ 1536,
9
+ 1536
10
+ ],
11
+ "disparity_factor": [
12
+ 1
13
+ ]
14
+ },
15
+ "outputs": [
16
+ "mean_vectors",
17
+ "singular_values",
18
+ "quaternions",
19
+ "colors",
20
+ "opacities"
21
+ ],
22
+ "external_data": true,
23
+ "dynamo": true
24
+ }
onnx/fp32/sharp_ndc_opset18.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97c7c35a1e5ff1c1d0762556952cfeb5cc0ff3915cd0118b8c1c0359829b59de
3
+ size 7279677
onnx/fp32/sharp_ndc_opset18.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23caa148af9590d4880c47fb69ba1dbd56dde91eab50e2c3d9254ddc1d001604
3
+ size 2616066048
onnx/int8_dynamic/quant_int8_dynamic_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source_model": "sharp_ndc_opset18.onnx",
3
+ "output_model": "sharp_ndc_opset18_int8_dynamic.onnx",
4
+ "method": "dynamic",
5
+ "quant_format": "QDQ",
6
+ "weight_type": "QInt8",
7
+ "op_types_to_quantize": [
8
+ "MatMul",
9
+ "Gemm"
10
+ ],
11
+ "onnxruntime_version": "1.23.2"
12
+ }
onnx/int8_dynamic/sharp_ndc_opset18_int8_dynamic.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4dafd5f2b66caa375c277cce0ee6e9203a729f24edba1a07a9bd3b7cc0cfd88
3
+ size 6820060
onnx/int8_dynamic/sharp_ndc_opset18_int8_dynamic.onnx.data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42c516e4c09adb18941cc84ca2459fb8907b4ad3613fc9753d9b77f1b1820432
3
+ size 803940096