blindflow-eval / README.md
hem436's picture
BlindFlow Eval: 1,600 photos at 768, 900 PSFs (severity 0.3 to 0.5), 1.44M-pair cross product, loader and reference results
ebf9d07 verified
|
Raw History Blame Contribute Delete
6.84 kB
---
pretty_name: BlindFlow Eval
license: other
license_name: mixed-non-commercial
license_details: "Derived images keep their sources' terms: FFHQ CC BY-NC-SA 4.0, AFHQ CC BY-NC 4.0, DIV2K academic research only. Non-commercial research use only."
task_categories:
- image-to-image
tags:
- blur
- psf
- deblurring
- blind-deconvolution
- evaluation
size_categories:
- 1K<n<10K
---
# BlindFlow Eval (blur_eval_768)
An evaluation set for blur estimation: **1,600 sharp photographs at 768 x 768**
and **900 PSFs with severity in [0.3, 0.5]**, combined as the full
**1,440,000-pair cross product**, with a PyTorch loader that blurs each pair on
the fly exactly as the `dape_blur` models were trained.
## Contents
```
blur_eval_768/
images/ffhq/00000.png ... 00999.png 1,000 FFHQ, first 1,000 (1024 -> 768)
images/afhq_dog/*.png 500 AFHQ val/dog (512 -> 768, upscaled)
images/div2k/0801.png ... 0900.png 100 DIV2K validation HR (~2K -> 768)
kernels/kernels.npy (900, 64, 64) float32 PSFs, each sums to 1
images.json per image: id, source, file, source file, native size, crop, flags
kernels.json per kernel: id, family, type index, severity, second-moment radius
pairs.json the cross product: [image_id, kernel_id] for all 1,440,000 pairs
blur_eval_dataset.py the loader (torch, numpy, pillow)
reference_results_spec.json the shipped dape_blur model on a fixed 16,000-pair subset
SHA256SUMS
```
### Photographs
Each photograph is centre-cropped to a square and resampled to 768 x 768 with
Lanczos (antialiased), the same preparation as the training photographs. Only
DIV2K is non-square; it is cropped rather than stretched, because stretching
would distort the content while the blur stays round. `crop_box` records the
crop in native pixels.
| source | count | native | note |
|---|---|---|---|
| FFHQ 00000 to 00999 | 1,000 | 1024 x 1024 | from shard `00000.tar` of `gaunernst/ffhq-1024-wds` (WebP) |
| AFHQ val/dog | 500 | 512 x 512 | **upscaled** to 768 (`upscaled: true`), so slightly soft before any blur |
| DIV2K validation HR | 100 | about 2040 x 1356 | centre square crop, then downscaled |
`seen_by_released_model` marks the 393 AFHQ photographs that were in the
training split of the shipped `dape_blur` checkpoint (the AFHQ val/dog set was
part of the project's training corpus). FFHQ 00000 to 00999 and DIV2K were never
used in training. The kernels are all new. Use `unseen_only=True` for a strictly
held-out evaluation.
### Kernels
Fresh draws from the project's procedural PSF generator
(`src/dataset.generate_single_kernel`, config `config_17M_base.yaml`, the same
generator and parameter ranges as the training pool; motion severity means blur
extent). Severity is drawn uniformly in [0.3, 0.5] with seed 2026. Being
continuous random draws, none coincides with a training kernel.
| family | count | radius (px, 768 frame) | Spearman(severity, radius) |
|---|---|---|---|
| iso_gaussian | 100 | 4.0 to 5.7 | +1.000 |
| aniso_gaussian | 100 | 3.3 to 5.3 | +0.926 |
| motion | 200 | 4.9 to 7.4 | +0.987 |
| defocus | 100 | 8.1 to 10.7 | +1.000 |
| spherical | 100 | 11.1 to 14.9 | +1.000 |
| coma | 100 | 7.3 to 9.3 | +0.997 |
| astigmatism | 100 | 5.8 to 6.8 | +0.999 |
| trefoil | 100 | 6.2 to 7.5 | +1.000 |
Severity is each family's own [0, 1] scale (a severity of 0.4 is not the same
blur size in two families); `radius_px` in `kernels.json` gives the physical
extent. PSFs use the correlation convention (no flip) and are applied at 768.
### Pairs
`pairs.json` lists every `[image_id, kernel_id]`; `pair_id = image_id * 900 +
kernel_id`. Motion is 200 of 900 kernels, so it is 22% of pairs: report
per-family or macro-averaged numbers alongside plain accuracy.
## Loader
```python
import torch
from blur_eval_dataset import BlurEvalDataset
ds = BlurEvalDataset("blur_eval_768") # 1,440,000 pairs, sigma 0.03, 384 output
ds = BlurEvalDataset("blur_eval_768", unseen_only=True) # 1,086,300 pairs, no training photos
ds = BlurEvalDataset("blur_eval_768", sources=["div2k"], types=["defocus", "motion"])
ds = BlurEvalDataset("blur_eval_768").sample(16000, seed=0) # a fixed random subset
loader = torch.utils.data.DataLoader(ds, batch_size=32, num_workers=8)
for b in loader:
b["degraded"] # (B, 3, 384, 384) in [0, 1]: what DAPE / dape_blur receives
b["type_idx"], b["severity"], b["kernel"], b["image_id"], b["kernel_id"], b["source"]
```
Degradation, per pair: correlate the 768 photograph with the PSF (reflect
padding), add Gaussian noise (`sigma`, default 0.03 on a [0, 1] scale), clip,
then SeeSR's `Resize((384, 384))` (bilinear, antialiased). `resize_to=None` keeps
768; `return_sharp=True` adds the sharp photograph. The blur is computed by FFT
and equals the training operator's direct correlation to 4e-6. Noise is seeded
per pair (`noise_seed`, `pair_id`), so any item is identical across runs, batch
sizes, workers and subsets.
## Reference results: shipped dape_blur (spec), 16,000 pairs
`BlurEvalDataset(root).sample(16000, seed=0)`, sigma 0.03, fp32. Type accuracy
is 8-way (higher is better); severity MAE is in [0, 1] units (lower is better).
| subset | pairs | type accuracy | severity MAE |
|---|---|---|---|
| all | 16,000 | 0.890 | 0.052 |
| FFHQ | 9,978 | 0.885 | 0.054 |
| AFHQ dog | 5,001 | 0.893 | 0.050 |
| DIV2K | 1,021 | 0.934 | 0.043 |
| unseen photographs only | 12,082 | 0.889 | 0.053 |
The training-photo overlap does not inflate the score (0.889 unseen against
0.890 overall).
| family | recall | severity MAE | severity MAE, typed right | most confused with |
|---|---|---|---|---|
| coma | 0.992 | 0.032 | 0.031 | trefoil 0.4% |
| motion | 0.990 | 0.020 | 0.017 | aniso_gaussian 0.7% |
| aniso_gaussian | 0.984 | 0.024 | 0.022 | motion 0.8% |
| spherical | 0.965 | 0.029 | 0.014 | iso_gaussian 3.3% |
| iso_gaussian | 0.914 | 0.033 | 0.021 | defocus 4.2% |
| trefoil | 0.871 | 0.045 | 0.024 | spherical 8.2% |
| astigmatism | 0.849 | 0.027 | 0.014 | iso_gaussian 9.6% |
| **defocus** | **0.473** | **0.234** | 0.007 | **astigmatism 43.6%** |
Macro-averaged recall is 0.880. Defocus at mid severity is the known weakness:
almost half is called astigmatism, and its large severity error is that
mistyping (typed correctly, its severity MAE is 0.007).
## Licences
Derived images keep their sources' terms: **FFHQ** CC BY-NC-SA 4.0, **AFHQ**
CC BY-NC 4.0, **DIV2K** for academic research use only. Non-commercial research
use only. The kernels, JSON and loader are part of the kernel_generator project.
## Rebuilding
`scripts/build_eval_dataset.py` in kernel_generator rebuilds this set
deterministically from `ffhq_00000.tar`, `DIV2K_valid_HR.zip` and the AFHQ
val/dog folder (kernel seed 2026).