Mughees Ul Haq

Work 01 / 18

Blurring family photos in property listings

A property-media platform publishes thousands of interior photos. Framed family photos on the walls show real faces, and those have to be hidden before a listing goes live. I trained the model that finds them.

For
A property-media platform
When
Spring to August 2026
My part
Dataset, training, evaluation and ONNX delivery
Status
v7 is in production as an ONNX model
A public photo of a room with framed pictures, before and after the delivered model and blur ran on it.OriginalAfter the model and blur
The delivered model on a public photo. Drag across it to compare the original with the output, where each frame the model found is blurred.

Photo: Drawing, Interior of a Dressing Room with Te… by François Etienne Villeret, Public domain. What I changed.

Frame F1 on 225 test photos
49.8 → 81.2
Old pipeline to my v7, original labels
v7 after the label audit
82.8
Same photos, 860 corrected frames
Faces missed in max-privacy mode
41 → 5
Client’s 25-image acceptance set
Delivered as
90 MB ONNX
Runs at 1792 px

The problem

The pipeline I inherited found faces first and then grew a blurred blob around each one. It missed small frames, and it blurred mirrors and TVs. On 225 test photos it blurred 633 regions that should have been left alone.

Production photos are 4000 × 3000 pixels or larger, and a framed photo on a far wall can be 20 to 60 pixels wide. Those small frames are where most of the misses come from.

What failed

Most of what I tried. I retrained the model five times to get more precision (the v4 runs) and every retrain scored below the model I already had. I then showed that I could get the same trade by raising one confidence threshold on the old model, which ended that line of work.

Tiling the image into overlapping crops is the usual fix for small objects. I tried it three times. Each time it added false positives or lost recall, and the most careful attempt dropped F1 from 82.8 to 76.7.

A last low-learning-rate polishing stage made the test score worse (81.2 to 80.7), so I shipped the checkpoint from before it.

What worked

Three changes did most of the work.

First, I stopped looking for faces and trained a segmentation model to outline the frame itself. Second, I split frames into two classes, with a face and without one. At the same recall, precision went from 64% to 86%. Third, I ran the first model over about 5,500 photos with no frames in them and added everything it wrongly fired on, 1,322 images, back into training as negatives.

The same weights scored 77.0 at 960 pixels and 78.5 at 1792, then got worse above that. The delivered model, v7, is a YOLO11m segmentation model trained from COCO weights at 1792 on a cleaner dataset of about 11,800 instances. It scores 81.2 on the original labels.

Frame F1 on the same 225 test photos, original labels
Pipeline I inherited49.8
v3 at 960 px77.0
v3 at 1792 px78.5
v7 at 1792 px, in production81.2
RF-DETR, research only83.8

F1 at mask IoU 0.5 or higher. The bar in colour is the model that shipped. On the corrected labels v7 scores 82.8.

Public photos of rooms with the regions the frame model found outlined, each with its class and confidence.
Public photos of rooms with the regions the frame model found outlined, each with its class and confidence.
Public photos of rooms with the regions the frame model found outlined, each with its class and confidence.
Public photos of rooms with the regions the frame model found outlined, each with its class and confidence.
The delivered model on four public photos. It finds framed pictures at 0.94 and 0.88, and flags a painting of a face as a frame with a face at 0.80. The last photo only gets a 0.38, below the usual threshold. Move the slider to see what it finds at each confidence.

Photos: Kitchen, Paul Schweiker House and Studio, Me… by w_lemay, CC BY-SA 2.0; Kitchen, Paul Schweiker House and Studio, Me… by w_lemay, CC BY-SA 2.0; Drawing, Interior of a Dressing Room with Te… by François Etienne Villeret, Public domain; Kitchen, Paul Schweiker House and Studio, Me… by w_lemay, CC BY-SA 2.0. What I changed.

The labels were wrong too

When I audited the test labels I found that many of the model’s ‘mistakes’ were frames nobody had labelled: framed drawings and paintings of a face, and pets. Correcting them took the test set from 794 to 860 frames and v7’s score from 81.2 to 82.8. I quote both numbers with their label version, because they are not comparable.

What I didn’t ship

An RF-DETR segmentation model scored 84.0 on the corrected labels, and a fusion of three models scored 84.7. Neither is in production; I list them as research results.

Limits

The 225-image test set is internal. On the client’s own 25-image acceptance set the frame score went from 53.9 to 76.4. Small frames are still the weak point: 78% of the earlier model’s misses were tiny frames.

For listings where a missed face matters more than an extra blur, a second mode adds a face detector and SAM on top of the frame model. It missed 5 faces where the old pipeline missed 41, at 85% precision, on those same 25 images.

From the run log

fs.07v3: splitting frames into two classesPrecision 64% → 86% at equal recallFinding

Setup: frame_with_face and frame_without_face, 3,504 images, 11,465 polygons

Most false positives were real frames that had no face in them. Giving those their own class let the model tell them apart: precision rose from 64% to 86% with recall held equal.

fs.19The check that ended v4F1 72.4 (P 88.8, R 61.1)Finding

Setup: v3 with its confidence threshold raised to 0.72

Raising one threshold on v3 gave slightly better numbers than v4c’s high-precision operating point. v3 can also reach 85.9% recall, and v4c cannot pass 78.3% at any threshold. Five retrains had reproduced a slider I already had.

fs.24Tiling: the full negative resultF1 82.8 → 76.7Killed

Setup: 7 strategies, native and sliced, 20% overlap, greedy merge

I gave tiling a proper test with seven strategies. Standard SAHI dropped F1 from 82.8 to 76.7 and recall from 80.9 to 71.7. A 2 × 2 grid with no overlap scored 76.9. Every tiled variant was worse than one pass over the whole image.

fs.28v7: fresh start from COCO weightsF1 81.2 (original labels), 82.8 (corrected)Shipped

Setup: YOLO11m-seg, 3,532 images, 1792 px, lr 0.001

Precision 79.9 and recall 82.6 on the original labels. An earlier attempt at lr 0.002 went NaN. Each epoch took about 8.5 minutes. This is the model in production.

fs.35Auditing the test labels794 → 860 labelled framesFinding

Setup: 225-image test set

About 66 of the model’s ‘false positives’ were framed drawings, paintings and pets that show a face and had not been labelled. After relabelling, v7’s false positives fell from 165 to 125 and v3’s from 181 to 143.

All 37 runs for this project

Tools

Ultralytics YOLO11m-seg, SAM ViT-B, ONNX Runtime, RF-DETR-Seg (explored), DINOv2 (explored).

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.