singam96/ShadeNet-5-35M: upload hf_draft
Browse files- .gitattributes +4 -0
- README.md +33 -2
- assets/dict_stats.json +1 -0
- assets/quant_2444741900_5cb3ef3e1d.png +3 -0
- assets/quant_265223843_9ef21e1872.png +3 -0
- assets/quant_3185371756_ff4e9fa8a6.png +3 -0
- assets/quant_3620492762_7f6a9b4746.png +3 -0
- assets/quant_stats.json +81 -0
- onnx/shadenet5_mix_int4_int8.onnx +3 -0
.gitattributes
CHANGED
|
@@ -43,3 +43,7 @@ assets/3620492762_7f6a9b4746_result.png filter=lfs diff=lfs merge=lfs -text
|
|
| 43 |
assets/3672057606_cb6393dbd9_result.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
assets/hero.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
assets/dict_atoms.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
assets/3672057606_cb6393dbd9_result.png filter=lfs diff=lfs merge=lfs -text
|
| 44 |
assets/hero.png filter=lfs diff=lfs merge=lfs -text
|
| 45 |
assets/dict_atoms.png filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
assets/quant_2444741900_5cb3ef3e1d.png filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
assets/quant_265223843_9ef21e1872.png filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
assets/quant_3185371756_ff4e9fa8a6.png filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
assets/quant_3620492762_7f6a9b4746.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -46,7 +46,7 @@ The diagram shows the trainable UNet, its patch dictionaries and the output head
|
|
| 46 |
| Backbone | DINOv2 ViT-S/14, frozen (Meta AI) |
|
| 47 |
| Inference | six forward passes (mirror + rotations of ±4 degrees, averaged) + unit-length normals; the plain single pass is also available |
|
| 48 |
| Input size | 448x448 (multiples of 448 only: 448 or 896) |
|
| 49 |
-
| Framework | PyTorch
|
| 50 |
| License | Apache-2.0 |
|
| 51 |
|
| 52 |
## What it does
|
|
@@ -205,6 +205,37 @@ The sites the pruning step replaced. Each is a single fixed pattern (the chosen
|
|
| 205 |
|
| 206 |

|
| 207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
## Training
|
| 209 |
|
| 210 |
- Data: Flickr8k RGB with Marigold-V2 pseudo-labels for albedo, normal and depth. 8,054 training scenes, 23 held out; no label-quality filtering in this run.
|
|
@@ -217,7 +248,7 @@ The sites the pruning step replaced. Each is a single fixed pattern (the chosen
|
|
| 217 |
|
| 218 |
## Usage
|
| 219 |
|
| 220 |
-
PyTorch
|
| 221 |
|
| 222 |
```bash
|
| 223 |
python infer.py photos/ \
|
|
|
|
| 46 |
| Backbone | DINOv2 ViT-S/14, frozen (Meta AI) |
|
| 47 |
| Inference | six forward passes (mirror + rotations of ±4 degrees, averaged) + unit-length normals; the plain single pass is also available |
|
| 48 |
| Input size | 448x448 (multiples of 448 only: 448 or 896) |
|
| 49 |
+
| Framework | PyTorch; 4/8-bit ONNX exports of the pruned model are described under Quantised ONNX |
|
| 50 |
| License | Apache-2.0 |
|
| 51 |
|
| 52 |
## What it does
|
|
|
|
| 205 |
|
| 206 |

|
| 207 |
|
| 208 |
+
## Quantised ONNX (4 and 8 bit)
|
| 209 |
+
|
| 210 |
+
Weight-only block quantisation of the exported ONNX model: each big weight is stored as int4 or int8 integers with one fp16 scale per block (32 to 128 values) in front of a `DequantizeLinear`, and everything else is fp16. The weights are converted back to floats when the model runs, so this shrinks the file and does not speed anything up (on CPU it is slightly slower). A per-layer sweep found that the dictionary atoms, selectors and convolutions lose almost nothing at 4 bits, and the two MLP layers of every DINOv2 block are the sensitive part, so MIX keeps those at 8 bits.
|
| 211 |
+
|
| 212 |
+
| model | file size | single pass mean L1 | enhanced albedo | enhanced depth | enhanced normal | enhanced mean L1 |
|
| 213 |
+
|---|---|---|---|---|---|---|
|
| 214 |
+
| fp32 ONNX (reference) | 139.4 MB | 0.1764 | 0.1735 | 0.1653 | 0.1497 | **0.1629** |
|
| 215 |
+
| all int4 | 26.7 MB | 0.1900 | 0.1776 | 0.1977 | 0.1546 | **0.1766** |
|
| 216 |
+
| MIX2: ViT fc2 int8, rest int4 | 27.9 MB | 0.1809 | 0.1756 | 0.1774 | 0.1520 | **0.1683** |
|
| 217 |
+
| MIX: ViT fc1/fc2 int8, rest int4 | 31.4 MB | 0.1761 | 0.1729 | 0.1701 | 0.1506 | **0.1645** |
|
| 218 |
+
|
| 219 |
+
L1 on the same 23 held-out images as above; 'enhanced' is the card's recipe (mirror and rotations of 4 degrees, mean, unit normals; 6 forward passes). With so few images, differences below about 0.002 are noise. MIX is +0.0017 from the fp32 model on the mean (depth 0.1701 against 0.1653, the map the quantisation affects most); MIX2 is smaller but loses more depth accuracy, and putting every weight at 4 bits loses more again. The ONNX model takes a 448x448 photo in [-1, 1] (input `input_rgb`) and returns the 7 maps (`maps`) for a single pass; the enhanced recipe is the repository's `tta_average` wrapped around that call (6 passes).
|
| 220 |
+
|
| 221 |
+
### snowy mountain + people: fp32 vs MIX vs MIX2
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
|
| 225 |
+
### person against a wall: fp32 vs MIX vs MIX2
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
|
| 229 |
+
### motocross on dirt: fp32 vs MIX vs MIX2
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
|
| 233 |
+
### paraglider at sunset: fp32 vs MIX vs MIX2
|
| 234 |
+
|
| 235 |
+

|
| 236 |
+
|
| 237 |
+
Rows: fp32, MIX, MIX2, all with the enhanced recipe. The left tile of the lower rows is the mean absolute difference to the fp32 maps, amplified 6x.
|
| 238 |
+
|
| 239 |
## Training
|
| 240 |
|
| 241 |
- Data: Flickr8k RGB with Marigold-V2 pseudo-labels for albedo, normal and depth. 8,054 training scenes, 23 held out; no label-quality filtering in this run.
|
|
|
|
| 248 |
|
| 249 |
## Usage
|
| 250 |
|
| 251 |
+
PyTorch is the reference. The inference script loads the hyper-parameters stored in the checkpoint (including which stages are folded patterns); pass the input size explicitly (448 or 896):
|
| 252 |
|
| 253 |
```bash
|
| 254 |
python infer.py photos/ \
|
assets/dict_stats.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"images": 24, "stats": {"d0": {"atoms": 128, "top1": 0.33941930532455444, "top5": 0.6428115367889404, "conf": 0.5640066038994562}, "d1": {"atoms": 128, "top1": 0.3878333568572998, "top5": 0.8042870163917542, "conf": 0.8885755806553121}, "d2": {"atoms": 128, "top1": 0.5354658365249634, "top5": 1.0, "conf": 0.9996559960501534}, "bottleneck": {"atoms": 128, "top1": 0.19847990572452545, "top5": 0.7459927201271057, "conf": 0.8381744256863991}}, "folded": ["d3", "d4", "in", "u1", "u2", "u3", "u4", "u5", "u6", "out"]}
|
assets/quant_2444741900_5cb3ef3e1d.png
ADDED
|
Git LFS Details
|
assets/quant_265223843_9ef21e1872.png
ADDED
|
Git LFS Details
|
assets/quant_3185371756_ff4e9fa8a6.png
ADDED
|
Git LFS Details
|
assets/quant_3620492762_7f6a9b4746.png
ADDED
|
Git LFS Details
|
assets/quant_stats.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"images": 23,
|
| 3 |
+
"models": {
|
| 4 |
+
"fp32": {
|
| 5 |
+
"desc": "fp32 ONNX (reference)",
|
| 6 |
+
"MB": 139.402128,
|
| 7 |
+
"plain": {
|
| 8 |
+
"albedo": 0.18050309497377146,
|
| 9 |
+
"depth": 0.17566410776065744,
|
| 10 |
+
"normal": 0.17298251163700354,
|
| 11 |
+
"mean": 0.17638323812381082
|
| 12 |
+
},
|
| 13 |
+
"enhanced": {
|
| 14 |
+
"albedo": 0.17353447235148886,
|
| 15 |
+
"depth": 0.16533550749654355,
|
| 16 |
+
"normal": 0.14969052795482718,
|
| 17 |
+
"mean": 0.1628535026009532
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"mix": {
|
| 21 |
+
"desc": "MIX: ViT fc1/fc2 int8, rest int4",
|
| 22 |
+
"MB": 31.397076,
|
| 23 |
+
"plain": {
|
| 24 |
+
"albedo": 0.17826277082381042,
|
| 25 |
+
"depth": 0.17611874931532404,
|
| 26 |
+
"normal": 0.17384552210569382,
|
| 27 |
+
"mean": 0.1760756807482761
|
| 28 |
+
},
|
| 29 |
+
"enhanced": {
|
| 30 |
+
"albedo": 0.1728798455518225,
|
| 31 |
+
"depth": 0.1700732759807421,
|
| 32 |
+
"normal": 0.150636769183304,
|
| 33 |
+
"mean": 0.1645299635719562
|
| 34 |
+
}
|
| 35 |
+
},
|
| 36 |
+
"mix2": {
|
| 37 |
+
"desc": "MIX2: ViT fc2 int8, rest int4",
|
| 38 |
+
"MB": 27.858132,
|
| 39 |
+
"plain": {
|
| 40 |
+
"albedo": 0.18097049062666687,
|
| 41 |
+
"depth": 0.18719368201235068,
|
| 42 |
+
"normal": 0.1746301884236543,
|
| 43 |
+
"mean": 0.18093145368755728
|
| 44 |
+
},
|
| 45 |
+
"enhanced": {
|
| 46 |
+
"albedo": 0.1756145196116489,
|
| 47 |
+
"depth": 0.17740951348905978,
|
| 48 |
+
"normal": 0.15202167986527734,
|
| 49 |
+
"mean": 0.168348570988662
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
"int4": {
|
| 53 |
+
"desc": "all int4",
|
| 54 |
+
"MB": 26.70274,
|
| 55 |
+
"plain": {
|
| 56 |
+
"albedo": 0.1845902515494305,
|
| 57 |
+
"depth": 0.20934964133345563,
|
| 58 |
+
"normal": 0.17613087335358496,
|
| 59 |
+
"mean": 0.19002358874549033
|
| 60 |
+
},
|
| 61 |
+
"enhanced": {
|
| 62 |
+
"albedo": 0.1775529734466387,
|
| 63 |
+
"depth": 0.19765325246945672,
|
| 64 |
+
"normal": 0.15464783103569693,
|
| 65 |
+
"mean": 0.17661801898393079
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"strips": [
|
| 70 |
+
"2444741900_5cb3ef3e1d",
|
| 71 |
+
"3185371756_ff4e9fa8a6",
|
| 72 |
+
"3620492762_7f6a9b4746",
|
| 73 |
+
"265223843_9ef21e1872"
|
| 74 |
+
],
|
| 75 |
+
"names": {
|
| 76 |
+
"2444741900_5cb3ef3e1d": "snowy mountain + people",
|
| 77 |
+
"3185371756_ff4e9fa8a6": "person against a wall",
|
| 78 |
+
"3620492762_7f6a9b4746": "motocross on dirt",
|
| 79 |
+
"265223843_9ef21e1872": "paraglider at sunset"
|
| 80 |
+
}
|
| 81 |
+
}
|
onnx/shadenet5_mix_int4_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fc5356d1280aca64ba8d248ae1d11dd8150e1b557604ea2e56931d239552641
|
| 3 |
+
size 31397076
|