ShadeNet-6 XS

Single-image inverse rendering — one RGB photo in, albedo + relative depth + surface normal out, from a model with only 1.99M parameters.

ShadeNet-6 XS outputs on held-out images

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.

TL;DR

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

What it does

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.

Results

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
  • ShadeNet-6 XS is behind on all three maps; the gap is largest on depth (0.186 against 0.169) and albedo, and smallest on normals (0.166 against 0.163).
  • ShadeNet-5 gains much more from its refiner and from test-time averaging than XS does (XS's own output already includes a refiner, and mirror or rotation averaging adds only about 0.001).
  • Speed: one forward pass takes about 19 ms per image on an RTX 5060 Ti. ShadeNet-5's six-pass recipe took about 267 ms per image on the same GPU in the same run; ShadeNet-6 L takes about 39 ms.
  • An earlier draft of this card compared against ShadeNet-5's published 0.1757, measured on a different set of 23 images, and concluded the gap was about 2%. On identical images ShadeNet-5 scores 0.1659, so the gap is 6%. Compare models only on the same images.

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.

Gallery

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.

ski jump in a snow park

ski jump

man on a bench behind a bicycle

bench and bicycle

fairground wheel with spectators

fairground wheel

climber leaping from a boulder

boulder

child in an orange tube slide

tube slide

child hanging upside down from bars

monkey bars

boy swinging on a pole

pole swing

portable toilets and city towers

towers

Training-time preview at the best checkpoint

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.

Architecture (1,992,944 parameters)

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).

Training

  • Data: Flickr8k photos with Marigold-V2 pseudo-labels (albedo, normals, depth), 8,013 training and 23 validation scenes after a quality gate on the normal labels (41 scenes dropped). 448 px, with zoom, small rotation, warp and mirror augmentation (normals are reoriented with the geometry), plus photometric jitter on the photo only.
  • Loss: per-map task losses (masked L1 and gradient matching for albedo; scale-and-shift-aligned depth L1 with gradient matching and a raw-L1 anchor; angular loss for normals) plus a depth-orientation term (see below).
  • Optimiser: AdamW with warm-up and cosine decay, per-part gradient clipping, bf16. The four parts train together in one run with stop-gradients.
  • Phase 1: peak learning rate 1e-3; stopped early at epoch 24 (best epoch 16, mean 0.1794 on the training-time validation).
  • Phase 2: restarted from the phase-1 best with a fresh optimiser and peak learning rate 3e-4 over a 30-epoch cosine; stopped early at epoch 20. Best epoch 12: mean 0.1765 on the training-time validation. This is the released checkpoint. About 4 minutes per epoch on one RTX 5060 Ti (33.5 img/s at batch 16, GPU fully used).
  • No GAN loss in this model (ShadeNet-6 L adds one in its second phase).

What we learned

  • Depth came out inverted until we added an orientation term. The scale-and-shift depth loss and the gradient loss cannot tell a depth map from its inverse. Trained from scratch, the model settled into upside-down depth (correlation -0.86 with the label on every validation image). Adding relu(-scale) fixed it within one epoch (depth error 0.65 to 0.26).
  • Freezing a pretrained trunk needs BatchNorm held in eval mode inside the forward pass. Lightning restores each module's saved mode after its sanity check, which silently put the trunk's BatchNorm back into training mode and let its statistics drift. We enforce eval mode inside the trunk's forward and check that the checkpoint's trunk is bit-identical to ImageNet.
  • The post-refiner did nothing measurable. Over 17 epochs its output matched the main model's to within 0.0002 in every epoch. The convolutional refiner after it added a small, consistent 0.0005 to 0.0015.
  • A lower learning rate helped slightly (best 0.1794 to 0.1765), but the run then plateaued at about 0.179 on the training-time validation.
  • Compare on identical images. Quoting another model's number from a different validation set made the gap look about three times smaller than it is.

Usage

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.

Limitations

  • Does not beat ShadeNet-5: about 6% behind its single pass and 10-12% behind its refined and six-pass results on the same 23 images. Depth and albedo are the weakest maps. If accuracy matters more than size, use ShadeNet-5 or ShadeNet-6 L.
  • Tiny validation set (23 images): the score moves by 0.005 or more between epochs and one run is not a distribution.
  • Pseudo-labels: the labels are model predictions (Marigold-V2), not measurements, so the model inherits their errors.
  • Relative depth only: no metric scale.
  • Fixed input sizes: height and width must be multiples of 32 (and the dense patch parts need multiples of 16).
  • Whole-photo framing and test-time averaging were not evaluated for this model beyond the mirror and six-pass rows above; speed was measured on one GPU only.
  • Not exported: no ONNX, no quantisation.

License & attribution

Code and weights: Apache-2.0.

  • Trunk: MobileNetV3-small, ImageNet weights from torchvision (frozen; BSD-3-Clause code, ImageNet-trained weights).
  • Labels: the albedo, normal and depth training labels are pseudo-labels generated with Marigold V2 (huawei-bayerlab/marigold-v2-0, Apache-2.0; its base model Qwen-Image-Edit-2509 is Apache-2.0 too). They are model outputs, not ground truth.
  • Images: the photographs come from the Flickr8k corpus (Hodosh, Young and Hockenmaier, 2013; Rashtchian et al., 2010). The corpus authors release the captions under CC BY-SA, but the photographs are individual Flickr images owned by their photographers and have no blanket licence. The example images on this card are shown for illustration.
Downloads last month
6
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support