Mughees Ul Haq

Work 04 / 18

Estimating how full a waste bin is from one camera frame

A fixed camera looks at a waste container. From a single frame, the pipeline says how full it is, from 0 to 100%. It finds the bin’s corners, estimates depth, and regresses the fill level from the depth map.

For
A waste-management operator
When
April to June 2026, re-run in September
My part
Pipeline, depth-model integration, experiments, evaluation
Status
In production, one model per camera fleet
Public photos of waste containers turned into 3D point clouds from their metric depth maps.

Nearest point 1.06 m, median 1.8 m, farthest 9.83 m.

Public photos of waste containers turned into 3D point clouds from their metric depth maps.

Nearest point 0.71 m, median 1.05 m, farthest 2.07 m.

Public photos of waste containers turned into 3D point clouds from their metric depth maps.

Nearest point 1.27 m, median 1.92 m, farthest 14.84 m.

The depth stage on public photos of bins: Depth Anything V3 gives every pixel a distance in metres, and here those distances become a point cloud you can turn by dragging. The regressor that turns depth into a fill level is client-trained and is not run here.

Photos: Bright orange wheelie bin outside Exxon by Ser Amantio di Nicolao, CC0; Ryde Church Street house wheelie bin by Editor5807, CC BY 3.0; Forest of Dean District Council wheelie bin,… by Jaggery, CC BY-SA 2.0. What I changed.

Mean error, Site A
6.37 points
Grouped 5-fold CV, 547 crops, image only
Mean error, Site B
8.00 points
300 crops
Within ±10 points
80.6% / 73.0%
Site A / Site B
Not claimed
2.14 1.79
Needed labelled frames from the same camera

The problem

The labels are fill percentages that come straight from the camera filenames, so a new site can be added without an annotation tool. I judge every stage by the final error in percentage points.

How it works

Three stages. A keypoint model finds the four corners of the bin and crops to it (that model has its own page). Depth Anything V3 turns the crop into a metric depth map. A gradient-boosted regressor reads a 32 × 32 version of that map and outputs the fill level.

What failed

Most of the clever ideas lost to plain letterboxing. Subtracting a reference image of the empty bin lost. Separate preprocessing for night frames (four variants, 1,518 lines) lost too, and I removed both.

In September I tested a second depth model, Marigold V2, because its depth maps look sharper. It was worse on both sites, by 4.8 and 3.5 points of error. Adding its depth or its edge map to the existing features gave nothing. It would also have added about 2 seconds per crop and a 40 GB model.

The number I don’t quote

Mean absolute error in percentage points (lower is better)
  • Depth Anything V3 (kept)
  • Marigold V2
Site A6.37 DA311.17 Marigold
Site B8.00 DA311.49 Marigold

Grouped 5-fold cross-validation, 3 repeats. Site A: 547 crops. Site B: 300 crops.

The best number in my logs is a mean error of 2.14, then 1.79. I don’t quote either. They came from tuning the output on a labelled folder and calibrating each frame against labelled frames from the same camera with neighbouring timestamps. That is not an image-only prediction.

I kept that step out of production, and the image-only numbers are the ones at the top of this page: a mean error of 6.4 points on Site A and 8.0 on Site B, under grouped cross-validation.

Limits

Site A’s figures come from 547 crops of 253 captures; Site B has 300 crops. On a tiny 14-image holdout the error was 13.4. The keypoint stage needs retraining for each new camera, and when a bin is overfilled and its corners are hidden the pipeline falls back to a fixed polygon for that camera.

From the run log

fl.02Subtracting a reference image of the empty binWorse on the comparison setKilled

Setup: Subtract a known empty-bin depth map from each frame

The idea I liked most on paper: subtract the empty bin’s depth map so only the waste is left. It performed poorly on the comparison set and lost to raw depth.

fl.08Calibrating against labelled neighboursMAE 4.07 → 2.14 on the same folderNot shipped

Setup: Calibrate each frame against labelled frames from the same camera with neighbouring timestamps

The whole chain took the error on that folder from 18.57 to 2.14, an 88.5% drop. It depends on labelled frames from the same camera with neighbouring timestamps, so it is not an image-only prediction. I kept it out of production and I don’t quote 2.14 as the model’s accuracy.

fl.09The best number, removedMAE 1.79 on the same folderNot shipped

Setup: Unrestricted regressor and post-processing

The lowest error the project ever produced, 1.786. I took it out of the pipeline. The gain leans on labelled frames from the same camera, so it is not an image-only prediction, and I could not say how much of it was skill and how much was label leakage. Production went back to the image-only path.

fl.11Grouped cross-validation, image onlyMAE 6.37 (Site A), 8.00 (Site B)Finding

Setup: 5 folds grouped by capture, 3 repeats, HistGradientBoosting on the 32 × 32 depth map

Frames from one capture never sit in two folds. Site A: MAE 6.37 ±0.12, 80.6% within ±10 points, R² 0.916, on 547 crops from 253 captures. Site B: 8.00 ±0.15, 73%, R² 0.863, on 300 crops. These are the numbers I quote.

fl.12Marigold V2 against Depth Anything V3MAE 11.17 vs 6.37 (Site A), 11.49 vs 8.00 (Site B)Killed

Setup: Same crops, same regressor, grouped 5-fold CV

Marigold’s depth maps look sharper, so I tested it as a replacement. It was worse on both sites. The paired difference was +4.79 points [+3.38, +5.94] on Site A and +3.48 [+2.33, +4.64] on Site B. I kept Depth Anything V3.

All 16 runs for this project

Tools

Depth Anything V3 (metric, ONNX), HRNet-W32 keypoints, XGBoost, HistGradientBoosting, ONNX Runtime, OpenCV.

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.