Spaces:
Paused
Paused
File size: 6,449 Bytes
b5af7d6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # Real-iris research iteration
The learned pipeline is now available as an explicit experimental FastAPI/UI option. Standard mode still runs the original baseline. Experimental mode requires equally sized, centered square iris crops (400–3000px) and a confirmation checkbox. It is not an automatic full-frame iris detector. No production success or real-image subpixel accuracy is claimed.
## Findings
The original input handling included non-iris regions and had weak sensitivity for the actual iris detail. Manually centered iris masks and correspondence-only illumination normalization increased useful classical matches on five pairs. A learned matcher supplies broad initial correspondences on all six, but native patch checks reject most proposals on sample 1. A larger match count is not a correctness metric.
Five pairs (2–6) now have research alignment candidates after patch verification and a regularized smooth mesh. Sample 1 remains rejected. The candidate gate (median automatic held-out disagreement under 4 px, p95 under 12 px and over 99% geometric validity in the approximate iris region) is an exploratory screening threshold, **not** the client's acceptance standard and not the synthetic subpixel threshold. Glare removal, independent landmark accuracy, automatic iris segmentation and finished composites remain unresolved. The mesh version deliberately outputs alignment diagnostics rather than an unvalidated blended result.
Every experiment uses the same six development pairs; there is no untouched external validation set. Spatially held-out automatic matches are excluded from geometric fitting, but remain fallible model/patch labels from these images. The dense-flow experiment also sees the image areas containing held-out points; the metric is correspondence consistency, not independent test-image accuracy. We did not claim these measurements as anatomical ground truth.
## Reproduce
```sh
.venv/bin/pip install -r requirements-ml.txt
mkdir -p models
curl -fL https://huggingface.co/kornia/loftr/resolve/main/loftr_outdoor.ckpt -o models/loftr_outdoor.ckpt
.venv/bin/python scripts/evaluate_matchers.py
.venv/bin/python scripts/validate_matcher_patches.py
.venv/bin/python scripts/refine_client_research.py
.venv/bin/python scripts/evaluate_mesh.py
.venv/bin/python scripts/create_research_review.py
```
Requires native 2200px crops produced by `scripts/benchmark_client.py`. The annular mask assumes these manually centered square crops; it is not a general eye detector and should not be applied directly to arbitrary full-frame uploads. Masks and grayscale normalization are correspondence inputs only. Aligned outputs are sampled from the source color image once. The adjusted preview has a scalar exposure lift, and the raw aligned PNG is also retained. The original manual finished images never enter matching or transformation fitting.
Model: [Kornia LoFTR official weights](https://huggingface.co/kornia/loftr), outdoor checkpoint (MIT model card). LoFTR was trained on general scene data, not these iris images. Evaluated locally on CPU; no client images were sent to an external inference service. Downloaded checkpoint SHA-256: `21f5bec5968178e8bc8b7633441836fe5de4f47d861dd2cd7dc38e271b0479ec`. Verify this hash to reproduce the evaluated weights because the download URL uses a moving main revision. Torch loads the checkpoint using `weights_only=True`.
Private artifacts are in `private_benchmarks/research/`, excluded from git and outside the public benchmark static mount. Each matcher has separate cached correspondences and each experiment separate outputs. Original baseline artifacts are preserved. Do not publish the private directory as part of the VM deployment.
## Review before promotion
Open `private_benchmarks/research/index.html` for aligned images. `landmarks.html` shows only the two original crops, permitting a reviewer to mark distinctive corresponding structures without a predicted alignment overlay. Export one JSON per sample, then run:
```sh
.venv/bin/python scripts/score_landmarks.py /path/to/iris-landmarks-2.json
```
This reports errors against human annotations, which have their own marking uncertainty. Spread 10–20 points around the iris and mark only visible, unambiguous structures. Do not use these evaluation annotations to refit the transform and then call the result independent validation. Review rejected and uncertain regions as well as good-looking crops.
Next decisions: validate geometry on real landmarks, add explicit iris/eyelid/pupil/glare masks and a manual correction path for sample 1, then implement source selection for glare using verified neighboring geometry. Expand to new real pairs before deployment claims. Optional human landmark assistance is preferable to forcing an uncertain automated warp.
## Integrated evaluation and UI (23 September)
`backend/learned_registration.py` reuses the correspondence, native-patch and mesh modules. It evaluates spatially held-out automatic correspondences over five folds before fitting the final preview to the verified points. The preview gate remains exploratory (median under 4px and p95 under 12px, at least 60 verified points, geometry/coverage checks); it does not assert 95% accuracy. Reported percentages at 1/2/3/5px are automatic consistency on the patch-verified subset. Sample 1 has 29 verified matches and is not measurable; sample 5 is 93.93% within 5px. All six remain development data.
Run `scripts/evaluate_all_pairs.py` to inventory originals separately from Photoshop references and evaluate cached correspondences. `--recompute-matches` reruns inference. Run `scripts/run_learned_batch.py` to exercise the same path as the API, then `scripts/create_learned_report.py` for the results-only PDF/HTML in `private_benchmarks/learned_batch`. The model is loaded lazily and its SHA-256 checked; `IRIS_MODEL_PATH` optionally overrides the checkpoint location. The API limits computation to one in-flight pair per process and returns 503/Retry-After when busy; this is not a persistent job queue.
Accepted experimental previews export inverse-map metadata (global matrix, reference shape and residual mesh coefficients) for reproduction. They resample original RGB pixels once and restrict blending to geometry-valid, supported iris regions outside detected glare. This does not solve reflection removal or segmentation; rejected pairs return original images only.
|