Mughees Ul Haq

Work 07 / 18

Sorting photos into inside, outside and drone

Every photo is sent to the right enhancements by a classifier that says whether it was taken inside, outside at ground level, or from a drone. I replaced a 594 MB model with a 41 MB one.

For
A property-media platform
Status
v3.2.1 exported to ONNX
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • inside100%
  • outside0%
  • drone0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • inside100%
  • drone0%
  • outside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • inside100%
  • outside0%
  • drone0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • outside100%
  • drone0%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • outside100%
  • inside0%
  • drone0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • outside100%
  • drone0%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • drone100%
  • outside0%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • drone99%
  • outside1%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • drone87%
  • outside13%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • drone69%
  • outside31%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • outside88%
  • drone12%
  • inside0%
Twelve public photos, each with the scene classifier’s probabilities for inside, outside and drone.
  • outside64%
  • drone36%
  • inside0%
v3.2.0 on twelve public photos. Rooms, houses and aerial shots go to the right class. The uncertain ones are where you would expect: a field shot from low altitude splits 0.69 drone to 0.31 outside, and a car on a street 0.64 outside to 0.36 drone.

Photos: Interior, Duncan House, Polymath Park, Acme,… by w_lemay, CC BY-SA 2.0; Interior, Duncan House, Polymath Park, Acme,… by w_lemay, CC BY-SA 2.0; Kitchen, Paul Schweiker House and Studio, Me… by w_lemay, CC BY-SA 2.0; Henry G. Haussauer House, Amherst, New York… by Andre Carrotflower, CC BY-SA 4.0; Munsell House, Park Street, South Royalton,… by w_lemay, CC BY-SA 2.0; Arbury Hall (34378442995) by Elliott Brown from Birmingham, United Kingdom, CC BY-SA 2.0; Aerial view of Cross Houses in Spring by AndySpeed, CC0; Aerial view of houses in Walnut Park, Los An… by Pi.1415926535, CC BY-SA 4.0; A dip in the road in Färlev by W.carter, CC0; Erdmandelgras (Cyperus esculentus) in Möhren… by Schlaghecken Josef, CC BY 4.0; Camp-Schweller House, Main Street, Wellingto… by w_lemay, CC BY-SA 2.0; Peugeot 404 Limousine by Rolf Kranz, CC BY-SA 4.0. What I changed.

Holdout accuracy, v3.2.0
98.90%
626 of 633, balanced classes
Holdout accuracy, v3.2.1
99.16%
2,612 of 2,634; leaves out the hardest cases
Model size
593.6 → 40.8 MB
Xception to EfficientNet-B3
Classes
3
Inside, outside, drone

Why it matters

The scene type decides which enhancements run. Sky replacement only makes sense outside, the colour profiles differ inside and out, and drone shots need their own handling. A wrong call here sends a photo down the wrong pipeline.

What changed

Version 3.1 was an InceptionV3 trained on 36,776 images, with about three times as many of one class as another. For v3.2.0 I balanced the data to 4,187 images per class, 12,561 in total, and moved to EfficientNet-B3 at 300 pixels. Augmentation depends on the class: 60% of images are left as they are, and outside and drone photos get stronger changes.

Results

v3.2.0 got 626 of 633 holdout images right (98.90%). The seven errors were three outside photos called inside and four drone photos called outside.

v3.2.1 merged and cleaned the data to 17,538 images, left out 611 ambiguous ones, and scored 99.16% (2,612 of 2,634). That holdout leaves out the hard drone and outside cases, so the two scores are not comparable, and I quote both.

The export is a 40.8 MB ONNX file in fixed and dynamic batch versions, 14 times smaller than the 593.6 MB Xception model before it.

Limits

Both holdouts come from the same sources as the training data. The line between a low drone shot and a high ground-level shot is the hard case, and it is where the errors are.

Tools

EfficientNet-B3, PyTorch, ONNX Runtime, InceptionV3 and Xception (replaced).

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.