Single-image inverse rendering — one RGB photo in, albedo + relative depth + surface normal out, from a model with only 1.99M parameters.
A feed-forward network built from four small parts: a dense patch network that gives a coarse first guess, a frozen ImageNet MobileNetV3-small backbone with a thin depthwise-separable decoder, a second dense patch network, and a tiny refiner. One forward pass, about 19 ms per image on an RTX 5060 Ti. It is not as accurate as ShadeNet-5: on the same 23 held-out images its mean error is about 6% higher than ShadeNet-5's single pass (and 10-12% higher than ShadeNet-5's refined and six-pass results), at 1/17 of the size. Its larger sibling, ShadeNet-6 L, is clearly better than ShadeNet-5.
Hero: the first six validation images, in dataset order, not picked. Each panel: input | albedo / depth | normal.
| Task | Single-image inverse rendering (intrinsic decomposition) |
| Output | 7ch — albedo (3) + relative depth (1) + normal (3) |
| Params | 1.99M total (1.12M trainable; the 0.87M MobileNetV3-small trunk stays on its ImageNet weights) |
| Backbone | MobileNetV3-small (torchvision ImageNet weights), frozen |
| Inference | one forward pass (about 19 ms per 448x448 image on an RTX 5060 Ti) |
| Input size | multiples of 32 (448 was used in training); inference/run.py keeps the whole photo |
| Framework | PyTorch (+ torchvision for the MobileNet definition); standalone inference code in inference/ |
| License | Apache-2.0 |
Given a single RGB image it predicts three intrinsic maps: albedo (base colour), relative depth (grayscale, per-image) and a surface normal map. Output channels are [0:3]=albedo, [3:4]=depth, [4:7]=normal, all in [-1, 1]; depth is relative (larger = farther), normals are x right, y up, z toward the viewer.
Same output convention as ShadeNet-5: 7 channels, no shading channel. A new, much smaller architecture trained from scratch.
Mean per-map L1 against the labels on the same 23 held-out images, run through all models in one script (lower is better; albedo and normal are scored on labelled pixels only, depth on all pixels; unit-length normals in the "+unit" rows). ShadeNet-5 numbers are measured here on the same images, not copied from its card (its card's 0.1757 is on a different set of 23 images).
| Model and recipe | Parameters | Albedo | Depth | Normal | Mean |
|---|---|---|---|---|---|
| ShadeNet-5, single pass + unit normals | 34.65M | 0.166 | 0.169 | 0.163 | 0.1659 |
| ShadeNet-5 + its refiner | 34.65M + 0.91M | 0.160 | 0.168 | 0.151 | 0.1597 |
| ShadeNet-5, six passes (mirror + rotations ±4°) | 34.65M | 0.158 | 0.162 | 0.150 | 0.1562 |
| ShadeNet-6 XS, single pass + unit normals | 1.99M | 0.176 | 0.186 | 0.166 | 0.1759 |
| ShadeNet-6 XS, mirror average | 1.99M | 0.174 | 0.185 | 0.165 | 0.1746 |
| ShadeNet-6 XS, six passes | 1.99M | 0.174 | 0.187 | 0.165 | 0.1751 |
| ShadeNet-6 L, single pass + unit normals | 98.35M | 0.123 | 0.124 | 0.122 | 0.1232 |
Paired per-image difference in mean L1 (ShadeNet-6 XS minus ShadeNet-5; positive = XS is worse):
| Comparison | Difference | XS better on |
|---|---|---|
| single pass vs single pass | +0.0100 ± 0.0041 | 8 of 23 images |
| single pass vs ShadeNet-5 + refiner | +0.0162 ± 0.0038 | 3 of 23 |
| six passes vs ShadeNet-5 six passes | +0.0189 ± 0.0042 | 4 of 23 |
The validation set is 23 images, and the labels are Marigold-V2 pseudo-labels, not measurements. The paired difference (+0.010 ± 0.004) is about 2.4 standard errors, so treat the ranking as indicative.
Held-out images (none was used for training), single forward pass, unit-length normals. These are the first eight of the 23 validation images in dataset order, not selected for how they look. Each panel: input | albedo / depth | normal.
Four validation photos at the best checkpoint, as the training preview showed them. Columns: photo, then albedo | depth | normal for the pre-refiner, the main model, the post-refiner, the refined result (the final output) and the label.
Four networks in a row; a stop-gradient sits between each pair, so every part is trained on its own loss.
| # | Part | Parameters | What it does |
|---|---|---|---|
| 1 | Pre-refiner | 362,624 | A dense (fully connected) network applied to every 16x16 patch of the photo with shared weights: 768 numbers in, 1,792 out (a 16x16x7 patch of maps). Gives a coarse first guess. |
| 2 | Main model | 1,213,433 | A frozen, ImageNet-pretrained MobileNetV3-small trunk (870,560, taps at strides 2/4/8/16/32), a thin depthwise-separable decoder with a global-context block, and one patch dictionary (33,138) at its input. Takes the photo plus the pre-refiner's maps; outputs those maps plus a learned residual. |
| 3 | Post-refiner | 188,512 | A second dense patch network (one aligned 16x16 grid) on the main model's maps plus the photo's luminance. |
| 4 | Refiner | 228,375 | A small 4-level convolutional UNet that cleans the result and sees across patch borders. The final output. |
Trainable parameters: 1,122,384 (the trunk stays on its factory ImageNet weights). Maps are in [-1, 1]: channels 0-3 albedo, 3 depth, 4-7 normal. Height and width must be multiples of 32 (the dense patch parts need multiples of 16).
relu(-scale) fixed it within one epoch (depth error 0.65 to 0.26).The inference code is in the inference/ folder of this repository and needs no training code: a single file that rebuilds the network from the checkpoint (verified to give bit-identical outputs to the training code).
pip install torch torchvision pillow numpy
python inference/run.py photos/ --checkpoint checkpoints/shadenet6-xs.ckpt --out out/
Each photo becomes a panel image: input, albedo, depth, normal, at the photo's own shape (the long side is scaled to 448, the rest of the square is filled by mirroring the photo's edge, and the padding is cut off the maps; --framing crop takes the centre square, which is what the model was trained on, and --mirror averages the prediction with the mirrored-photo prediction). The whole-photo framing was not evaluated for this model: the numbers above use square crops.
From Python:
import torch
from inference.shadenet6 import ShadeNet6
model = ShadeNet6.from_checkpoint("checkpoints/shadenet6-xs.ckpt", device="cpu")
photo = ... # float32 [1, 3, 448, 448] in [-1, 1]
maps = model.predict(photo) # [1, 7, 448, 448] in [-1, 1]
albedo, depth, normal = maps[:, 0:3], maps[:, 3:4], maps[:, 4:7]
The checkpoint (8 MB, fp32, inference only) carries the MobileNetV3 weights, so nothing is downloaded. config.json lists the architecture, the input and output convention and the validation numbers. There is no ONNX export yet.
Code and weights: Apache-2.0.