Work 05 / 18
Straightening tilted property photos
A model that reads how many degrees a property photo is tilted, so it can be turned level before it is published. Version 0.3.0 has a mean error of 0.557° on about 98,000 validation images, and the gain over the version before it came from data alone.

Tilted 6°Turned back 6.1°I tilted it by 6° and the model read 6.1°. Tilted by −6° it read −7.8°, and untouched it read −0.2°.

Tilted 6°Turned back 7.3°I tilted it by 6° and the model read 7.3°. Tilted by −6° it read −6.9°, and untouched it read 1.3°.

Tilted 6°Turned back 8.2°I tilted it by 6° and the model read 8.2°. Tilted by −6° it read −6.3°, and untouched it read 2.6°.

Tilted 6°Turned back 4.3°I tilted it by 6° and the model read 4.3°. Tilted by −6° it read −9.5°, and untouched it read −1.5°.
Photos: Interior, Duncan House, Polymath Park, Acme,… by w_lemay, CC BY-SA 2.0; Camp-Schweller House, Main Street, Wellingto… by w_lemay, CC BY-SA 2.0; Interior, Duncan House, Polymath Park, Acme,… by w_lemay, CC BY-SA 2.0; Sustainable Kitchen - Flickr - Jeremy Levine… by Jeremy Levine from Los Angeles, United States, CC BY 2.0. What I changed.
- Validation mean error
- 0.684° → 0.557°
- v0.2.0 on about 40k images, v0.3.0 on about 98k
- What changed
- the data
- Same architecture, code and configuration
- Range
- ±25°
- 500 angle classes
- Hand-labelled angles
- none
- Labels from retouched pairs and known rotations
How it works
A DINOv3 ViT-B/16 backbone reads the photo and a classifier picks one of 500 angle classes between −25° and +25°. The classes are trained with a circular smooth label, so a prediction one class off costs less than one ten classes off. The model before it was a RegNet CNN with 720 classes of 0.5° each.
Where the labels came from
Nobody labelled an angle by hand. The client had raw photos and the retoucher’s levelled versions of the same photos, so I matched each pair with SIFT features and a homography and read the rotation out of it. I then took photos verified as upright and rotated them by known amounts. That gave about 49,000 interior and 49,000 exterior images.
Results
On the validation set, version 0.3.0 has a mean error of 0.557° against 0.684° for version 0.2.0. That is 18.6% better with the same architecture, code and configuration; the difference is about 98,000 training images instead of about 40,000. Training ran for 100 epochs on four T4 GPUs.
On a 10-image manual set the mean errors were 1.60° and 1.90°, and 90% against 100% of photos were within 5°. Ten images cannot separate the two models, so I do not use that set to rank them.
Limits
The sub-degree figure is measured on validation data made the same way as the training data. The model also learns the retoucher’s idea of level, habits included. The ONNX export is 347 MB, the largest model in the suite.
Tools
DINOv3 ViT-B/16, PyTorch (DDP), OpenCV (SIFT, homography), ONNX Runtime, RegNet (replaced).
DINOv3 is used under Meta’s DINOv3 licence.
The full write-up
There is a longer write-up of this project. It has client details in it, so email me if you’d like a redacted copy.