Draft write-up
This project trains a CNN to look at an image and regress two numbers: color temperature and tint. Those values drive white balance correction so a warm or cool cast can be neutralised automatically.
01Problem
Classic auto white balance relies on heuristics such as gray-world that break on scenes dominated by one color. A learned estimator can use scene context to infer the true illuminant.
02Approach
- 01
Frame it as regression
Instead of classifying lighting presets, the model predicts continuous temperature and tint, which maps directly onto correction controls.
- 02
Fine-tune EfficientNetV2-S
A pretrained EfficientNetV2-S backbone gives strong features at a small compute budget. A compact regression head outputs the two targets.
- 03
Augment without breaking labels
Augmentations are chosen so they do not alter the illuminant the label describes. Color-shifting augmentations are avoided or paired with adjusted labels.
- 04
Evaluate on error that matters
Beyond MAE per target, results are judged on corrected-image quality, since small numeric errors can be visible or invisible depending on the scene.
03Architecture
A standard training and inference pipeline around a pretrained backbone with a two-output regression head.
01Data
Image + (temperature, tint) labelsDataset loading, normalisation, train/validation split across scenes.
02Preprocess
Resize + label-safe augmentationResolution matched to the backbone; geometric augmentations only by default.
03Backbone
EfficientNetV2-SPretrained feature extractor fine-tuned end to end.
04Head
Regression layersPooled features mapped to two continuous outputs.
05Loss & training
PyTorchRegression loss on scaled targets, mixed precision, learning-rate schedule.
06Inference
Correction modulePredicted values converted into a white balance adjustment on the image.
- Continuous temperature and tint prediction
- Lightweight backbone suitable for image pipelines
- Per-target error reporting and visual before/after checks
04Challenges
Targets sit on very different numeric scales.
FixStandardised both targets so the loss weights them evenly.
Color-based augmentation silently corrupted the labels.
FixRestricted augmentation to label-preserving transforms.
05Learnings
Outcomes
- Trained regressor that estimates temperature and tint from a single image
- Evaluation covering both numeric error and visual correction quality
What I learned
- Label-aware augmentation matters as much as architecture choice.
- Numeric error alone is a weak proxy for perceived image quality.
06Next
- 01Compare against gray-world and other baselines in a table
- 02Export to ONNX for fast inference
