Spaces:
Paused
Paused
github-actions[bot] commited on
Commit ·
f65c627
1
Parent(s): 6ca097e
Automated Deploy: 67450540d340eb0a4ccb37442d1c451866cc1fd5
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .env.example +3 -2
- backend/experimental/evaluation.py +37 -0
- backend/experimental/native_refinement.py +4 -1
- backend/experimental/selection.py +36 -0
- backend/experimental/settings.py +3 -3
- backend/learned_registration.py +10 -3
- backend/review.py +1 -0
- frontend/src/ReviewSummary.jsx +3 -1
- hf_workspace/hf_workspace/.env.example +12 -0
- hf_workspace/hf_workspace/backend/experimental/lightglue_matching.py +58 -0
- hf_workspace/hf_workspace/backend/experimental/native_refinement.py +39 -0
- hf_workspace/hf_workspace/backend/experimental/radial.py +53 -0
- hf_workspace/hf_workspace/backend/experimental/segmentation.py +114 -0
- hf_workspace/hf_workspace/backend/experimental/settings.py +28 -0
- hf_workspace/hf_workspace/hf_workspace/PRODUCTION_READINESS.md +25 -0
- hf_workspace/hf_workspace/hf_workspace/RESEARCH.md +50 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/__init__.py +1 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/evaluation.py +58 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/matching.py +52 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/mesh.py +75 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/patch_validation.py +56 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/preprocessing.py +24 -0
- hf_workspace/hf_workspace/hf_workspace/backend/experimental/refinement.py +38 -0
- hf_workspace/hf_workspace/hf_workspace/backend/learned_registration.py +91 -0
- hf_workspace/hf_workspace/hf_workspace/backend/review.py +49 -0
- hf_workspace/hf_workspace/hf_workspace/frontend/src/ReviewSummary.jsx +26 -0
- hf_workspace/hf_workspace/hf_workspace/frontend/src/api.js +9 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/.dockerignore +12 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/.gitignore +11 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/Dockerfile +22 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/__init__.py +1 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/app.py +81 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/common.py +11 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/compositing.py +22 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/global_alignment.py +49 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/local_alignment.py +56 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/registration.py +58 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/benchmark.py +34 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/fixtures/prompt.txt +1 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/fixtures/synthetic-iris.png +3 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/index.html +1 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/package-lock.json +1153 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/package.json +1 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/src/main.jsx +38 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/src/style.css +5 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/vite.config.js +2 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-adjusted.png +3 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-aligned.png +3 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-checkerboard.png +3 -0
- hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-composite.png +3 -0
.env.example
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
# Experimental learned registration. Export these variables before starting Python.
|
| 2 |
# Merely copying this file does not load it; Docker can use --env-file.
|
| 3 |
-
#
|
|
|
|
| 4 |
IRIS_MATCHER=loftr
|
| 5 |
IRIS_MATCH_MAX_SIZE=800
|
| 6 |
-
IRIS_PATCH_VALIDATION=
|
| 7 |
IRIS_ADAPTIVE_MASK=false
|
| 8 |
# Optional absolute paths (omit to use the repository models/ directory):
|
| 9 |
# IRIS_MODEL_PATH=/app/models/loftr_outdoor.ckpt
|
|
|
|
| 1 |
# Experimental learned registration. Export these variables before starting Python.
|
| 2 |
# Merely copying this file does not load it; Docker can use --env-file.
|
| 3 |
+
# Auto retains the baseline unless viewpoint correction improves common-point error.
|
| 4 |
+
# Restart the worker after changes. Set patches to single for the old baseline.
|
| 5 |
IRIS_MATCHER=loftr
|
| 6 |
IRIS_MATCH_MAX_SIZE=800
|
| 7 |
+
IRIS_PATCH_VALIDATION=auto
|
| 8 |
IRIS_ADAPTIVE_MASK=false
|
| 9 |
# Optional absolute paths (omit to use the repository models/ directory):
|
| 10 |
# IRIS_MODEL_PATH=/app/models/loftr_outdoor.ckpt
|
backend/experimental/evaluation.py
CHANGED
|
@@ -56,3 +56,40 @@ def evaluate_correspondences(reference_points,moving_points,shape):
|
|
| 56 |
else:
|
| 57 |
result['reason']='One or more folds could not be evaluated; no complete tail-error estimate.'
|
| 58 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
else:
|
| 57 |
result['reason']='One or more folds could not be evaluated; no complete tail-error estimate.'
|
| 58 |
return result
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def common_evaluation(a, b, anchors_a, anchors_b, shape, geometry=None):
|
| 62 |
+
"""Same automatic target points for every candidate; never fit those locations.
|
| 63 |
+
|
| 64 |
+
A 32px exclusion neighborhood also removes overlapping validation patches.
|
| 65 |
+
These labels remain automatic, not anatomical ground truth.
|
| 66 |
+
"""
|
| 67 |
+
errors = np.full(len(anchors_a), np.inf)
|
| 68 |
+
cell = max(shape)/2200*150
|
| 69 |
+
folds = lambda p: ((p[:, 0]//cell+p[:, 1]//cell).astype(int)%5)
|
| 70 |
+
if len(anchors_a) >= 60:
|
| 71 |
+
for fold in range(5):
|
| 72 |
+
test = folds(anchors_a)==fold
|
| 73 |
+
train = folds(a)!=fold
|
| 74 |
+
if test.sum() < 6:
|
| 75 |
+
continue
|
| 76 |
+
# Chunk distances to bound memory for dense feature sets.
|
| 77 |
+
heldout = anchors_a[test]
|
| 78 |
+
for start in range(0, len(a), 256):
|
| 79 |
+
near = np.linalg.norm(a[start:start+256, None]-heldout[None], axis=2).min(axis=1) < 32
|
| 80 |
+
train[start:start+256] &= ~near
|
| 81 |
+
try:
|
| 82 |
+
if geometry is None:
|
| 83 |
+
matrix, coef, _, _ = fit_geometry(a[train], b[train], shape)
|
| 84 |
+
prediction = predict_points(heldout, matrix, coef, shape)
|
| 85 |
+
else:
|
| 86 |
+
from .radial import fit_radial_mesh
|
| 87 |
+
prediction = fit_radial_mesh(a[train], b[train], shape, geometry).predict(heldout)
|
| 88 |
+
errors[test] = np.linalg.norm(prediction-anchors_b[test], axis=1)
|
| 89 |
+
except (ValueError, cv2.error, np.linalg.LinAlgError):
|
| 90 |
+
pass
|
| 91 |
+
return dict(count=len(errors), scored_count=int(np.isfinite(errors).sum()),
|
| 92 |
+
median_px=float(np.median(errors)) if np.isfinite(errors).all() and len(errors) else None,
|
| 93 |
+
p95_px=float(np.percentile(errors, 95)) if np.isfinite(errors).all() and len(errors) else None,
|
| 94 |
+
within_px_percent={str(t): round(float((errors<=t).mean()*100), 2) if len(errors) else None for t in (1, 2, 3, 5)},
|
| 95 |
+
description='Fixed baseline automatic correspondences; five spatial folds with 32px training exclusion. Not anatomical ground truth. Unscored points count as failures.')
|
backend/experimental/native_refinement.py
CHANGED
|
@@ -32,7 +32,10 @@ def refine_native(reference, moving, mapping, support):
|
|
| 32 |
uy, ux = np.gradient(delta[..., 0]); vy, vx = np.gradient(delta[..., 1])
|
| 33 |
cy, cx = np.gradient(candidate[..., 0]); dy, dx = np.gradient(candidate[..., 1])
|
| 34 |
determinant = cx*dy-cy*dx
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
safe &= (candidate[..., 0]>=0)&(candidate[..., 0]<moving.shape[1]-1)&(candidate[..., 1]>=0)&(candidate[..., 1]<moving.shape[0]-1)
|
| 37 |
# Reject the candidate as a whole instead of introducing seams by patching bad pixels.
|
| 38 |
applied = bool(trusted.any() and safe[support].all() and trusted.sum()/max(support.sum(), 1) > .25)
|
|
|
|
| 32 |
uy, ux = np.gradient(delta[..., 0]); vy, vx = np.gradient(delta[..., 1])
|
| 33 |
cy, cx = np.gradient(candidate[..., 0]); dy, dx = np.gradient(candidate[..., 1])
|
| 34 |
determinant = cx*dy-cy*dx
|
| 35 |
+
by, bx = np.gradient(mapping[..., 0]); ey, ex = np.gradient(mapping[..., 1])
|
| 36 |
+
original_determinant = bx*ey-by*ex
|
| 37 |
+
ratio = determinant/np.maximum(original_determinant, 1e-6)
|
| 38 |
+
safe = np.isfinite(candidate).all(axis=2) & (original_determinant > 0) & (ratio > .8) & (ratio < 1.2) & (np.sqrt(ux**2+uy**2+vx**2+vy**2) < .35)
|
| 39 |
safe &= (candidate[..., 0]>=0)&(candidate[..., 0]<moving.shape[1]-1)&(candidate[..., 1]>=0)&(candidate[..., 1]<moving.shape[0]-1)
|
| 40 |
# Reject the candidate as a whole instead of introducing seams by patching bad pixels.
|
| 41 |
applied = bool(trusted.any() and safe[support].all() and trusted.sum()/max(support.sum(), 1) > .25)
|
backend/experimental/selection.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Choose a refinement only with improvement on the same automatic anchor set.
|
| 2 |
+
|
| 3 |
+
These scores select a candidate; they are not an independent final accuracy test.
|
| 4 |
+
No sample IDs, client references, or manually finished images enter the decision.
|
| 5 |
+
"""
|
| 6 |
+
from .evaluation import common_evaluation, evaluate_correspondences
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def improves(baseline, candidate):
|
| 10 |
+
if baseline['p95_px'] is None or candidate['p95_px'] is None:
|
| 11 |
+
return False
|
| 12 |
+
return (candidate['scored_count'] == candidate['count']
|
| 13 |
+
and candidate['count'] == baseline['count']
|
| 14 |
+
and candidate['p95_px'] < baseline['p95_px'] - max(.15, baseline['p95_px']*.03)
|
| 15 |
+
and candidate['median_px'] <= baseline['median_px']*1.05)
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def select_correspondences(baseline, candidate, shape):
|
| 19 |
+
a, b = baseline
|
| 20 |
+
ca, cb = candidate
|
| 21 |
+
base_evaluation = evaluate_correspondences(a, b, shape)
|
| 22 |
+
candidate_evaluation = evaluate_correspondences(ca, cb, shape)
|
| 23 |
+
diagnostics = dict(selected='single', reason='Baseline retained; alternative must improve common-point predictions.',
|
| 24 |
+
candidate_verified_matches=len(ca), candidate_evaluation=candidate_evaluation,
|
| 25 |
+
description='Automatic model-selection diagnostics, not an independent accuracy test.')
|
| 26 |
+
# With insufficient baseline evidence we cannot claim a comparable improvement.
|
| 27 |
+
if base_evaluation['p95_px'] is None or candidate_evaluation['p95_px'] is None or len(ca) < .8*len(a):
|
| 28 |
+
return a, b, base_evaluation, diagnostics
|
| 29 |
+
base_common = common_evaluation(a, b, a, b, shape)
|
| 30 |
+
candidate_common = common_evaluation(ca, cb, a, b, shape)
|
| 31 |
+
diagnostics.update(baseline_common=base_common, candidate_common=candidate_common)
|
| 32 |
+
if (candidate_evaluation['p95_px'] < 12 and candidate_evaluation['median_px'] < 4
|
| 33 |
+
and improves(base_common, candidate_common)):
|
| 34 |
+
diagnostics.update(selected='geometry', reason='Viewpoint correction improved tail error on the same held-out automatic points without worsening median error or losing substantial support.')
|
| 35 |
+
return ca, cb, candidate_evaluation, diagnostics
|
| 36 |
+
return a, b, base_evaluation, diagnostics
|
backend/experimental/settings.py
CHANGED
|
@@ -7,19 +7,19 @@ import os
|
|
| 7 |
class LearnedSettings:
|
| 8 |
matcher: str = 'loftr'
|
| 9 |
max_size: int = 800
|
| 10 |
-
patches: str = '
|
| 11 |
adaptive_mask: bool = False
|
| 12 |
|
| 13 |
@classmethod
|
| 14 |
def from_env(cls):
|
| 15 |
matcher = os.environ.get('IRIS_MATCHER', 'loftr')
|
| 16 |
-
patches = os.environ.get('IRIS_PATCH_VALIDATION', '
|
| 17 |
adaptive = os.environ.get('IRIS_ADAPTIVE_MASK', 'false').lower()
|
| 18 |
try:
|
| 19 |
size = int(os.environ.get('IRIS_MATCH_MAX_SIZE', '800' if matcher=='loftr' else '1600'))
|
| 20 |
except ValueError as exc:
|
| 21 |
raise RuntimeError('IRIS_MATCH_MAX_SIZE must be an integer.') from exc
|
| 22 |
-
if matcher not in {'loftr', 'lightglue'} or patches not in {'single', 'multiscale', 'geometry'}:
|
| 23 |
raise RuntimeError('Invalid learned matcher or patch-validation configuration.')
|
| 24 |
if adaptive not in {'true', 'false'}:
|
| 25 |
raise RuntimeError('IRIS_ADAPTIVE_MASK must be true or false.')
|
|
|
|
| 7 |
class LearnedSettings:
|
| 8 |
matcher: str = 'loftr'
|
| 9 |
max_size: int = 800
|
| 10 |
+
patches: str = 'auto'
|
| 11 |
adaptive_mask: bool = False
|
| 12 |
|
| 13 |
@classmethod
|
| 14 |
def from_env(cls):
|
| 15 |
matcher = os.environ.get('IRIS_MATCHER', 'loftr')
|
| 16 |
+
patches = os.environ.get('IRIS_PATCH_VALIDATION', 'auto')
|
| 17 |
adaptive = os.environ.get('IRIS_ADAPTIVE_MASK', 'false').lower()
|
| 18 |
try:
|
| 19 |
size = int(os.environ.get('IRIS_MATCH_MAX_SIZE', '800' if matcher=='loftr' else '1600'))
|
| 20 |
except ValueError as exc:
|
| 21 |
raise RuntimeError('IRIS_MATCH_MAX_SIZE must be an integer.') from exc
|
| 22 |
+
if matcher not in {'loftr', 'lightglue'} or patches not in {'auto', 'single', 'multiscale', 'geometry'}:
|
| 23 |
raise RuntimeError('Invalid learned matcher or patch-validation configuration.')
|
| 24 |
if adaptive not in {'true', 'false'}:
|
| 25 |
raise RuntimeError('IRIS_ADAPTIVE_MASK must be true or false.')
|
backend/learned_registration.py
CHANGED
|
@@ -15,6 +15,7 @@ from .experimental.segmentation import adaptive_mask,geometry_overlay
|
|
| 15 |
from .experimental.preprocessing import iris_mask,glare_mask
|
| 16 |
from .experimental.evaluation import evaluate_correspondences,fit_geometry
|
| 17 |
from .experimental.mesh import dense_mesh
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
@lru_cache(maxsize=1)
|
|
@@ -49,17 +50,23 @@ def register_learned(reference,moving,exposure=True,local=True):
|
|
| 49 |
else:
|
| 50 |
roi,source_roi=iris_mask(reference),iris_mask(moving)
|
| 51 |
raw_ref,raw_mov=get_matcher()(reference,moving)
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
ref,mov=validate_geometry_patches(reference,moving,raw_ref,raw_mov)
|
| 54 |
elif settings.patches=='multiscale':
|
| 55 |
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov,multiscale=True)
|
| 56 |
else:
|
| 57 |
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov)
|
| 58 |
-
evaluation=evaluate_correspondences(ref,mov,(h,w))
|
| 59 |
metrics=dict(matches=len(raw_ref),verified_matches=len(ref),inliers=None,inlier_ratio=None,
|
| 60 |
patch_survival_percent=round(100*len(ref)/max(len(raw_ref),1),1),evaluation=evaluation,
|
| 61 |
engine='learned_experimental',settings=dict(matcher=settings.matcher,max_size=settings.max_size,patches=settings.patches,adaptive_mask=settings.adaptive_mask),
|
| 62 |
-
segmentation=[g.to_dict() if g is not None else None for g in geometries])
|
| 63 |
# Preview eligibility is NOT a production accuracy or 95% success gate.
|
| 64 |
if evaluation['p95_px'] is None or evaluation['median_px']>=4 or evaluation['p95_px']>=12:
|
| 65 |
raise RegistrationError('The learned alignment did not pass correspondence validation. Reference preserved.',metrics)
|
|
|
|
| 15 |
from .experimental.preprocessing import iris_mask,glare_mask
|
| 16 |
from .experimental.evaluation import evaluate_correspondences,fit_geometry
|
| 17 |
from .experimental.mesh import dense_mesh
|
| 18 |
+
from .experimental.selection import select_correspondences
|
| 19 |
|
| 20 |
|
| 21 |
@lru_cache(maxsize=1)
|
|
|
|
| 50 |
else:
|
| 51 |
roi,source_roi=iris_mask(reference),iris_mask(moving)
|
| 52 |
raw_ref,raw_mov=get_matcher()(reference,moving)
|
| 53 |
+
selection=None
|
| 54 |
+
evaluation=None
|
| 55 |
+
if settings.patches=='auto':
|
| 56 |
+
baseline=validate_patches(reference,moving,raw_ref,raw_mov)
|
| 57 |
+
candidate=validate_geometry_patches(reference,moving,raw_ref,raw_mov)
|
| 58 |
+
ref,mov,evaluation,selection=select_correspondences(baseline,candidate,(h,w))
|
| 59 |
+
elif settings.patches=='geometry':
|
| 60 |
ref,mov=validate_geometry_patches(reference,moving,raw_ref,raw_mov)
|
| 61 |
elif settings.patches=='multiscale':
|
| 62 |
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov,multiscale=True)
|
| 63 |
else:
|
| 64 |
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov)
|
| 65 |
+
if evaluation is None:evaluation=evaluate_correspondences(ref,mov,(h,w))
|
| 66 |
metrics=dict(matches=len(raw_ref),verified_matches=len(ref),inliers=None,inlier_ratio=None,
|
| 67 |
patch_survival_percent=round(100*len(ref)/max(len(raw_ref),1),1),evaluation=evaluation,
|
| 68 |
engine='learned_experimental',settings=dict(matcher=settings.matcher,max_size=settings.max_size,patches=settings.patches,adaptive_mask=settings.adaptive_mask),
|
| 69 |
+
selection=selection,segmentation=[g.to_dict() if g is not None else None for g in geometries])
|
| 70 |
# Preview eligibility is NOT a production accuracy or 95% success gate.
|
| 71 |
if evaluation['p95_px'] is None or evaluation['median_px']>=4 or evaluation['p95_px']>=12:
|
| 72 |
raise RegistrationError('The learned alignment did not pass correspondence validation. Reference preserved.',metrics)
|
backend/review.py
CHANGED
|
@@ -43,6 +43,7 @@ def review_pair(reference, moving, exposure=True, local=True, engine="classical"
|
|
| 43 |
])
|
| 44 |
result = {'metrics': metrics}
|
| 45 |
result.update(reference=reference, moving=moving)
|
|
|
|
| 46 |
ratio = metrics.get('inlier_ratio')
|
| 47 |
metrics['match_support_percent'] = round(100 * ratio, 1) if ratio is not None else None
|
| 48 |
metrics['score_description'] = SCORE_DESCRIPTION
|
|
|
|
| 43 |
])
|
| 44 |
result = {'metrics': metrics}
|
| 45 |
result.update(reference=reference, moving=moving)
|
| 46 |
+
metrics.setdefault('engine', 'learned_experimental' if engine == 'learned' else 'classical')
|
| 47 |
ratio = metrics.get('inlier_ratio')
|
| 48 |
metrics['match_support_percent'] = round(100 * ratio, 1) if ratio is not None else None
|
| 49 |
metrics['score_description'] = SCORE_DESCRIPTION
|
frontend/src/ReviewSummary.jsx
CHANGED
|
@@ -4,7 +4,8 @@ export default function ReviewSummary({metrics}) {
|
|
| 4 |
const score = metrics.match_support_percent;
|
| 5 |
return <section className="review-summary" aria-live="polite">
|
| 6 |
<h2>{metrics.status_label}</h2>
|
| 7 |
-
<
|
|
|
|
| 8 |
<p className="note">{metrics.score_description}</p>
|
| 9 |
{metrics.reason && <p>{metrics.reason}</p>}
|
| 10 |
{metrics.evaluation && <section><h2>Automatic consistency</h2>
|
|
@@ -13,6 +14,7 @@ export default function ReviewSummary({metrics}) {
|
|
| 13 |
{metrics.evaluation.within_px_percent ? <table><thead><tr><th>Pixel tolerance</th><th>Held-out matches within tolerance</th></tr></thead><tbody>{Object.entries(metrics.evaluation.within_px_percent).map(([px,percent])=><tr key={px}><td>{px} px</td><td>{percent.toFixed(2)}%</td></tr>)}</tbody></table> : <p>{metrics.evaluation.reason}</p>}
|
| 14 |
</section>}
|
| 15 |
<dl>
|
|
|
|
| 16 |
<dt>Consistent / proposed matches</dt><dd>{metrics.inliers ?? '—'} / {metrics.matches ?? 0}</dd>
|
| 17 |
{metrics.fit_error_px != null && <><dt>Median fitting error (not independent accuracy)</dt><dd>{metrics.fit_error_px.toFixed(2)} px</dd></>}
|
| 18 |
<dt>Processing time</dt><dd>{metrics.runtime_seconds.toFixed(2)} s</dd>
|
|
|
|
| 4 |
const score = metrics.match_support_percent;
|
| 5 |
return <section className="review-summary" aria-live="polite">
|
| 6 |
<h2>{metrics.status_label}</h2>
|
| 7 |
+
<p><strong>Alignment accuracy: not independently measured</strong></p>
|
| 8 |
+
<p className="note">Alignment mode: {metrics.engine === 'learned_experimental' ? 'Learned iris alignment' : metrics.engine === 'classical' ? 'Standard' : 'Not recorded'}.</p>
|
| 9 |
<p className="note">{metrics.score_description}</p>
|
| 10 |
{metrics.reason && <p>{metrics.reason}</p>}
|
| 11 |
{metrics.evaluation && <section><h2>Automatic consistency</h2>
|
|
|
|
| 14 |
{metrics.evaluation.within_px_percent ? <table><thead><tr><th>Pixel tolerance</th><th>Held-out matches within tolerance</th></tr></thead><tbody>{Object.entries(metrics.evaluation.within_px_percent).map(([px,percent])=><tr key={px}><td>{px} px</td><td>{percent.toFixed(2)}%</td></tr>)}</tbody></table> : <p>{metrics.evaluation.reason}</p>}
|
| 15 |
</section>}
|
| 16 |
<dl>
|
| 17 |
+
<dt>Global match support (not accuracy)</dt><dd>{score == null ? 'Not measurable' : `${score.toFixed(1)}%`}</dd>
|
| 18 |
<dt>Consistent / proposed matches</dt><dd>{metrics.inliers ?? '—'} / {metrics.matches ?? 0}</dd>
|
| 19 |
{metrics.fit_error_px != null && <><dt>Median fitting error (not independent accuracy)</dt><dd>{metrics.fit_error_px.toFixed(2)} px</dd></>}
|
| 20 |
<dt>Processing time</dt><dd>{metrics.runtime_seconds.toFixed(2)} s</dd>
|
hf_workspace/hf_workspace/.env.example
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Experimental learned registration. Export these variables before starting Python.
|
| 2 |
+
# Merely copying this file does not load it; Docker can use --env-file.
|
| 3 |
+
# Defaults reproduce the existing pipeline. Restart the worker after changes.
|
| 4 |
+
IRIS_MATCHER=loftr
|
| 5 |
+
IRIS_MATCH_MAX_SIZE=800
|
| 6 |
+
IRIS_PATCH_VALIDATION=single
|
| 7 |
+
IRIS_ADAPTIVE_MASK=false
|
| 8 |
+
# Optional absolute paths (omit to use the repository models/ directory):
|
| 9 |
+
# IRIS_MODEL_PATH=/app/models/loftr_outdoor.ckpt
|
| 10 |
+
# IRIS_WEIGHTS_DIR=/app/models
|
| 11 |
+
# Candidate options: max size 1024; patches geometry; matcher lightglue with 1600.
|
| 12 |
+
# Native flow and radial priors remain research-only pending evaluation.
|
hf_workspace/hf_workspace/backend/experimental/lightglue_matching.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Offline ALIKED + LightGlue adapter using the already pinned Kornia dependency."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import hashlib
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
from .preprocessing import iris_mask, glare_mask
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class LightGlueMatcher:
|
| 10 |
+
def __init__(self, weights_dir, max_size=1600, device='cpu'):
|
| 11 |
+
import torch
|
| 12 |
+
from kornia.feature import ALIKED, LightGlue
|
| 13 |
+
if not 400 <= max_size <= 2200:
|
| 14 |
+
raise ValueError('ALIKED resolution must be between 400 and 2200.')
|
| 15 |
+
self.torch, self.device, self.max_size = torch, device, max_size
|
| 16 |
+
for name, checksum in [('aliked-n16.pth', '5be8704840ed662d9d8c561bf7279c222092674e7eb05fd0feab94899e9d82f2'), ('aliked_lightglue.pth', 'd975e965b105311a6143194852297dff4f02aea5cc2e10cecfed966ca0e22503')]:
|
| 17 |
+
if hashlib.sha256((Path(weights_dir)/name).read_bytes()).hexdigest() != checksum:
|
| 18 |
+
raise RuntimeError(f'{name} failed checkpoint integrity verification.')
|
| 19 |
+
torch.set_num_threads(4)
|
| 20 |
+
self.extractor = ALIKED(max_num_keypoints=4096).eval().to(device)
|
| 21 |
+
state = torch.load(Path(weights_dir)/'aliked-n16.pth', map_location='cpu', weights_only=True)
|
| 22 |
+
# Kornia owns this deterministic grid buffer; the original checkpoint omits it.
|
| 23 |
+
state['dkd.hw_grid'] = self.extractor.state_dict()['dkd.hw_grid']
|
| 24 |
+
self.extractor.load_state_dict(state, strict=True)
|
| 25 |
+
self.model = LightGlue(features=None, input_dim=128, depth_confidence=-1, width_confidence=-1).eval().to(device)
|
| 26 |
+
state = torch.load(Path(weights_dir)/'aliked_lightglue.pth', map_location='cpu', weights_only=True)
|
| 27 |
+
for i in range(9):
|
| 28 |
+
for old, new in ((f'self_attn.{i}', f'transformers.{i}.self_attn'), (f'cross_attn.{i}', f'transformers.{i}.cross_attn')):
|
| 29 |
+
state = {k.replace(old, new): v for k, v in state.items()}
|
| 30 |
+
state['confidence_thresholds'] = self.model.state_dict()['confidence_thresholds']
|
| 31 |
+
self.model.load_state_dict(state, strict=True)
|
| 32 |
+
|
| 33 |
+
def __call__(self, reference, moving, masks=None):
|
| 34 |
+
features, scales = [], []
|
| 35 |
+
for index, im in enumerate((reference, moving)):
|
| 36 |
+
h, w = im.shape[:2]
|
| 37 |
+
factor = min(1., self.max_size/max(h, w))
|
| 38 |
+
size = (max(32, int(w*factor)//32*32), max(32, int(h*factor)//32*32))
|
| 39 |
+
gray = cv2.cvtColor(cv2.resize(im, size), cv2.COLOR_BGR2GRAY)
|
| 40 |
+
gray = cv2.createCLAHE(2, (12, 12)).apply(gray)
|
| 41 |
+
tensor = self.torch.from_numpy(gray.copy()).float()[None, None].to(self.device)/255
|
| 42 |
+
scale = np.float32([w/size[0], h/size[1]])
|
| 43 |
+
with self.torch.inference_mode():
|
| 44 |
+
f = self.extractor(tensor)[0]
|
| 45 |
+
points = f.keypoints.cpu().numpy()*scale
|
| 46 |
+
mask = (iris_mask(im) if masks is None else masks[index]) & ~glare_mask(im)
|
| 47 |
+
xy = np.rint(points).astype(int)
|
| 48 |
+
valid = (xy[:, 0]>=0)&(xy[:, 0]<w)&(xy[:, 1]>=0)&(xy[:, 1]<h)
|
| 49 |
+
valid[valid] &= mask[xy[valid, 1], xy[valid, 0]]
|
| 50 |
+
keep = self.torch.from_numpy(valid).to(self.device)
|
| 51 |
+
features.append(dict(keypoints=f.keypoints[keep][None], descriptors=f.descriptors[keep][None], image_size=self.torch.tensor([size], device=self.device)))
|
| 52 |
+
scales.append(scale)
|
| 53 |
+
if any(f['keypoints'].shape[1] < 2 for f in features):
|
| 54 |
+
return np.empty((0, 2), np.float32), np.empty((0, 2), np.float32)
|
| 55 |
+
with self.torch.inference_mode():
|
| 56 |
+
result = self.model(dict(image0=features[0], image1=features[1]))
|
| 57 |
+
pairs = result['matches'][0]
|
| 58 |
+
return tuple((features[i]['keypoints'][0, pairs[:, i]].cpu().numpy()*scales[i]).astype(np.float32) for i in range(2))
|
hf_workspace/hf_workspace/backend/experimental/native_refinement.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Native-resolution flow candidates composed into source coordinate maps.
|
| 2 |
+
|
| 3 |
+
Photometric agreement is only a gate, never an anatomical accuracy measurement.
|
| 4 |
+
No normalized or previously warped color image is used for the delivered output.
|
| 5 |
+
"""
|
| 6 |
+
import cv2
|
| 7 |
+
import numpy as np
|
| 8 |
+
from .preprocessing import normalize, glare_mask
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def refine_native(reference, moving, mapping, support):
|
| 12 |
+
h, w = reference.shape[:2]
|
| 13 |
+
aligned = cv2.remap(moving, mapping[..., 0], mapping[..., 1], cv2.INTER_LINEAR)
|
| 14 |
+
a, b = normalize(reference), normalize(aligned)
|
| 15 |
+
def flow(left, right):
|
| 16 |
+
return cv2.calcOpticalFlowFarneback(left, right, None, .5, 4, 21, 5, 7, 1.5, 0)
|
| 17 |
+
forward = cv2.GaussianBlur(flow(a, b), (0, 0), 1.2)
|
| 18 |
+
reverse = flow(b, a)
|
| 19 |
+
y, x = np.indices((h, w), dtype=np.float32)
|
| 20 |
+
mx, my = x+forward[..., 0], y+forward[..., 1]
|
| 21 |
+
fb = np.linalg.norm(forward+cv2.remap(reverse, mx, my, cv2.INTER_LINEAR), axis=2)
|
| 22 |
+
before = cv2.GaussianBlur(cv2.absdiff(a, b).astype(np.float32), (0, 0), 2)
|
| 23 |
+
after = cv2.GaussianBlur(cv2.absdiff(a, cv2.remap(b, mx, my, cv2.INTER_LINEAR)).astype(np.float32), (0, 0), 2)
|
| 24 |
+
valid = support & ~glare_mask(reference) & ~glare_mask(aligned)
|
| 25 |
+
valid &= cv2.remap(valid.astype(np.uint8), mx, my, cv2.INTER_NEAREST).astype(bool)
|
| 26 |
+
trusted = valid & (fb < .75) & (np.linalg.norm(forward, axis=2) < 6) & (after < before) & (after < 18)
|
| 27 |
+
trusted = cv2.erode(trusted.astype(np.uint8), np.ones((7, 7), np.uint8)).astype(bool)
|
| 28 |
+
# Smoothly bring residual motion to zero at unsupported boundaries.
|
| 29 |
+
weight = np.minimum(cv2.distanceTransform(trusted.astype(np.uint8), cv2.DIST_L2, 3)/12, 1)
|
| 30 |
+
candidate = cv2.remap(mapping, x+forward[..., 0]*weight, y+forward[..., 1]*weight, cv2.INTER_LINEAR)
|
| 31 |
+
delta = candidate-mapping
|
| 32 |
+
uy, ux = np.gradient(delta[..., 0]); vy, vx = np.gradient(delta[..., 1])
|
| 33 |
+
cy, cx = np.gradient(candidate[..., 0]); dy, dx = np.gradient(candidate[..., 1])
|
| 34 |
+
determinant = cx*dy-cy*dx
|
| 35 |
+
safe = np.isfinite(candidate).all(axis=2) & (determinant > 0) & (np.sqrt(ux**2+uy**2+vx**2+vy**2) < .35)
|
| 36 |
+
safe &= (candidate[..., 0]>=0)&(candidate[..., 0]<moving.shape[1]-1)&(candidate[..., 1]>=0)&(candidate[..., 1]<moving.shape[0]-1)
|
| 37 |
+
# Reject the candidate as a whole instead of introducing seams by patching bad pixels.
|
| 38 |
+
applied = bool(trusted.any() and safe[support].all() and trusted.sum()/max(support.sum(), 1) > .25)
|
| 39 |
+
return (candidate if applied else mapping.copy()), dict(applied=applied, trusted_fraction=float(trusted.sum()/max(support.sum(), 1)), max_motion_px=float(np.linalg.norm(delta, axis=2)[support].max()) if support.any() else 0.)
|
hf_workspace/hf_workspace/backend/experimental/radial.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A bounded pupil-centered radial residual prior, fitted only to training matches.
|
| 2 |
+
|
| 3 |
+
The displacement peaks at the pupil boundary and falls to zero at the limbus.
|
| 4 |
+
Unlike biometric texture unwrapping, this changes coordinates only. It assumes
|
| 5 |
+
approximately circular boundaries and uniform radial strain; a mesh fits residuals.
|
| 6 |
+
"""
|
| 7 |
+
from dataclasses import dataclass
|
| 8 |
+
import cv2
|
| 9 |
+
import numpy as np
|
| 10 |
+
from .mesh import basis, fit_mesh
|
| 11 |
+
from .evaluation import fit_geometry
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def radial_vectors(points, matrix, geometry):
|
| 15 |
+
points = np.asarray(points, np.float32)
|
| 16 |
+
base = cv2.perspectiveTransform(points[None], np.linalg.inv(matrix))[0]
|
| 17 |
+
center = cv2.perspectiveTransform(np.float32([[geometry.center]]), np.linalg.inv(matrix))[0, 0]
|
| 18 |
+
radius = np.linalg.norm(points-np.float32(geometry.center), axis=1)
|
| 19 |
+
weight = np.where(radius < geometry.pupil_radius,
|
| 20 |
+
radius/geometry.pupil_radius,
|
| 21 |
+
np.clip((geometry.iris_radius-radius)/(geometry.iris_radius-geometry.pupil_radius), 0, 1))
|
| 22 |
+
direction = base-center
|
| 23 |
+
direction /= np.maximum(np.linalg.norm(direction, axis=1, keepdims=True), 1e-6)
|
| 24 |
+
return direction*weight[:, None]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@dataclass
|
| 28 |
+
class RadialMesh:
|
| 29 |
+
matrix: np.ndarray
|
| 30 |
+
coefficients: np.ndarray
|
| 31 |
+
geometry: object
|
| 32 |
+
amplitude: float
|
| 33 |
+
shape: tuple
|
| 34 |
+
|
| 35 |
+
def predict(self, points):
|
| 36 |
+
base = cv2.perspectiveTransform(np.float32(points)[None], np.linalg.inv(self.matrix))[0]
|
| 37 |
+
return base + self.amplitude*radial_vectors(points, self.matrix, self.geometry) + basis(points, self.shape) @ self.coefficients.reshape(-1, 2)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def fit_radial_mesh(reference_points, moving_points, shape, geometry):
|
| 41 |
+
matrix, _, _, _ = fit_geometry(reference_points, moving_points, shape)
|
| 42 |
+
base = cv2.perspectiveTransform(reference_points[None], np.linalg.inv(matrix))[0]
|
| 43 |
+
vectors = radial_vectors(reference_points, matrix, geometry)
|
| 44 |
+
residual = moving_points-base
|
| 45 |
+
weight = np.ones(len(vectors))
|
| 46 |
+
amplitude = 0.
|
| 47 |
+
for _ in range(6):
|
| 48 |
+
amplitude = float(np.sum(weight[:, None]*vectors*residual)/(np.sum(weight[:, None]*vectors**2)+1))
|
| 49 |
+
amplitude = float(np.clip(amplitude, -min(shape)*.04, min(shape)*.04))
|
| 50 |
+
error = np.linalg.norm(residual-amplitude*vectors, axis=1)
|
| 51 |
+
weight = np.minimum(1, 3/np.maximum(error, 1e-6))
|
| 52 |
+
coefficients = fit_mesh(reference_points, moving_points-amplitude*vectors, matrix, shape)
|
| 53 |
+
return RadialMesh(matrix, coefficients, geometry, amplitude, shape)
|
hf_workspace/hf_workspace/backend/experimental/segmentation.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Conservative circle hypotheses for centered crops; uncertain boundaries fail closed.
|
| 2 |
+
|
| 3 |
+
This is an interpretable detector, not a trained eyelid/eyelash segmentation model.
|
| 4 |
+
Native masks exclude boundary margins and saturated reflections. Inspect overlays
|
| 5 |
+
before using its pupil geometry as a deformation prior.
|
| 6 |
+
"""
|
| 7 |
+
from dataclasses import asdict, dataclass
|
| 8 |
+
import cv2
|
| 9 |
+
import numpy as np
|
| 10 |
+
from .preprocessing import glare_mask, iris_mask
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@dataclass(frozen=True)
|
| 14 |
+
class IrisGeometry:
|
| 15 |
+
center: tuple[float, float]
|
| 16 |
+
pupil_radius: float
|
| 17 |
+
iris_radius: float
|
| 18 |
+
boundary_support: float
|
| 19 |
+
limbus_detected: bool = True
|
| 20 |
+
|
| 21 |
+
def to_dict(self):
|
| 22 |
+
return asdict(self)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def detect_geometry(image):
|
| 26 |
+
h, w = image.shape[:2]
|
| 27 |
+
scale = min(1., 600 / max(h, w))
|
| 28 |
+
# Red-channel contrast separates blue pupil reflections from iris tissue better
|
| 29 |
+
# than luminance on these visible-light crops. This is an analysis copy only.
|
| 30 |
+
gray = cv2.resize(image, (round(w*scale), round(h*scale)))[:, :, 2]
|
| 31 |
+
gray = cv2.GaussianBlur(gray, (7, 7), 1.5)
|
| 32 |
+
sh, sw = gray.shape
|
| 33 |
+
size = min(sh, sw)
|
| 34 |
+
yy, xx = np.indices(gray.shape)
|
| 35 |
+
central = np.hypot(xx-sw/2, yy-sh/2) < size*.22
|
| 36 |
+
candidates = []
|
| 37 |
+
# Search several levels: a fixed darkness threshold is unreliable across exposures.
|
| 38 |
+
for percentile in (5, 8, 12, 15, 25, 35, 45):
|
| 39 |
+
threshold = np.percentile(gray[central], percentile)
|
| 40 |
+
binary = (gray <= threshold).astype(np.uint8)
|
| 41 |
+
binary = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, np.ones((7, 7), np.uint8))
|
| 42 |
+
contours, _ = cv2.findContours(binary, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
| 43 |
+
for contour in contours:
|
| 44 |
+
area = cv2.contourArea(contour)
|
| 45 |
+
if not np.pi*(size*.065)**2 < area < np.pi*(size*.24)**2:
|
| 46 |
+
continue
|
| 47 |
+
(cx, cy), radius = cv2.minEnclosingCircle(contour)
|
| 48 |
+
circularity = area / max(np.pi*radius**2, 1)
|
| 49 |
+
offset = np.hypot(cx-sw/2, cy-sh/2)/size
|
| 50 |
+
if circularity > .78 and offset < .18:
|
| 51 |
+
candidates.append((circularity-offset, cx, cy, np.sqrt(area/np.pi)))
|
| 52 |
+
circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, size*.15, param1=40, param2=20,
|
| 53 |
+
minRadius=round(size*.065), maxRadius=round(size*.20))
|
| 54 |
+
if circles is not None:
|
| 55 |
+
angles = np.linspace(0, 2*np.pi, 180, endpoint=False)
|
| 56 |
+
for cx, cy, radius in circles[0]:
|
| 57 |
+
offset = np.hypot(cx-sw/2, cy-sh/2)/size
|
| 58 |
+
if offset > .18:
|
| 59 |
+
continue
|
| 60 |
+
def sample(r):
|
| 61 |
+
return cv2.remap(gray.astype(np.float32), (cx+np.cos(angles)*r).astype(np.float32),
|
| 62 |
+
(cy+np.sin(angles)*r).astype(np.float32), cv2.INTER_LINEAR).ravel()
|
| 63 |
+
contrast = sample(radius*1.15)-sample(radius*.8)
|
| 64 |
+
boundary_support = float((contrast > 10).mean())
|
| 65 |
+
if boundary_support > .7:
|
| 66 |
+
candidates.append((boundary_support-offset, float(cx), float(cy), float(radius)))
|
| 67 |
+
if not candidates:
|
| 68 |
+
return None
|
| 69 |
+
_, cx, cy, pupil = max(candidates)
|
| 70 |
+
# Pupil-only detection is useful even when the outer boundary is occluded.
|
| 71 |
+
# Explicitly report the assumed conservative outer radius; never use it as
|
| 72 |
+
# a measured limbus for radial-model evaluation.
|
| 73 |
+
fallback = IrisGeometry((float(cx/scale), float(cy/scale)), float(pupil/scale), min(h,w)*.4, 0., False)
|
| 74 |
+
angles = np.linspace(0, 2*np.pi, 180, endpoint=False)
|
| 75 |
+
radii = np.arange(max(pupil*1.7, size*.29), size*.49, .5)
|
| 76 |
+
if len(radii) < 20:
|
| 77 |
+
return fallback
|
| 78 |
+
mx = (cx+np.cos(angles[:, None])*radii).astype(np.float32)
|
| 79 |
+
my = (cy+np.sin(angles[:, None])*radii).astype(np.float32)
|
| 80 |
+
profile = cv2.remap(gray.astype(np.float32), mx, my, cv2.INTER_LINEAR, borderMode=cv2.BORDER_REFLECT)
|
| 81 |
+
# Limbus transitions toward brighter sclera; both contrast and angular support matter.
|
| 82 |
+
gradient = cv2.GaussianBlur(profile, (11, 1), 2)[:, 8:] - cv2.GaussianBlur(profile, (11, 1), 2)[:, :-8]
|
| 83 |
+
peaks = gradient.argmax(axis=1)
|
| 84 |
+
strength = gradient[np.arange(len(angles)), peaks]
|
| 85 |
+
boundaries = radii[peaks+4]
|
| 86 |
+
valid = strength > 12
|
| 87 |
+
if valid.sum() < 90:
|
| 88 |
+
return fallback
|
| 89 |
+
outer = float(np.median(boundaries[valid]))
|
| 90 |
+
support = float((valid & (np.abs(boundaries-outer) < size*.035)).mean())
|
| 91 |
+
if support < .60 or not 1.8 < outer/pupil < 6:
|
| 92 |
+
return fallback
|
| 93 |
+
return IrisGeometry((float(cx/scale), float(cy/scale)), float(pupil/scale), outer/scale, support)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def adaptive_mask(image, geometry=None):
|
| 97 |
+
geometry = detect_geometry(image) if geometry is None else geometry
|
| 98 |
+
if geometry is None:
|
| 99 |
+
return iris_mask(image) & ~glare_mask(image), None
|
| 100 |
+
y, x = np.indices(image.shape[:2], dtype=np.float32)
|
| 101 |
+
radius = np.hypot(x-geometry.center[0], y-geometry.center[1])
|
| 102 |
+
margin = min(image.shape[:2])*.015
|
| 103 |
+
mask = (radius > geometry.pupil_radius+margin) & (radius < geometry.iris_radius-margin)
|
| 104 |
+
return mask & ~glare_mask(image), geometry
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def geometry_overlay(image, geometry):
|
| 108 |
+
out = image.copy()
|
| 109 |
+
if geometry is not None:
|
| 110 |
+
center = tuple(round(v) for v in geometry.center)
|
| 111 |
+
for radius, detected in ((geometry.pupil_radius, True), (geometry.iris_radius, geometry.limbus_detected)):
|
| 112 |
+
color = (0, 255, 0) if detected else (0, 165, 255)
|
| 113 |
+
cv2.circle(out, center, round(radius), color, max(2, image.shape[0]//400))
|
| 114 |
+
return out
|
hf_workspace/hf_workspace/backend/experimental/settings.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Validated server-side switches for controlled learned-engine experiments."""
|
| 2 |
+
from dataclasses import dataclass
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
@dataclass(frozen=True)
|
| 7 |
+
class LearnedSettings:
|
| 8 |
+
matcher: str = 'loftr'
|
| 9 |
+
max_size: int = 800
|
| 10 |
+
patches: str = 'single'
|
| 11 |
+
adaptive_mask: bool = False
|
| 12 |
+
|
| 13 |
+
@classmethod
|
| 14 |
+
def from_env(cls):
|
| 15 |
+
matcher = os.environ.get('IRIS_MATCHER', 'loftr')
|
| 16 |
+
patches = os.environ.get('IRIS_PATCH_VALIDATION', 'single')
|
| 17 |
+
adaptive = os.environ.get('IRIS_ADAPTIVE_MASK', 'false').lower()
|
| 18 |
+
try:
|
| 19 |
+
size = int(os.environ.get('IRIS_MATCH_MAX_SIZE', '800' if matcher=='loftr' else '1600'))
|
| 20 |
+
except ValueError as exc:
|
| 21 |
+
raise RuntimeError('IRIS_MATCH_MAX_SIZE must be an integer.') from exc
|
| 22 |
+
if matcher not in {'loftr', 'lightglue'} or patches not in {'single', 'multiscale', 'geometry'}:
|
| 23 |
+
raise RuntimeError('Invalid learned matcher or patch-validation configuration.')
|
| 24 |
+
if adaptive not in {'true', 'false'}:
|
| 25 |
+
raise RuntimeError('IRIS_ADAPTIVE_MASK must be true or false.')
|
| 26 |
+
if not 400 <= size <= (1200 if matcher=='loftr' else 2200):
|
| 27 |
+
raise RuntimeError('IRIS_MATCH_MAX_SIZE exceeds the supported range.')
|
| 28 |
+
return cls(matcher, size, patches, adaptive=='true')
|
hf_workspace/hf_workspace/hf_workspace/PRODUCTION_READINESS.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Production readiness: remaining acceptance gates
|
| 2 |
+
|
| 3 |
+
## Implemented in this iteration
|
| 4 |
+
|
| 5 |
+
Valid uploaded pairs produce a review response even if geometric alignment fails. Failed registration preserves both originals, reports the reason, offers next steps, and does not invent an aligned composite. Match support is explicitly defined, with null when not measurable. Successful numerical registration still requires visual review. Malformed uploads and service failures remain errors; the UI does not conceal them as results.
|
| 6 |
+
|
| 7 |
+
## Priority 1: establish the meaning of quality
|
| 8 |
+
|
| 9 |
+
Use independently marked matching fibers/crypts to measure median and tail landmark error on the real photographs, along with valid iris coverage and deformation limits. Establish acceptable thresholds with the client at native resolution. Separate development pairs from a new held-out real test set. Calibration must precede any confidence percentage or automatic “ready” label. Neither inlier percentage nor agreement with the matcher's own predictions establishes anatomical correctness.
|
| 10 |
+
|
| 11 |
+
## Priority 2: usable alignment workflow
|
| 12 |
+
|
| 13 |
+
Add iris/pupil/eyelid/glare masking with corrections. Promote the experimental ML matcher only behind an explicit reviewed mode and the validated acceptance gates. Provide manual landmarks for difficult pairs; never force an unsupported warp. Keep matching features separate from source pixels, and only borrow glare-free source regions after adjacent geometry is verified. Save the composed transformation, source contribution masks and versioned settings with each result. The experimental model is now an opt-in API mode for confirmed centered square crops; it is not a production-approved or full-frame pipeline.
|
| 14 |
+
|
| 15 |
+
## Priority 3: service and deployment
|
| 16 |
+
|
| 17 |
+
Complete VM Docker and Vercel configuration, explicit backend HTTPS URL and exact allowed frontend origins. No VM or Vercel domains have been supplied yet. Move processing from long HTTP requests and base64-heavy responses to a bounded worker queue, job-status endpoints and private downloadable artifacts. Add job timeout/cancellation/retry semantics, memory limits, request limits, and health monitoring. Separate invalid input, alignment rejection and infrastructure failure in the API and telemetry.
|
| 18 |
+
|
| 19 |
+
For CPU-heavy jobs, FastAPI's [background-task guidance](https://fastapi.tiangolo.com/tutorial/background-tasks/#caveat) describes when a separate worker system such as Celery is appropriate. Its [deployment concepts](https://fastapi.tiangolo.com/deployment/concepts/) cover HTTPS, restarts, worker replication and memory. The current app has not implemented these production facilities.
|
| 20 |
+
|
| 21 |
+
## Priority 4: client data and release checks
|
| 22 |
+
|
| 23 |
+
Add authentication, per-user access to results, private upload storage and defined deletion/retention. Load-test the largest supported images and concurrent jobs on the intended VM. Keep customer samples and research artifacts out of public static assets and container build context. Pin/version model weights and transformations. Establish rollback and regression tests on an approved real-image validation set.
|
| 24 |
+
|
| 25 |
+
Production release remains blocked on real-data accuracy and these operational requirements. Better error presentation alone does not make the registration engine production-ready.
|
hf_workspace/hf_workspace/hf_workspace/RESEARCH.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Real-iris research iteration
|
| 2 |
+
|
| 3 |
+
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.
|
| 4 |
+
|
| 5 |
+
## Findings
|
| 6 |
+
|
| 7 |
+
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.
|
| 8 |
+
|
| 9 |
+
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.
|
| 10 |
+
|
| 11 |
+
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.
|
| 12 |
+
|
| 13 |
+
## Reproduce
|
| 14 |
+
|
| 15 |
+
```sh
|
| 16 |
+
.venv/bin/pip install -r requirements-ml.txt
|
| 17 |
+
mkdir -p models
|
| 18 |
+
curl -fL https://huggingface.co/kornia/loftr/resolve/main/loftr_outdoor.ckpt -o models/loftr_outdoor.ckpt
|
| 19 |
+
.venv/bin/python scripts/evaluate_matchers.py
|
| 20 |
+
.venv/bin/python scripts/validate_matcher_patches.py
|
| 21 |
+
.venv/bin/python scripts/refine_client_research.py
|
| 22 |
+
.venv/bin/python scripts/evaluate_mesh.py
|
| 23 |
+
.venv/bin/python scripts/create_research_review.py
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
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.
|
| 27 |
+
|
| 28 |
+
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`.
|
| 29 |
+
|
| 30 |
+
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.
|
| 31 |
+
|
| 32 |
+
## Review before promotion
|
| 33 |
+
|
| 34 |
+
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:
|
| 35 |
+
|
| 36 |
+
```sh
|
| 37 |
+
.venv/bin/python scripts/score_landmarks.py /path/to/iris-landmarks-2.json
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
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.
|
| 41 |
+
|
| 42 |
+
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.
|
| 43 |
+
|
| 44 |
+
## Integrated evaluation and UI (23 September)
|
| 45 |
+
|
| 46 |
+
`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.
|
| 47 |
+
|
| 48 |
+
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.
|
| 49 |
+
|
| 50 |
+
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.
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""Research pipelines; not enabled in the production API."""
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/evaluation.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Spatial cross-validation of automatic correspondences, not anatomical ground truth."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from .mesh import fit_mesh, basis
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def fit_geometry(reference_points, moving_points, shape, ransac_threshold=4):
|
| 8 |
+
if len(reference_points) < 24:
|
| 9 |
+
raise ValueError('At least 24 verified correspondences are needed for geometry fitting.')
|
| 10 |
+
matrix, inliers = cv2.findHomography(moving_points, reference_points, cv2.USAC_MAGSAC, ransac_threshold)
|
| 11 |
+
if matrix is None or inliers is None or not np.isfinite(matrix).all() or inliers.sum() < 12 or inliers.mean() < .3:
|
| 12 |
+
raise ValueError('Correspondences do not support stable geometry.')
|
| 13 |
+
h,w=shape
|
| 14 |
+
corners=np.float32([[0,0],[w,0],[w,h],[0,h]])
|
| 15 |
+
denominator=(matrix @ np.c_[corners,np.ones(4)].T)[2]
|
| 16 |
+
projected=cv2.perspectiveTransform(corners[None],matrix)[0]
|
| 17 |
+
if np.any(denominator<=0) or not .5<cv2.contourArea(projected,oriented=True)/(h*w)<2:
|
| 18 |
+
raise ValueError('Unstable or reflected geometry was rejected.')
|
| 19 |
+
coverage=cv2.contourArea(cv2.convexHull(reference_points[inliers.ravel().astype(bool)]))/(h*w)
|
| 20 |
+
if coverage<.08:
|
| 21 |
+
raise ValueError('Correspondences cover too little of the iris crop.')
|
| 22 |
+
coefficients=fit_mesh(reference_points,moving_points,matrix,shape)
|
| 23 |
+
return matrix,coefficients,inliers,coverage
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def predict_points(points,matrix,coefficients,shape):
|
| 27 |
+
base=cv2.perspectiveTransform(points[None],np.linalg.inv(matrix))[0]
|
| 28 |
+
return base+basis(points,shape,coefficients.shape[0]) @ coefficients.reshape(-1,2)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def evaluate_correspondences(reference_points,moving_points,shape):
|
| 32 |
+
result=dict(kind='automatic_spatial_cross_validation',count=len(reference_points),scored_count=0,
|
| 33 |
+
failed_folds=[],within_px_percent=None,median_px=None,p95_px=None,
|
| 34 |
+
description='Consistency against patch-verified automatic correspondences held out of each geometric fit. Not independently verified accuracy. Unscored points count as outside each tolerance.')
|
| 35 |
+
if len(reference_points)<60:
|
| 36 |
+
result['reason']='Too few verified correspondences for five-fold evaluation (minimum 60).'
|
| 37 |
+
return result
|
| 38 |
+
# Distributed 150px cells at the benchmark resolution; fixed before evaluation.
|
| 39 |
+
cell=max(shape)/2200*150
|
| 40 |
+
folds=((reference_points[:,0]//cell+reference_points[:,1]//cell).astype(int)%5)
|
| 41 |
+
errors=np.full(len(reference_points),np.inf)
|
| 42 |
+
for fold in range(5):
|
| 43 |
+
test=folds==fold;train=~test
|
| 44 |
+
if test.sum()<6 or train.sum()<24:
|
| 45 |
+
result['failed_folds'].append(fold);continue
|
| 46 |
+
try:
|
| 47 |
+
matrix,coef,_,_=fit_geometry(reference_points[train],moving_points[train],shape)
|
| 48 |
+
predicted=predict_points(reference_points[test],matrix,coef,shape)
|
| 49 |
+
errors[test]=np.linalg.norm(predicted-moving_points[test],axis=1)
|
| 50 |
+
except (ValueError,cv2.error,np.linalg.LinAlgError):
|
| 51 |
+
result['failed_folds'].append(fold)
|
| 52 |
+
finite=np.isfinite(errors);result['scored_count']=int(finite.sum())
|
| 53 |
+
result['within_px_percent']={str(t):round(float((errors<=t).mean()*100),2) for t in [1,2,3,5]}
|
| 54 |
+
if finite.all():
|
| 55 |
+
result.update(median_px=float(np.median(errors)),p95_px=float(np.percentile(errors,95)))
|
| 56 |
+
else:
|
| 57 |
+
result['reason']='One or more folds could not be evaluated; no complete tail-error estimate.'
|
| 58 |
+
return result
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/matching.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Classical and learned correspondence adapters with explicit offline weights."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
+
from .preprocessing import iris_mask,glare_mask
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def sift_matches(reference,moving):
|
| 9 |
+
points=[];descriptors=[]
|
| 10 |
+
for im in (reference,moving):
|
| 11 |
+
factor=1400/max(im.shape[:2]);size=(round(im.shape[1]*factor),round(im.shape[0]*factor))
|
| 12 |
+
small=cv2.resize(im,size)
|
| 13 |
+
g=cv2.cvtColor(small,cv2.COLOR_BGR2GRAY)
|
| 14 |
+
g=cv2.createCLAHE(clipLimit=2,tileGridSize=(12,12)).apply(g)
|
| 15 |
+
mask=(iris_mask(small)&~glare_mask(small)).astype(np.uint8)*255
|
| 16 |
+
kp,des=cv2.SIFT_create(nfeatures=7000,contrastThreshold=.015).detectAndCompute(g,mask)
|
| 17 |
+
points.append(np.float32([k.pt for k in kp])/factor);descriptors.append(des)
|
| 18 |
+
if any(d is None for d in descriptors):return np.empty((0,2),np.float32),np.empty((0,2),np.float32)
|
| 19 |
+
pairs=cv2.BFMatcher().knnMatch(descriptors[0],descriptors[1],k=2)
|
| 20 |
+
good=[p[0] for p in pairs if len(p)==2 and p[0].distance<.72*p[1].distance]
|
| 21 |
+
return points[0][[m.queryIdx for m in good]],points[1][[m.trainIdx for m in good]]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class LearnedMatcher:
|
| 25 |
+
def __init__(self,weights,device='cpu',max_size=800):
|
| 26 |
+
import torch
|
| 27 |
+
from kornia.feature import LoFTR
|
| 28 |
+
self.torch=torch;self.device=device
|
| 29 |
+
if not 400 <= max_size <= 1200:raise ValueError('LoFTR resolution must be between 400 and 1200.')
|
| 30 |
+
self.max_size=max_size
|
| 31 |
+
torch.set_num_threads(4)
|
| 32 |
+
self.model=LoFTR(pretrained=None).eval().to(device)
|
| 33 |
+
state=torch.load(Path(weights),map_location='cpu',weights_only=True)
|
| 34 |
+
self.model.load_state_dict(state['state_dict'])
|
| 35 |
+
|
| 36 |
+
def __call__(self,reference,moving,masks=None):
|
| 37 |
+
tensors=[];scales=[]
|
| 38 |
+
for im in (reference,moving):
|
| 39 |
+
h,w=im.shape[:2];factor=min(1,self.max_size/max(h,w));size=(max(8,int(w*factor)//8*8),max(8,int(h*factor)//8*8))
|
| 40 |
+
g=cv2.cvtColor(cv2.resize(im,size),cv2.COLOR_BGR2GRAY)
|
| 41 |
+
g=cv2.createCLAHE(clipLimit=2,tileGridSize=(12,12)).apply(g)
|
| 42 |
+
tensors.append(self.torch.from_numpy(g.copy()).float()[None,None].to(self.device)/255)
|
| 43 |
+
scales.append(np.array([w/size[0],h/size[1]],np.float32))
|
| 44 |
+
with self.torch.inference_mode():
|
| 45 |
+
out=self.model({'image0':tensors[0],'image1':tensors[1]})
|
| 46 |
+
a=out['keypoints0'].cpu().numpy()*scales[0];b=out['keypoints1'].cpu().numpy()*scales[1]
|
| 47 |
+
keep=out['confidence'].cpu().numpy()>.7
|
| 48 |
+
for index,(im,p) in enumerate([(reference,a),(moving,b)]):
|
| 49 |
+
mask=(iris_mask(im) if masks is None else masks[index])&~glare_mask(im)
|
| 50 |
+
x=np.clip(p[:,0].astype(int),0,im.shape[1]-1);y=np.clip(p[:,1].astype(int),0,im.shape[0]-1)
|
| 51 |
+
keep &= mask[y,x]
|
| 52 |
+
return a[keep],b[keep]
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/mesh.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Regularized bilinear correspondence mesh with robust residual fitting.
|
| 2 |
+
|
| 3 |
+
Fits training correspondences only. Callers must validate held-out matches and
|
| 4 |
+
inspect image detail; estimated matches are not anatomical ground truth.
|
| 5 |
+
"""
|
| 6 |
+
import cv2
|
| 7 |
+
import numpy as np
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def basis(points,shape,side=9):
|
| 11 |
+
h,w=shape
|
| 12 |
+
q=points/np.float32([w-1,h-1])*(side-1)
|
| 13 |
+
q=np.clip(q,0,side-1)
|
| 14 |
+
ix=np.minimum(np.floor(q).astype(int),side-2);frac=q-ix
|
| 15 |
+
a=np.zeros((len(points),side*side),np.float64)
|
| 16 |
+
for dy,dx in [(0,0),(0,1),(1,0),(1,1)]:
|
| 17 |
+
weight=(frac[:,0] if dx else 1-frac[:,0])*(frac[:,1] if dy else 1-frac[:,1])
|
| 18 |
+
a[np.arange(len(points)),(ix[:,1]+dy)*side+ix[:,0]+dx]=weight
|
| 19 |
+
return a
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def fit_mesh(reference_points,moving_points,homography,shape,side=9):
|
| 23 |
+
if len(reference_points)<24:raise ValueError('Too few mesh constraints')
|
| 24 |
+
inverse=np.linalg.inv(homography)
|
| 25 |
+
prediction=cv2.perspectiveTransform(reference_points[None],inverse)[0]
|
| 26 |
+
residual=moving_points-prediction
|
| 27 |
+
a=basis(reference_points,shape,side)
|
| 28 |
+
# Penalize second differences, favoring smooth local motion over isolated bends.
|
| 29 |
+
penalties=[]
|
| 30 |
+
for y in range(side):
|
| 31 |
+
for x in range(side):
|
| 32 |
+
for dy,dx in [(0,1),(1,0)]:
|
| 33 |
+
if y+2*dy<side and x+2*dx<side:
|
| 34 |
+
row=np.zeros(side*side)
|
| 35 |
+
for offset,value in [(0,1),(1,-2),(2,1)]:row[(y+offset*dy)*side+x+offset*dx]=value
|
| 36 |
+
penalties.append(row)
|
| 37 |
+
lap=np.array(penalties);regularizer=2*(lap.T@lap)+.03*np.eye(side*side)
|
| 38 |
+
weight=np.ones(len(a))
|
| 39 |
+
for _ in range(6):
|
| 40 |
+
coef=np.linalg.solve(a.T@(weight[:,None]*a)+regularizer,a.T@(weight[:,None]*residual))
|
| 41 |
+
err=np.linalg.norm(a@coef-residual,axis=1)
|
| 42 |
+
weight=np.minimum(1,3/np.maximum(err,1e-6))
|
| 43 |
+
return coef.reshape(side,side,2).astype(np.float32)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def interpolate_mesh(coefficients,shape):
|
| 47 |
+
"""Exact separable bilinear interpolation, consistent with point predictions.
|
| 48 |
+
|
| 49 |
+
cv2.remap quantizes fractional grid coordinates to 1/32. On a sparse 9x9
|
| 50 |
+
deformation grid that creates displacement steps and spurious Jacobian spikes.
|
| 51 |
+
"""
|
| 52 |
+
h,w=shape;side=coefficients.shape[0]
|
| 53 |
+
x=np.linspace(0,side-1,w,dtype=np.float32)
|
| 54 |
+
y=np.linspace(0,side-1,h,dtype=np.float32)
|
| 55 |
+
ix=np.minimum(x.astype(int),side-2);iy=np.minimum(y.astype(int),side-2)
|
| 56 |
+
fx=(x-ix).astype(np.float32)[None,:,None]
|
| 57 |
+
fy=(y-iy).astype(np.float32)[:,None,None]
|
| 58 |
+
rows=coefficients[:,ix]*(1-fx)+coefficients[:,ix+1]*fx
|
| 59 |
+
return rows[iy]*(1-fy)+rows[iy+1]*fy
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def dense_mesh(coefficients,homography,shape):
|
| 63 |
+
h,w=shape;side=coefficients.shape[0]
|
| 64 |
+
y,x=np.indices((h,w),dtype=np.float32)
|
| 65 |
+
delta=interpolate_mesh(coefficients,shape)
|
| 66 |
+
inv=np.linalg.inv(homography);den=inv[2,0]*x+inv[2,1]*y+inv[2,2]
|
| 67 |
+
mx=((inv[0,0]*x+inv[0,1]*y+inv[0,2])/den).astype(np.float32)+delta[...,0]
|
| 68 |
+
my=((inv[1,0]*x+inv[1,1]*y+inv[1,2])/den).astype(np.float32)+delta[...,1]
|
| 69 |
+
uy,ux=np.gradient(delta[...,0]);vy,vx=np.gradient(delta[...,1])
|
| 70 |
+
jac=(1+ux)*(1+vy)-uy*vx
|
| 71 |
+
strain=np.sqrt(ux**2+uy**2+vx**2+vy**2)
|
| 72 |
+
mapxy,mapxx=np.gradient(mx);mapyy,mapyx=np.gradient(my)
|
| 73 |
+
full_jac=mapxx*mapyy-mapxy*mapyx
|
| 74 |
+
good=(full_jac>0)&np.isfinite(full_jac)&(mx>=0)&(mx<w)&(my>=0)&(my<h)&(np.linalg.norm(delta,axis=2)<35)&(jac>.65)&(jac<1.5)&(strain<.45)
|
| 75 |
+
return np.stack([mx,my],-1),good,delta
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/patch_validation.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Validate coarse correspondences against native-resolution image patches."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from .preprocessing import normalize
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def validate_patches(reference,moving,ref_points,mov_points,multiscale=False):
|
| 8 |
+
a,b=normalize(reference),normalize(moving)
|
| 9 |
+
p=ref_points.astype(np.float32).reshape(-1,1,2)
|
| 10 |
+
guess=mov_points.astype(np.float32).reshape(-1,1,2)
|
| 11 |
+
if len(p)==0:return ref_points,mov_points
|
| 12 |
+
args=dict(winSize=(41,41),maxLevel=2,criteria=(cv2.TERM_CRITERIA_EPS|cv2.TERM_CRITERIA_COUNT,50,.005),flags=cv2.OPTFLOW_USE_INITIAL_FLOW)
|
| 13 |
+
q,ok,_=cv2.calcOpticalFlowPyrLK(a,b,p,guess.copy(),**args)
|
| 14 |
+
reverse,back,_=cv2.calcOpticalFlowPyrLK(b,a,q,p.copy(),**args)
|
| 15 |
+
fb=np.linalg.norm(reverse[:,0]-p[:,0],axis=1)
|
| 16 |
+
shift=np.linalg.norm(q[:,0]-guess[:,0],axis=1)
|
| 17 |
+
keep=ok.ravel().astype(bool)&back.ravel().astype(bool)&(fb<1)&(shift<12)
|
| 18 |
+
h,w=b.shape
|
| 19 |
+
margin=32 if multiscale else 25
|
| 20 |
+
keep &= np.isfinite(q[:,0]).all(axis=1)&np.isfinite(reverse[:,0]).all(axis=1)
|
| 21 |
+
keep &= (q[:,0,0]>margin)&(q[:,0,0]<w-margin)&(q[:,0,1]>margin)&(q[:,0,1]<h-margin)
|
| 22 |
+
rh,rw=a.shape
|
| 23 |
+
keep &= (p[:,0,0]>margin)&(p[:,0,0]<rw-margin)&(p[:,0,1]>margin)&(p[:,0,1]<rh-margin)
|
| 24 |
+
for i in np.flatnonzero(keep):
|
| 25 |
+
scores=[]
|
| 26 |
+
for size in ((15,31,61) if multiscale else (31,)):
|
| 27 |
+
aa=cv2.getRectSubPix(a,(size,size),tuple(p[i,0])).astype(np.float32)
|
| 28 |
+
bb=cv2.getRectSubPix(b,(size,size),tuple(q[i,0])).astype(np.float32)
|
| 29 |
+
aa-=aa.mean();bb-=bb.mean()
|
| 30 |
+
scores.append(float((aa*bb).sum()/max(np.linalg.norm(aa)*np.linalg.norm(bb),1)))
|
| 31 |
+
keep[i]=np.median(scores)>.65 and min(scores)>(.4 if multiscale else .65)
|
| 32 |
+
return p[keep,0],q[keep,0]
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def validate_geometry_patches(reference, moving, ref_points, mov_points, multiscale=True):
|
| 36 |
+
"""Validate in a common viewpoint, then return original moving coordinates.
|
| 37 |
+
|
| 38 |
+
Translation-only patches can reject correct matches after camera rotation.
|
| 39 |
+
This warp is an analysis copy, never a source for the delivered color image.
|
| 40 |
+
"""
|
| 41 |
+
from .evaluation import fit_geometry
|
| 42 |
+
try:
|
| 43 |
+
# Coarse matches initialize an analysis copy only. Final fitting retains
|
| 44 |
+
# its 4px RANSAC threshold and unchanged held-out/geometry gates.
|
| 45 |
+
matrix, _, _, _ = fit_geometry(ref_points, mov_points, reference.shape[:2], ransac_threshold=12)
|
| 46 |
+
except (ValueError, cv2.error, np.linalg.LinAlgError):
|
| 47 |
+
return np.empty((0, 2), np.float32), np.empty((0, 2), np.float32)
|
| 48 |
+
h, w = reference.shape[:2]
|
| 49 |
+
analysis_image = cv2.warpPerspective(moving, matrix, (w, h))
|
| 50 |
+
guesses = cv2.perspectiveTransform(mov_points[None], matrix)[0]
|
| 51 |
+
a, b = validate_patches(reference, analysis_image, ref_points, guesses, multiscale=multiscale)
|
| 52 |
+
if not len(a):
|
| 53 |
+
return a, b
|
| 54 |
+
b = cv2.perspectiveTransform(b[None], np.linalg.inv(matrix))[0]
|
| 55 |
+
valid = np.isfinite(b).all(axis=1)&(b[:, 0]>32)&(b[:, 0]<moving.shape[1]-32)&(b[:, 1]>32)&(b[:, 1]<moving.shape[0]-32)
|
| 56 |
+
return a[valid], b[valid]
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/preprocessing.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Conservative masks for manually centered iris crops, not automatic segmentation."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def iris_mask(image):
|
| 7 |
+
h,w=image.shape[:2]
|
| 8 |
+
y,x=np.indices((h,w),dtype=np.float32)
|
| 9 |
+
radius=np.hypot(x-w/2,y-h/2)/min(h,w)
|
| 10 |
+
return (radius>.16)&(radius<.40)
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def glare_mask(image):
|
| 14 |
+
# Saturated near-white highlights; ordinary bright colored fibers are retained.
|
| 15 |
+
bright=(np.min(image,axis=2)>190)&(np.max(image,axis=2)>240)
|
| 16 |
+
size=max(3,round(min(image.shape[:2])*.009))
|
| 17 |
+
return cv2.dilate(bright.astype(np.uint8),np.ones((size,size),np.uint8)).astype(bool)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def normalize(image):
|
| 21 |
+
gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY).astype(np.float32)
|
| 22 |
+
mean=cv2.GaussianBlur(gray,(0,0),7)
|
| 23 |
+
variance=cv2.GaussianBlur((gray-mean)**2,(0,0),7)
|
| 24 |
+
return np.clip(128+32*(gray-mean)/np.sqrt(variance+20),0,255).astype(np.uint8)
|
hf_workspace/hf_workspace/hf_workspace/backend/experimental/refinement.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Iris-only local refinement with illumination-normalized correspondence copies."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from .preprocessing import iris_mask,glare_mask,normalize
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def local_map(reference,moving,homography):
|
| 8 |
+
h,w=reference.shape[:2]
|
| 9 |
+
factor=min(1,1200/max(h,w));size=(round(w*factor),round(h*factor))
|
| 10 |
+
global_image=cv2.warpPerspective(moving,homography,(w,h))
|
| 11 |
+
a=cv2.resize(reference,size);b=cv2.resize(global_image,size)
|
| 12 |
+
na,nb=normalize(a),normalize(b)
|
| 13 |
+
valid=iris_mask(a)&~glare_mask(a)&~glare_mask(b)
|
| 14 |
+
def flow(x,y):return cv2.calcOpticalFlowFarneback(x,y,None,.5,5,35,6,7,1.5,0)
|
| 15 |
+
f=cv2.GaussianBlur(flow(na,nb),(0,0),2)
|
| 16 |
+
rev=flow(nb,na)
|
| 17 |
+
yy,xx=np.indices(na.shape,dtype=np.float32)
|
| 18 |
+
mx,my=xx+f[...,0],yy+f[...,1]
|
| 19 |
+
fb=np.linalg.norm(f+cv2.remap(rev,mx,my,cv2.INTER_LINEAR),axis=2)
|
| 20 |
+
uy,ux=np.gradient(f[...,0]);vy,vx=np.gradient(f[...,1]);jac=(1+ux)*(1+vy)-uy*vx
|
| 21 |
+
strain=np.sqrt(ux**2+uy**2+vx**2+vy**2)
|
| 22 |
+
aligned=cv2.remap(nb,mx,my,cv2.INTER_LINEAR)
|
| 23 |
+
err0=cv2.GaussianBlur(cv2.absdiff(na,nb).astype(np.float32),(0,0),2)
|
| 24 |
+
err1=cv2.GaussianBlur(cv2.absdiff(na,aligned).astype(np.float32),(0,0),2)
|
| 25 |
+
sampling_valid=cv2.remap(valid.astype(np.uint8),mx,my,cv2.INTER_NEAREST)>0
|
| 26 |
+
trust=valid&sampling_valid&(fb<1)&(np.linalg.norm(f,axis=2)<18)&(jac>.65)&(jac<1.5)&(strain<.45)&(err1<18)&(err1<=err0+1)
|
| 27 |
+
trust=cv2.erode(trust.astype(np.uint8),np.ones((5,5),np.uint8)).astype(bool)
|
| 28 |
+
fraction=float(trust.sum()/max(valid.sum(),1))
|
| 29 |
+
improvement=float(1-err1[trust].mean()/max(err0[trust].mean(),.01)) if trust.any() else 0
|
| 30 |
+
# The same support and improvement gates as the original local stage.
|
| 31 |
+
apply=fraction>.45 and improvement>.15
|
| 32 |
+
full=cv2.resize(f,(w,h))/factor if apply else np.zeros((h,w,2),np.float32)
|
| 33 |
+
trusted=cv2.resize(trust.astype(np.uint8),(w,h),interpolation=cv2.INTER_NEAREST).astype(bool)
|
| 34 |
+
y,x=np.indices((h,w),dtype=np.float32);x+=full[...,0];y+=full[...,1]
|
| 35 |
+
inv=np.linalg.inv(homography);den=inv[2,0]*x+inv[2,1]*y+inv[2,2]
|
| 36 |
+
mapx=((inv[0,0]*x+inv[0,1]*y+inv[0,2])/den).astype(np.float32)
|
| 37 |
+
mapy=((inv[1,0]*x+inv[1,1]*y+inv[1,2])/den).astype(np.float32)
|
| 38 |
+
return np.stack([mapx,mapy],-1),trusted,dict(applied=apply,trusted_iris_fraction=fraction,improvement=improvement),global_image
|
hf_workspace/hf_workspace/hf_workspace/backend/learned_registration.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Opt-in learned registration for explicitly confirmed, centered square iris crops."""
|
| 2 |
+
import hashlib
|
| 3 |
+
import os
|
| 4 |
+
import time
|
| 5 |
+
from functools import lru_cache
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import cv2
|
| 8 |
+
import numpy as np
|
| 9 |
+
from .common import RegistrationError
|
| 10 |
+
from .compositing import compose
|
| 11 |
+
from .experimental.matching import LearnedMatcher
|
| 12 |
+
from .experimental.patch_validation import validate_patches,validate_geometry_patches
|
| 13 |
+
from .experimental.settings import LearnedSettings
|
| 14 |
+
from .experimental.segmentation import adaptive_mask,geometry_overlay
|
| 15 |
+
from .experimental.preprocessing import iris_mask,glare_mask
|
| 16 |
+
from .experimental.evaluation import evaluate_correspondences,fit_geometry
|
| 17 |
+
from .experimental.mesh import dense_mesh
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@lru_cache(maxsize=1)
|
| 21 |
+
def get_matcher():
|
| 22 |
+
settings=LearnedSettings.from_env()
|
| 23 |
+
if settings.matcher=='lightglue':
|
| 24 |
+
try:
|
| 25 |
+
from .experimental.lightglue_matching import LightGlueMatcher
|
| 26 |
+
return LightGlueMatcher(os.environ.get('IRIS_WEIGHTS_DIR',str(Path(__file__).resolve().parents[1]/'models')),max_size=settings.max_size)
|
| 27 |
+
except (ImportError,FileNotFoundError) as exc:
|
| 28 |
+
raise RuntimeError('LightGlue dependencies or offline weights are not installed.') from exc
|
| 29 |
+
path=Path(os.environ.get('IRIS_MODEL_PATH',str(Path(__file__).resolve().parents[1]/'models/loftr_outdoor.ckpt')))
|
| 30 |
+
if not path.is_file():raise RuntimeError('Learned matcher weights are not installed on this server.')
|
| 31 |
+
if hashlib.sha256(path.read_bytes()).hexdigest()!='21f5bec5968178e8bc8b7633441836fe5de4f47d861dd2cd7dc38e271b0479ec':
|
| 32 |
+
raise RuntimeError('Learned matcher checkpoint failed integrity verification.')
|
| 33 |
+
try:return LearnedMatcher(path,max_size=settings.max_size)
|
| 34 |
+
except ImportError as exc:raise RuntimeError('Learned matcher dependencies are not installed.') from exc
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def register_learned(reference,moving,exposure=True,local=True):
|
| 38 |
+
started=time.perf_counter()
|
| 39 |
+
if not local:raise RegistrationError("The experimental learned engine requires local refinement.")
|
| 40 |
+
h,w=reference.shape[:2]
|
| 41 |
+
if reference.shape!=moving.shape or h!=w or not 400<=w<=3000:
|
| 42 |
+
raise RegistrationError('Experimental alignment needs equally sized, centered square iris crops between 400 and 3000 pixels.')
|
| 43 |
+
settings=LearnedSettings.from_env()
|
| 44 |
+
geometries=(None,None)
|
| 45 |
+
if settings.adaptive_mask:
|
| 46 |
+
(roi,ref_geometry),(source_roi,mov_geometry)=adaptive_mask(reference),adaptive_mask(moving)
|
| 47 |
+
geometries=(ref_geometry,mov_geometry)
|
| 48 |
+
raw_ref,raw_mov=get_matcher()(reference,moving,masks=(roi,source_roi))
|
| 49 |
+
else:
|
| 50 |
+
roi,source_roi=iris_mask(reference),iris_mask(moving)
|
| 51 |
+
raw_ref,raw_mov=get_matcher()(reference,moving)
|
| 52 |
+
if settings.patches=='geometry':
|
| 53 |
+
ref,mov=validate_geometry_patches(reference,moving,raw_ref,raw_mov)
|
| 54 |
+
elif settings.patches=='multiscale':
|
| 55 |
+
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov,multiscale=True)
|
| 56 |
+
else:
|
| 57 |
+
ref,mov=validate_patches(reference,moving,raw_ref,raw_mov)
|
| 58 |
+
evaluation=evaluate_correspondences(ref,mov,(h,w))
|
| 59 |
+
metrics=dict(matches=len(raw_ref),verified_matches=len(ref),inliers=None,inlier_ratio=None,
|
| 60 |
+
patch_survival_percent=round(100*len(ref)/max(len(raw_ref),1),1),evaluation=evaluation,
|
| 61 |
+
engine='learned_experimental',settings=dict(matcher=settings.matcher,max_size=settings.max_size,patches=settings.patches,adaptive_mask=settings.adaptive_mask),
|
| 62 |
+
segmentation=[g.to_dict() if g is not None else None for g in geometries])
|
| 63 |
+
# Preview eligibility is NOT a production accuracy or 95% success gate.
|
| 64 |
+
if evaluation['p95_px'] is None or evaluation['median_px']>=4 or evaluation['p95_px']>=12:
|
| 65 |
+
raise RegistrationError('The learned alignment did not pass correspondence validation. Reference preserved.',metrics)
|
| 66 |
+
try:matrix,coef,inliers,coverage=fit_geometry(ref,mov,(h,w))
|
| 67 |
+
except ValueError as exc:raise RegistrationError(str(exc),metrics) from exc
|
| 68 |
+
metrics.update(inliers=int(inliers.sum()),inlier_ratio=float(inliers.mean()),matches=len(ref),match_coverage=float(coverage))
|
| 69 |
+
if not local:coef=np.zeros_like(coef)
|
| 70 |
+
mapping,geometry_valid,delta=dense_mesh(coef,matrix,(h,w))
|
| 71 |
+
if geometry_valid[roi].mean()<.99:raise RegistrationError('Local deformation exceeds the permitted geometry limits.',metrics)
|
| 72 |
+
# Exactly one interpolation of original color pixels for the delivered warp.
|
| 73 |
+
aligned=cv2.remap(moving,mapping[...,0],mapping[...,1],cv2.INTER_LINEAR)
|
| 74 |
+
moving_roi=cv2.remap(source_roi.astype(np.uint8),mapping[...,0],mapping[...,1],cv2.INTER_NEAREST)>0
|
| 75 |
+
support=np.zeros((h,w),np.uint8)
|
| 76 |
+
# Only allow source contribution close to observed correspondence locations.
|
| 77 |
+
for point in ref:cv2.circle(support,tuple(np.rint(point).astype(int)),max(5,round(w*.04)),1,-1)
|
| 78 |
+
trusted=roi&moving_roi&geometry_valid&support.astype(bool)&~glare_mask(reference)&~glare_mask(aligned)
|
| 79 |
+
images,blend=compose(reference,aligned,geometry_valid,trusted,exposure)
|
| 80 |
+
images['local_confidence']=trusted.astype(np.uint8)*255
|
| 81 |
+
images['deformation']=np.clip(np.linalg.norm(delta,axis=2)*12,0,255).astype(np.uint8)
|
| 82 |
+
if settings.adaptive_mask:
|
| 83 |
+
images['reference_geometry']=geometry_overlay(reference,geometries[0])
|
| 84 |
+
images['moving_geometry']=geometry_overlay(moving,geometries[1])
|
| 85 |
+
metrics.update(blend,fit_error_px=None,transform=matrix.tolist(),mesh_coefficients=coef.tolist(),reference_shape=[h,w],sampling_convention="inverse homography plus bilinear reference-grid residual",local={'applied':local},
|
| 86 |
+
runtime_seconds=round(time.perf_counter()-started,3),
|
| 87 |
+
warning='Experimental alignment. Percentages describe automatic correspondence consistency, not anatomical accuracy. Glare and unknown regions remain reference-only. Global transform excludes the local mesh.',
|
| 88 |
+
geometry_valid_fraction=float(geometry_valid[roi].mean()),
|
| 89 |
+
raw_matches=len(raw_ref))
|
| 90 |
+
images['metrics']=metrics
|
| 91 |
+
return images
|
hf_workspace/hf_workspace/hf_workspace/backend/review.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""A review result for every decodable pair; no fabricated confidence scores."""
|
| 2 |
+
import time
|
| 3 |
+
from .registration import register
|
| 4 |
+
from .common import RegistrationError
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
SCORE_DESCRIPTION = (
|
| 8 |
+
'Percentage of proposed feature matches consistent with the global transform. '
|
| 9 |
+
'Not iris similarity, percentage of aligned fibers, or accuracy. '
|
| 10 |
+
'A high percentage can still accompany an unreliable transformation.'
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def review_pair(reference, moving, exposure=True, local=True, engine="classical"):
|
| 15 |
+
started = time.perf_counter()
|
| 16 |
+
try:
|
| 17 |
+
if engine == "learned":
|
| 18 |
+
from .learned_registration import register_learned
|
| 19 |
+
result = register_learned(reference, moving, exposure=exposure, local=local)
|
| 20 |
+
elif engine == "classical":
|
| 21 |
+
result = register(reference, moving, exposure=exposure, local=local)
|
| 22 |
+
else:
|
| 23 |
+
raise ValueError("Unknown registration engine.")
|
| 24 |
+
metrics = result['metrics']
|
| 25 |
+
metrics.update(status='review_required', status_label='Alignment preview — review required',
|
| 26 |
+
reason=None, suggestions=[
|
| 27 |
+
'Inspect corresponding fibers and crypts at 100% pixels before using the composite.',
|
| 28 |
+
'Review glare and occluded regions separately; they may have no usable counterpart.'
|
| 29 |
+
])
|
| 30 |
+
except RegistrationError as exc:
|
| 31 |
+
# Original images only: never relabel a failed warp as an aligned result.
|
| 32 |
+
metrics = dict(exc.diagnostics)
|
| 33 |
+
metrics.update(status='unaligned', status_label='Not aligned — reference preserved',
|
| 34 |
+
reason=str(exc), transform=None, fit_error_px=None,
|
| 35 |
+
exposure_gain=1., blended_fraction=0.,
|
| 36 |
+
local={'applied': False, 'reason': 'Alignment rejected'},
|
| 37 |
+
runtime_seconds=round(time.perf_counter()-started, 3),
|
| 38 |
+
warning='No registered or merged output was produced. The reference is unchanged.',
|
| 39 |
+
suggestions=[
|
| 40 |
+
'Crop both originals tightly around the same iris, keeping the entire iris visible.',
|
| 41 |
+
'Choose the clearest, better-exposed photograph as reference.',
|
| 42 |
+
'If it still fails, use landmark-assisted review rather than forcing a merge.'
|
| 43 |
+
])
|
| 44 |
+
result = {'metrics': metrics}
|
| 45 |
+
result.update(reference=reference, moving=moving)
|
| 46 |
+
ratio = metrics.get('inlier_ratio')
|
| 47 |
+
metrics['match_support_percent'] = round(100 * ratio, 1) if ratio is not None else None
|
| 48 |
+
metrics['score_description'] = SCORE_DESCRIPTION
|
| 49 |
+
return result
|
hf_workspace/hf_workspace/hf_workspace/frontend/src/ReviewSummary.jsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react';
|
| 2 |
+
|
| 3 |
+
export default function ReviewSummary({metrics}) {
|
| 4 |
+
const score = metrics.match_support_percent;
|
| 5 |
+
return <section className="review-summary" aria-live="polite">
|
| 6 |
+
<h2>{metrics.status_label}</h2>
|
| 7 |
+
<div className="score">{score == null ? 'Not measurable' : `${score.toFixed(1)}%`}<small>Match support</small></div>
|
| 8 |
+
<p className="note">{metrics.score_description}</p>
|
| 9 |
+
{metrics.reason && <p>{metrics.reason}</p>}
|
| 10 |
+
{metrics.evaluation && <section><h2>Automatic consistency</h2>
|
| 11 |
+
<p className="note">{metrics.evaluation.description}</p>
|
| 12 |
+
<p className="note">Patch-verified matches: {metrics.verified_matches} / {metrics.raw_matches ?? metrics.matches}. Only this subset is evaluated; it is not the percentage of the iris aligned.</p>
|
| 13 |
+
{metrics.evaluation.within_px_percent ? <table><thead><tr><th>Pixel tolerance</th><th>Held-out matches within tolerance</th></tr></thead><tbody>{Object.entries(metrics.evaluation.within_px_percent).map(([px,percent])=><tr key={px}><td>{px} px</td><td>{percent.toFixed(2)}%</td></tr>)}</tbody></table> : <p>{metrics.evaluation.reason}</p>}
|
| 14 |
+
</section>}
|
| 15 |
+
<dl>
|
| 16 |
+
<dt>Consistent / proposed matches</dt><dd>{metrics.inliers ?? '—'} / {metrics.matches ?? 0}</dd>
|
| 17 |
+
{metrics.fit_error_px != null && <><dt>Median fitting error (not independent accuracy)</dt><dd>{metrics.fit_error_px.toFixed(2)} px</dd></>}
|
| 18 |
+
<dt>Processing time</dt><dd>{metrics.runtime_seconds.toFixed(2)} s</dd>
|
| 19 |
+
<dt>Output area including second-image pixels</dt><dd>{(metrics.blended_fraction * 100).toFixed(1)}%</dd>
|
| 20 |
+
</dl>
|
| 21 |
+
<p className="note">{metrics.warning}</p>
|
| 22 |
+
<h2>Next steps</h2>
|
| 23 |
+
<ul>{metrics.suggestions.map(s => <li key={s}>{s}</li>)}</ul>
|
| 24 |
+
<a download="alignment-review.json" href={'data:application/json,' + encodeURIComponent(JSON.stringify(metrics, null, 2))}>Download review details</a>
|
| 25 |
+
</section>;
|
| 26 |
+
}
|
hf_workspace/hf_workspace/hf_workspace/frontend/src/api.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export async function requestAlignment(data) {
|
| 2 |
+
const response = await fetch('/api/register', {method: 'POST', body: data});
|
| 3 |
+
const body = await response.json().catch(() => null);
|
| 4 |
+
if (!response.ok) {
|
| 5 |
+
throw new Error(typeof body?.detail === 'string' ? body.detail : `The request could not be completed (${response.status}). Please retry.`);
|
| 6 |
+
}
|
| 7 |
+
if (!body?.images || !body?.metrics) throw new Error('The server returned an incomplete review. Please retry.');
|
| 8 |
+
return body;
|
| 9 |
+
}
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/.dockerignore
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.git
|
| 2 |
+
.github
|
| 3 |
+
.venv
|
| 4 |
+
__pycache__
|
| 5 |
+
.pytest_cache
|
| 6 |
+
private_benchmarks
|
| 7 |
+
frontend/node_modules
|
| 8 |
+
frontend/dist
|
| 9 |
+
tests
|
| 10 |
+
scripts
|
| 11 |
+
benchmark.py
|
| 12 |
+
synthetic_cases.py
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/.gitignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
#Ignore vscode AI rules
|
| 4 |
+
.github/instructions/codacy.instructions.md
|
| 5 |
+
.venv/
|
| 6 |
+
__pycache__/
|
| 7 |
+
.pytest_cache/
|
| 8 |
+
frontend/node_modules/
|
| 9 |
+
frontend/dist/
|
| 10 |
+
private_benchmarks/
|
| 11 |
+
models/
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM node:22-alpine AS frontend
|
| 2 |
+
WORKDIR /build
|
| 3 |
+
COPY frontend/package.json frontend/package-lock.json ./
|
| 4 |
+
RUN npm ci
|
| 5 |
+
COPY frontend/ ./
|
| 6 |
+
RUN npm run build
|
| 7 |
+
|
| 8 |
+
FROM python:3.12-slim
|
| 9 |
+
ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1
|
| 10 |
+
# opencv-python-headless still links libglib; libgomp backs numpy/opencv threading.
|
| 11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends libglib2.0-0 libgomp1 \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
WORKDIR /app
|
| 15 |
+
COPY requirements.txt ./
|
| 16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
+
COPY --chown=user:user backend/ ./backend/
|
| 18 |
+
COPY --chown=user:user reports/ ./reports/
|
| 19 |
+
COPY --from=frontend --chown=user:user /build/dist ./frontend/dist
|
| 20 |
+
USER user
|
| 21 |
+
EXPOSE 7860
|
| 22 |
+
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/app.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import base64
|
| 2 |
+
import io
|
| 3 |
+
import warnings
|
| 4 |
+
from threading import BoundedSemaphore
|
| 5 |
+
from typing import Literal
|
| 6 |
+
|
| 7 |
+
import cv2
|
| 8 |
+
import numpy as np
|
| 9 |
+
from fastapi import FastAPI, File, Form, HTTPException, UploadFile
|
| 10 |
+
from fastapi.staticfiles import StaticFiles
|
| 11 |
+
from fastapi.responses import JSONResponse
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
from PIL import Image, ImageOps
|
| 14 |
+
|
| 15 |
+
from .review import review_pair
|
| 16 |
+
|
| 17 |
+
app = FastAPI(title='Iris registration POC')
|
| 18 |
+
Image.MAX_IMAGE_PIXELS = 30_000_000
|
| 19 |
+
processing_slots = BoundedSemaphore(1)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def decode(data):
|
| 23 |
+
try:
|
| 24 |
+
with warnings.catch_warnings():
|
| 25 |
+
warnings.simplefilter('error', Image.DecompressionBombWarning)
|
| 26 |
+
with Image.open(io.BytesIO(data)) as image:
|
| 27 |
+
if image.width * image.height > 30_000_000 or min(image.size) < 64:
|
| 28 |
+
raise ValueError('Image must be at least 64px per side and at most 30 megapixels.')
|
| 29 |
+
image = ImageOps.exif_transpose(image).convert('RGB')
|
| 30 |
+
return cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
|
| 31 |
+
except Exception as exc:
|
| 32 |
+
raise ValueError('Invalid or oversized image. Use JPEG or PNG up to 30 megapixels.') from exc
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
@app.get('/api/health')
|
| 36 |
+
def health():
|
| 37 |
+
return {'status': 'ok'}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
@app.post('/api/register')
|
| 41 |
+
def registration(reference: UploadFile = File(...), moving: UploadFile = File(...), exposure: bool = Form(True), local: bool = Form(True), engine: Literal['classical', 'learned'] = Form('classical'), iris_crop_confirmed: bool = Form(False)):
|
| 42 |
+
if engine == 'learned' and not iris_crop_confirmed:
|
| 43 |
+
raise HTTPException(status_code=422, detail='Confirm both images are equally sized square crops centered on the iris before using experimental alignment.')
|
| 44 |
+
if not processing_slots.acquire(blocking=False):
|
| 45 |
+
raise HTTPException(status_code=503, detail='Another pair is being processed. Please retry shortly.', headers={'Retry-After':'10'})
|
| 46 |
+
try:
|
| 47 |
+
return process_pair(reference, moving, exposure, local, engine)
|
| 48 |
+
finally:
|
| 49 |
+
processing_slots.release()
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def process_pair(reference, moving, exposure, local, engine):
|
| 53 |
+
try:
|
| 54 |
+
images = []
|
| 55 |
+
for upload in (reference, moving):
|
| 56 |
+
data = upload.file.read(25_000_001)
|
| 57 |
+
if len(data) > 25_000_000:
|
| 58 |
+
raise ValueError('Each upload must be under 25 MB.')
|
| 59 |
+
images.append(decode(data))
|
| 60 |
+
result = review_pair(*images, exposure=exposure, local=local, engine=engine)
|
| 61 |
+
encoded = {}
|
| 62 |
+
for key, value in result.items():
|
| 63 |
+
if key != 'metrics':
|
| 64 |
+
ok, buf = cv2.imencode('.png', value)
|
| 65 |
+
if not ok:
|
| 66 |
+
raise ValueError('Could not encode output.')
|
| 67 |
+
encoded[key] = 'data:image/png;base64,' + base64.b64encode(buf).decode()
|
| 68 |
+
return JSONResponse({'images': encoded, 'metrics': result['metrics']})
|
| 69 |
+
except RuntimeError as exc:
|
| 70 |
+
raise HTTPException(status_code=503, detail=str(exc)) from exc
|
| 71 |
+
except (ValueError, cv2.error) as exc:
|
| 72 |
+
raise HTTPException(status_code=422, detail=str(exc)) from exc
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
root = Path(__file__).resolve().parents[1]
|
| 76 |
+
reports = root / 'reports'
|
| 77 |
+
if reports.exists():
|
| 78 |
+
app.mount('/benchmark', StaticFiles(directory=reports, html=True), name='benchmark')
|
| 79 |
+
dist = root / 'frontend' / 'dist'
|
| 80 |
+
if dist.exists():
|
| 81 |
+
app.mount('/', StaticFiles(directory=dist, html=True), name='frontend')
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/common.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class RegistrationError(ValueError):
|
| 5 |
+
def __init__(self, message, diagnostics=None):
|
| 6 |
+
super().__init__(message)
|
| 7 |
+
self.diagnostics = diagnostics or {}
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def gray(image):
|
| 11 |
+
return cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/compositing.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Conservative source-only compositing and review images."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from .common import gray
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def compose(reference, aligned, valid, trusted, exposure):
|
| 8 |
+
h, w = reference.shape[:2]
|
| 9 |
+
rg, ag = gray(reference), gray(aligned)
|
| 10 |
+
usable = valid & (rg > 25) & (rg < 230) & (ag > 15) & (ag < 230)
|
| 11 |
+
gain = float(np.clip(np.median(rg[usable] / np.maximum(ag[usable], 1)), 1, 2.5)) if exposure and usable.any() else 1.
|
| 12 |
+
adjusted = np.clip(aligned.astype(np.float32) * gain, 0, 255).astype(np.uint8)
|
| 13 |
+
# Photometric agreement is a heuristic, NOT proof of anatomical correspondence.
|
| 14 |
+
discrepancy = cv2.GaussianBlur(cv2.absdiff(gray(adjusted), rg).astype(np.float32), (0, 0), 2)
|
| 15 |
+
safe = usable & trusted & (discrepancy < 12) & (gray(adjusted) < 245)
|
| 16 |
+
safe = cv2.erode(safe.astype(np.uint8), np.ones((5, 5), np.uint8))
|
| 17 |
+
weight = .5 * cv2.GaussianBlur(safe.astype(np.float32), (0, 0), 2) * safe
|
| 18 |
+
composite = np.rint(reference * (1-weight[..., None]) + adjusted * weight[..., None]).astype(np.uint8)
|
| 19 |
+
overlay = cv2.addWeighted(reference, .5, adjusted, .5, 0)
|
| 20 |
+
yy, xx = np.indices((h, w), dtype=np.int32)
|
| 21 |
+
checker = np.where((((xx//64 + yy//64) % 2 == 0) & valid)[..., None], adjusted, reference)
|
| 22 |
+
return dict(aligned=aligned, adjusted=adjusted, composite=composite, overlay=overlay, checkerboard=checker, contribution=np.rint(weight*255).astype(np.uint8), difference=cv2.absdiff(reference, adjusted)), dict(exposure_gain=gain, overlap_fraction=float(valid.mean()), blended_fraction=float((weight > 0).mean()))
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/global_alignment.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Robust feature-based global initialization."""
|
| 2 |
+
import cv2
|
| 3 |
+
import numpy as np
|
| 4 |
+
from .common import gray, RegistrationError
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def estimate_global(reference, moving, allow_local=False):
|
| 8 |
+
evidence = dict(matches=0, inliers=None, inlier_ratio=None, match_coverage=None)
|
| 9 |
+
# Independently resize for matching; map the estimate back to original pixels.
|
| 10 |
+
def features(image):
|
| 11 |
+
scale = min(1., 1400 / max(image.shape[:2]))
|
| 12 |
+
small = cv2.resize(image, None, fx=scale, fy=scale)
|
| 13 |
+
g = gray(small)
|
| 14 |
+
mask = ((g > 12) & (g < 245)).astype(np.uint8) * 255
|
| 15 |
+
keypoints, descriptors = cv2.SIFT_create(nfeatures=7000).detectAndCompute(g, mask)
|
| 16 |
+
return keypoints, descriptors, scale
|
| 17 |
+
|
| 18 |
+
kr, dr, sr = features(reference)
|
| 19 |
+
km, dm, sm = features(moving)
|
| 20 |
+
if dr is None or dm is None or min(len(dr), len(dm)) < 12:
|
| 21 |
+
raise RegistrationError('Not enough visible detail to estimate alignment.', evidence)
|
| 22 |
+
pairs = cv2.BFMatcher().knnMatch(dm, dr, k=2)
|
| 23 |
+
good = [p[0] for p in pairs if len(p) == 2 and p[0].distance < .72 * p[1].distance]
|
| 24 |
+
evidence['matches'] = len(good)
|
| 25 |
+
if len(good) < 12:
|
| 26 |
+
raise RegistrationError('Too few reliable feature matches. Try tighter iris crops.', evidence)
|
| 27 |
+
source = np.float32([km[m.queryIdx].pt for m in good]) / sm
|
| 28 |
+
target = np.float32([kr[m.trainIdx].pt for m in good]) / sr
|
| 29 |
+
matrix, inliers = cv2.findHomography(source, target, cv2.RANSAC, (10 if allow_local else 3) / sr)
|
| 30 |
+
if inliers is not None:
|
| 31 |
+
evidence.update(inliers=int(inliers.sum()), inlier_ratio=float(inliers.mean()))
|
| 32 |
+
if matrix is None or not np.isfinite(matrix).all() or inliers.sum() < 12 or inliers.mean() < .3:
|
| 33 |
+
raise RegistrationError('Matches do not support a reliable global transformation.', evidence)
|
| 34 |
+
selected = inliers.ravel().astype(bool)
|
| 35 |
+
h, w = reference.shape[:2]
|
| 36 |
+
# Require evidence distributed over a meaningful part of the image.
|
| 37 |
+
coverage = cv2.contourArea(cv2.convexHull(target[selected])) / (h * w)
|
| 38 |
+
evidence['match_coverage'] = float(coverage)
|
| 39 |
+
if coverage < .08:
|
| 40 |
+
raise RegistrationError('Matches are too concentrated to trust the transformation.', evidence)
|
| 41 |
+
mh, mw = moving.shape[:2]
|
| 42 |
+
corners = np.float32([[0, 0], [mw, 0], [mw, mh], [0, mh]])
|
| 43 |
+
denominators = (matrix @ np.c_[corners, np.ones(4)].T)[2]
|
| 44 |
+
warped_corners = cv2.perspectiveTransform(corners[None], matrix)[0]
|
| 45 |
+
area = cv2.contourArea(warped_corners, oriented=True)
|
| 46 |
+
if np.any(denominators <= 0) or not .15 < area / (h*w) < 6:
|
| 47 |
+
raise RegistrationError('Implausible or flipped transformation rejected.', evidence)
|
| 48 |
+
error = np.linalg.norm(cv2.perspectiveTransform(source[selected, None], matrix)[:, 0] - target[selected], axis=1)
|
| 49 |
+
return matrix, dict(matches=len(good), inliers=int(selected.sum()), inlier_ratio=float(selected.mean()), match_coverage=float(coverage), fit_error_px=float(np.median(error)))
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/local_alignment.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bounded bidirectional optical flow on a capped working resolution.
|
| 2 |
+
|
| 3 |
+
Maps point from reference coordinates into the globally aligned moving image.
|
| 4 |
+
Confidence is heuristic; no claim of anatomical validation is made.
|
| 5 |
+
"""
|
| 6 |
+
import cv2
|
| 7 |
+
import numpy as np
|
| 8 |
+
from .common import gray
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def refine_local(reference, global_image, valid):
|
| 12 |
+
h, w = reference.shape[:2]
|
| 13 |
+
scale = min(1., 1200 / max(h, w))
|
| 14 |
+
size = (round(w * scale), round(h * scale))
|
| 15 |
+
a = cv2.resize(gray(reference), size)
|
| 16 |
+
b = cv2.resize(gray(global_image), size)
|
| 17 |
+
overlap = cv2.resize(valid.astype(np.uint8), size, interpolation=cv2.INTER_NEAREST).astype(bool)
|
| 18 |
+
usable = overlap & (a > 25) & (a < 230) & (b > 15) & (b < 240)
|
| 19 |
+
gain = float(np.clip(np.median(a[usable] / np.maximum(b[usable], 1)), .4, 2.5)) if usable.any() else 1.
|
| 20 |
+
b = np.clip(b.astype(np.float32) * gain, 0, 255).astype(np.uint8)
|
| 21 |
+
# Stable neutral normalization is for correspondence only, never output pixels.
|
| 22 |
+
def flow(first, second):
|
| 23 |
+
return cv2.calcOpticalFlowFarneback(first, second, None, .5, 5, 31, 5, 7, 1.5, 0)
|
| 24 |
+
forward = cv2.GaussianBlur(flow(a, b), (0, 0), 1.2)
|
| 25 |
+
reverse = flow(b, a)
|
| 26 |
+
yy, xx = np.indices(a.shape, dtype=np.float32)
|
| 27 |
+
mx, my = xx + forward[..., 0], yy + forward[..., 1]
|
| 28 |
+
back = cv2.remap(reverse, mx, my, cv2.INTER_LINEAR)
|
| 29 |
+
fb = np.linalg.norm(forward + back, axis=2)
|
| 30 |
+
displacement = np.linalg.norm(forward, axis=2)
|
| 31 |
+
ux_y, ux_x = np.gradient(forward[..., 0])
|
| 32 |
+
uy_y, uy_x = np.gradient(forward[..., 1])
|
| 33 |
+
determinant = (1 + ux_x) * (1 + uy_y) - ux_y * uy_x
|
| 34 |
+
strain = np.sqrt(ux_x**2 + ux_y**2 + uy_x**2 + uy_y**2)
|
| 35 |
+
warped = cv2.remap(b, mx, my, cv2.INTER_LINEAR)
|
| 36 |
+
before = cv2.GaussianBlur(cv2.absdiff(a, b).astype(np.float32), (0, 0), 2)
|
| 37 |
+
after = cv2.GaussianBlur(cv2.absdiff(a, warped).astype(np.float32), (0, 0), 2)
|
| 38 |
+
target_valid = cv2.remap(usable.astype(np.uint8), mx, my, cv2.INTER_NEAREST).astype(bool)
|
| 39 |
+
trusted = usable & target_valid & (fb < 1.) & (displacement < 18.) & (determinant > .65) & (determinant < 1.5) & (strain < .45) & (after < 15) & (after <= before + 1)
|
| 40 |
+
trusted = cv2.erode(trusted.astype(np.uint8), np.ones((5, 5), np.uint8)).astype(bool)
|
| 41 |
+
support = float(trusted.sum() / max(usable.sum(), 1))
|
| 42 |
+
improvement = float(1 - np.mean(after[trusted]) / max(np.mean(before[trusted]), .01)) if trusted.any() else 0.
|
| 43 |
+
motion = float(np.median(displacement[trusted])) if trusted.any() else 0.
|
| 44 |
+
accepted = support > .45 and improvement > .15 and motion > .3
|
| 45 |
+
info = dict(applied=accepted, trusted_fraction=support, photometric_improvement=improvement,
|
| 46 |
+
median_displacement_working_px=motion, working_scale=scale,
|
| 47 |
+
reason='Accepted constrained optical flow' if accepted else 'No reliable material improvement; kept global alignment')
|
| 48 |
+
if not accepted:
|
| 49 |
+
return None, np.ones((h,w), bool), info
|
| 50 |
+
# Keep the smooth map continuous; gate source contribution, not the field,
|
| 51 |
+
# at uncertain pixels to avoid discontinuities caused by zeroing local flow.
|
| 52 |
+
dense = cv2.resize(forward, (w,h))
|
| 53 |
+
dense[..., 0] *= w / size[0]
|
| 54 |
+
dense[..., 1] *= h / size[1]
|
| 55 |
+
confidence = cv2.resize(trusted.astype(np.uint8), (w,h), interpolation=cv2.INTER_NEAREST).astype(bool)
|
| 56 |
+
return dense, confidence, info
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/backend/registration.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Orchestrate global alignment, optional local refinement, and compositing."""
|
| 2 |
+
import time
|
| 3 |
+
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
+
from .common import RegistrationError
|
| 6 |
+
from .global_alignment import estimate_global
|
| 7 |
+
from .local_alignment import refine_local
|
| 8 |
+
from .compositing import compose
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def register(reference, moving, exposure=True, local=True, return_maps=False):
|
| 12 |
+
started = time.perf_counter()
|
| 13 |
+
# Prefer the strict estimate; only retry a broader residual tolerance when
|
| 14 |
+
# local refinement is enabled. A coarse fallback must pass local validation.
|
| 15 |
+
coarse = False
|
| 16 |
+
try:
|
| 17 |
+
matrix, metrics = estimate_global(reference, moving)
|
| 18 |
+
except RegistrationError:
|
| 19 |
+
if not local:
|
| 20 |
+
raise
|
| 21 |
+
matrix, metrics = estimate_global(reference, moving, allow_local=True)
|
| 22 |
+
coarse = True
|
| 23 |
+
h, w = reference.shape[:2]
|
| 24 |
+
mh, mw = moving.shape[:2]
|
| 25 |
+
global_image = cv2.warpPerspective(moving, matrix, (w,h))
|
| 26 |
+
valid = cv2.warpPerspective(np.ones((mh,mw), np.uint8), matrix, (w,h), flags=cv2.INTER_NEAREST)
|
| 27 |
+
valid = cv2.erode(valid, np.ones((5,5), np.uint8)).astype(bool)
|
| 28 |
+
if valid.mean() < .4:
|
| 29 |
+
raise RegistrationError('Insufficient overlap between the photographs.', metrics)
|
| 30 |
+
field, trusted, info = (None, np.ones((h,w), bool), dict(applied=False, reason='Disabled'))
|
| 31 |
+
if local:
|
| 32 |
+
field, trusted, info = refine_local(reference, global_image, valid)
|
| 33 |
+
if coarse and field is None:
|
| 34 |
+
raise RegistrationError('Coarse global alignment could not be verified by local refinement.', metrics)
|
| 35 |
+
yy, xx = np.indices((h,w), dtype=np.float32)
|
| 36 |
+
if field is not None:
|
| 37 |
+
xx += field[...,0]
|
| 38 |
+
yy += field[...,1]
|
| 39 |
+
# Compose inverse homography with local backward flow, then sample ORIGINAL
|
| 40 |
+
# moving pixels once. Avoid serial warping of the delivered output.
|
| 41 |
+
inverse = np.linalg.inv(matrix)
|
| 42 |
+
denominator = inverse[2,0]*xx + inverse[2,1]*yy + inverse[2,2]
|
| 43 |
+
map_x = ((inverse[0,0]*xx + inverse[0,1]*yy + inverse[0,2]) / denominator).astype(np.float32)
|
| 44 |
+
map_y = ((inverse[1,0]*xx + inverse[1,1]*yy + inverse[1,2]) / denominator).astype(np.float32)
|
| 45 |
+
valid = np.isfinite(map_x) & np.isfinite(map_y) & (map_x >= 2) & (map_x < mw-3) & (map_y >= 2) & (map_y < mh-3)
|
| 46 |
+
aligned = cv2.remap(moving, map_x, map_y, cv2.INTER_LINEAR)
|
| 47 |
+
outputs, blend_metrics = compose(reference, aligned, valid, trusted, exposure)
|
| 48 |
+
outputs['global_aligned'] = global_image
|
| 49 |
+
outputs['local_confidence'] = trusted.astype(np.uint8)*255
|
| 50 |
+
outputs['deformation'] = np.zeros((h,w), np.uint8) if field is None else np.clip(np.linalg.norm(field,axis=2)*12,0,255).astype(np.uint8)
|
| 51 |
+
metrics.update(blend_metrics)
|
| 52 |
+
metrics.update(transform=matrix.tolist(), local=info, coarse_initialization=coarse,
|
| 53 |
+
runtime_seconds=round(time.perf_counter()-started,3),
|
| 54 |
+
warning='Confidence and blend masks are heuristic. Inspect real fibers. Global fit error is not independent accuracy; the homography excludes local deformation.')
|
| 55 |
+
outputs['metrics'] = metrics
|
| 56 |
+
if return_maps:
|
| 57 |
+
outputs['sampling_map'] = np.stack([map_x,map_y],axis=-1)
|
| 58 |
+
return outputs
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/benchmark.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate deterministic test pairs and a browsable report; run from repo root."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import html
|
| 4 |
+
import json
|
| 5 |
+
import cv2
|
| 6 |
+
import numpy as np
|
| 7 |
+
from backend.registration import register, RegistrationError
|
| 8 |
+
from synthetic_cases import CASE_NAMES, make_case, mapping_errors
|
| 9 |
+
|
| 10 |
+
out = Path('reports')
|
| 11 |
+
out.mkdir(exist_ok=True)
|
| 12 |
+
ref = cv2.resize(cv2.imread('fixtures/synthetic-iris.png'), (1000, 1000))
|
| 13 |
+
cv2.imwrite(str(out/'reference.png'), ref)
|
| 14 |
+
rows = []
|
| 15 |
+
cards = []
|
| 16 |
+
for name in CASE_NAMES:
|
| 17 |
+
moving, truth_points, moving_points = make_case(ref, name)
|
| 18 |
+
cv2.imwrite(str(out/f'{name}-moving.jpg'), moving)
|
| 19 |
+
try:
|
| 20 |
+
result = register(ref, moving, return_maps=True)
|
| 21 |
+
errors = mapping_errors(result['sampling_map'], truth_points, moving_points)
|
| 22 |
+
row = dict(case=name, median_error_px=float(np.median(errors)), p95_error_px=float(np.percentile(errors,95)),
|
| 23 |
+
status='PASS' if np.percentile(errors,95)<1 else 'LIMITATION', **result['metrics'])
|
| 24 |
+
for key, img in result.items():
|
| 25 |
+
if key not in ('metrics', 'sampling_map'):
|
| 26 |
+
cv2.imwrite(str(out/f'{name}-{key}.png'), img)
|
| 27 |
+
cards.append(f'<section><h2>{name}: {row["status"]}</h2><p>Independent grid error: median {row["median_error_px"]:.3f}px · p95 {row["p95_error_px"]:.3f}px</p><div>'+''.join(f'<figure><a href="{name}-{key}.{ext}"><img src="{name}-{key}.{ext}"></a><figcaption>{key}</figcaption></figure>' for key,ext in [('moving','jpg'),('global_aligned','png'),('overlay','png'),('composite','png')])+'</div></section>')
|
| 28 |
+
except RegistrationError as exc:
|
| 29 |
+
row = dict(case=name, status='REJECTED', reason=str(exc))
|
| 30 |
+
cards.append(f'<section><h2>{name}: REJECTED</h2><p>{html.escape(str(exc))} No composite produced.</p><div><figure><a href="{name}-moving.jpg"><img src="{name}-moving.jpg"></a><figcaption>Moving image with known local distortion</figcaption></figure><figure><img src="reference.png"><figcaption>Reference</figcaption></figure></div></section>')
|
| 31 |
+
rows.append(row)
|
| 32 |
+
(out/'metrics.json').write_text(json.dumps(rows, indent=2))
|
| 33 |
+
(out/'index.html').write_text('<!doctype html><meta charset="utf-8"><title>Synthetic registration benchmark</title><style>body{background:#111b22;color:#e2e9ed;font:16px system-ui;margin:40px}p{color:#acbcc6}section{margin:40px 0}section div{display:flex;gap:16px}figure{margin:0;flex:1;min-width:0}img{width:100%}a{color:#72d7b5}</style><h1>Synthetic iris registration benchmark</h1><p>One AI-generated fixture, deterministic transformations. These are not real client photographs. Error is measured in moving-image pixels using the complete backward sampling map at independent known-coordinate iris grid points, not fitting matches. PASS means p95 < 1 pixel at 1000 × 1000. Click images for full resolution.</p><a href="reference.png">Reference image</a> · <a href="metrics.json">Full measurements</a>'+''.join(cards))
|
| 34 |
+
print(json.dumps([{k:r[k] for k in ['case','status','median_error_px','p95_error_px'] if k in r} for r in rows], indent=2))
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/fixtures/prompt.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Create one photorealistic macro image of a human iris for a SYNTHETIC computer vision test fixture, square 1024x1024. Straight-on circular hazel/green iris centered precisely, complete outer iris visible with margin, round black pupil, densely detailed naturally irregular radial iris fibers and crypts, subtle brown inner ring, plain subdued sclera outside. Flat diffuse neutral illumination, no specular glare, no eyelids covering the iris, no text, no graphics, no sharpening halos. This is fictional test imagery, not a medical reference.
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/fixtures/synthetic-iris.png
ADDED
|
Git LFS Details
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/index.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Iris registration lab</title></head><body><div id="root"></div><script type="module" src="/src/main.jsx"></script></body></html>
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/package-lock.json
ADDED
|
@@ -0,0 +1,1153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "iris-registration-poc",
|
| 3 |
+
"version": "0.1.0",
|
| 4 |
+
"lockfileVersion": 3,
|
| 5 |
+
"requires": true,
|
| 6 |
+
"packages": {
|
| 7 |
+
"": {
|
| 8 |
+
"name": "iris-registration-poc",
|
| 9 |
+
"version": "0.1.0",
|
| 10 |
+
"dependencies": {
|
| 11 |
+
"react": "^19.0.0",
|
| 12 |
+
"react-dom": "^19.0.0"
|
| 13 |
+
},
|
| 14 |
+
"devDependencies": {
|
| 15 |
+
"vite": "^6.0.0"
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"node_modules/@esbuild/aix-ppc64": {
|
| 19 |
+
"version": "0.25.12",
|
| 20 |
+
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
|
| 21 |
+
"integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
|
| 22 |
+
"cpu": [
|
| 23 |
+
"ppc64"
|
| 24 |
+
],
|
| 25 |
+
"dev": true,
|
| 26 |
+
"license": "MIT",
|
| 27 |
+
"optional": true,
|
| 28 |
+
"os": [
|
| 29 |
+
"aix"
|
| 30 |
+
],
|
| 31 |
+
"engines": {
|
| 32 |
+
"node": ">=18"
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"node_modules/@esbuild/android-arm": {
|
| 36 |
+
"version": "0.25.12",
|
| 37 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
|
| 38 |
+
"integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
|
| 39 |
+
"cpu": [
|
| 40 |
+
"arm"
|
| 41 |
+
],
|
| 42 |
+
"dev": true,
|
| 43 |
+
"license": "MIT",
|
| 44 |
+
"optional": true,
|
| 45 |
+
"os": [
|
| 46 |
+
"android"
|
| 47 |
+
],
|
| 48 |
+
"engines": {
|
| 49 |
+
"node": ">=18"
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
"node_modules/@esbuild/android-arm64": {
|
| 53 |
+
"version": "0.25.12",
|
| 54 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
|
| 55 |
+
"integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
|
| 56 |
+
"cpu": [
|
| 57 |
+
"arm64"
|
| 58 |
+
],
|
| 59 |
+
"dev": true,
|
| 60 |
+
"license": "MIT",
|
| 61 |
+
"optional": true,
|
| 62 |
+
"os": [
|
| 63 |
+
"android"
|
| 64 |
+
],
|
| 65 |
+
"engines": {
|
| 66 |
+
"node": ">=18"
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"node_modules/@esbuild/android-x64": {
|
| 70 |
+
"version": "0.25.12",
|
| 71 |
+
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
|
| 72 |
+
"integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
|
| 73 |
+
"cpu": [
|
| 74 |
+
"x64"
|
| 75 |
+
],
|
| 76 |
+
"dev": true,
|
| 77 |
+
"license": "MIT",
|
| 78 |
+
"optional": true,
|
| 79 |
+
"os": [
|
| 80 |
+
"android"
|
| 81 |
+
],
|
| 82 |
+
"engines": {
|
| 83 |
+
"node": ">=18"
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"node_modules/@esbuild/darwin-arm64": {
|
| 87 |
+
"version": "0.25.12",
|
| 88 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
|
| 89 |
+
"integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
|
| 90 |
+
"cpu": [
|
| 91 |
+
"arm64"
|
| 92 |
+
],
|
| 93 |
+
"dev": true,
|
| 94 |
+
"license": "MIT",
|
| 95 |
+
"optional": true,
|
| 96 |
+
"os": [
|
| 97 |
+
"darwin"
|
| 98 |
+
],
|
| 99 |
+
"engines": {
|
| 100 |
+
"node": ">=18"
|
| 101 |
+
}
|
| 102 |
+
},
|
| 103 |
+
"node_modules/@esbuild/darwin-x64": {
|
| 104 |
+
"version": "0.25.12",
|
| 105 |
+
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
|
| 106 |
+
"integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
|
| 107 |
+
"cpu": [
|
| 108 |
+
"x64"
|
| 109 |
+
],
|
| 110 |
+
"dev": true,
|
| 111 |
+
"license": "MIT",
|
| 112 |
+
"optional": true,
|
| 113 |
+
"os": [
|
| 114 |
+
"darwin"
|
| 115 |
+
],
|
| 116 |
+
"engines": {
|
| 117 |
+
"node": ">=18"
|
| 118 |
+
}
|
| 119 |
+
},
|
| 120 |
+
"node_modules/@esbuild/freebsd-arm64": {
|
| 121 |
+
"version": "0.25.12",
|
| 122 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
|
| 123 |
+
"integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
|
| 124 |
+
"cpu": [
|
| 125 |
+
"arm64"
|
| 126 |
+
],
|
| 127 |
+
"dev": true,
|
| 128 |
+
"license": "MIT",
|
| 129 |
+
"optional": true,
|
| 130 |
+
"os": [
|
| 131 |
+
"freebsd"
|
| 132 |
+
],
|
| 133 |
+
"engines": {
|
| 134 |
+
"node": ">=18"
|
| 135 |
+
}
|
| 136 |
+
},
|
| 137 |
+
"node_modules/@esbuild/freebsd-x64": {
|
| 138 |
+
"version": "0.25.12",
|
| 139 |
+
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
|
| 140 |
+
"integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
|
| 141 |
+
"cpu": [
|
| 142 |
+
"x64"
|
| 143 |
+
],
|
| 144 |
+
"dev": true,
|
| 145 |
+
"license": "MIT",
|
| 146 |
+
"optional": true,
|
| 147 |
+
"os": [
|
| 148 |
+
"freebsd"
|
| 149 |
+
],
|
| 150 |
+
"engines": {
|
| 151 |
+
"node": ">=18"
|
| 152 |
+
}
|
| 153 |
+
},
|
| 154 |
+
"node_modules/@esbuild/linux-arm": {
|
| 155 |
+
"version": "0.25.12",
|
| 156 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
|
| 157 |
+
"integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
|
| 158 |
+
"cpu": [
|
| 159 |
+
"arm"
|
| 160 |
+
],
|
| 161 |
+
"dev": true,
|
| 162 |
+
"license": "MIT",
|
| 163 |
+
"optional": true,
|
| 164 |
+
"os": [
|
| 165 |
+
"linux"
|
| 166 |
+
],
|
| 167 |
+
"engines": {
|
| 168 |
+
"node": ">=18"
|
| 169 |
+
}
|
| 170 |
+
},
|
| 171 |
+
"node_modules/@esbuild/linux-arm64": {
|
| 172 |
+
"version": "0.25.12",
|
| 173 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
|
| 174 |
+
"integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
|
| 175 |
+
"cpu": [
|
| 176 |
+
"arm64"
|
| 177 |
+
],
|
| 178 |
+
"dev": true,
|
| 179 |
+
"license": "MIT",
|
| 180 |
+
"optional": true,
|
| 181 |
+
"os": [
|
| 182 |
+
"linux"
|
| 183 |
+
],
|
| 184 |
+
"engines": {
|
| 185 |
+
"node": ">=18"
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"node_modules/@esbuild/linux-ia32": {
|
| 189 |
+
"version": "0.25.12",
|
| 190 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
|
| 191 |
+
"integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
|
| 192 |
+
"cpu": [
|
| 193 |
+
"ia32"
|
| 194 |
+
],
|
| 195 |
+
"dev": true,
|
| 196 |
+
"license": "MIT",
|
| 197 |
+
"optional": true,
|
| 198 |
+
"os": [
|
| 199 |
+
"linux"
|
| 200 |
+
],
|
| 201 |
+
"engines": {
|
| 202 |
+
"node": ">=18"
|
| 203 |
+
}
|
| 204 |
+
},
|
| 205 |
+
"node_modules/@esbuild/linux-loong64": {
|
| 206 |
+
"version": "0.25.12",
|
| 207 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
|
| 208 |
+
"integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
|
| 209 |
+
"cpu": [
|
| 210 |
+
"loong64"
|
| 211 |
+
],
|
| 212 |
+
"dev": true,
|
| 213 |
+
"license": "MIT",
|
| 214 |
+
"optional": true,
|
| 215 |
+
"os": [
|
| 216 |
+
"linux"
|
| 217 |
+
],
|
| 218 |
+
"engines": {
|
| 219 |
+
"node": ">=18"
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
"node_modules/@esbuild/linux-mips64el": {
|
| 223 |
+
"version": "0.25.12",
|
| 224 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
|
| 225 |
+
"integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
|
| 226 |
+
"cpu": [
|
| 227 |
+
"mips64el"
|
| 228 |
+
],
|
| 229 |
+
"dev": true,
|
| 230 |
+
"license": "MIT",
|
| 231 |
+
"optional": true,
|
| 232 |
+
"os": [
|
| 233 |
+
"linux"
|
| 234 |
+
],
|
| 235 |
+
"engines": {
|
| 236 |
+
"node": ">=18"
|
| 237 |
+
}
|
| 238 |
+
},
|
| 239 |
+
"node_modules/@esbuild/linux-ppc64": {
|
| 240 |
+
"version": "0.25.12",
|
| 241 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
|
| 242 |
+
"integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
|
| 243 |
+
"cpu": [
|
| 244 |
+
"ppc64"
|
| 245 |
+
],
|
| 246 |
+
"dev": true,
|
| 247 |
+
"license": "MIT",
|
| 248 |
+
"optional": true,
|
| 249 |
+
"os": [
|
| 250 |
+
"linux"
|
| 251 |
+
],
|
| 252 |
+
"engines": {
|
| 253 |
+
"node": ">=18"
|
| 254 |
+
}
|
| 255 |
+
},
|
| 256 |
+
"node_modules/@esbuild/linux-riscv64": {
|
| 257 |
+
"version": "0.25.12",
|
| 258 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
|
| 259 |
+
"integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
|
| 260 |
+
"cpu": [
|
| 261 |
+
"riscv64"
|
| 262 |
+
],
|
| 263 |
+
"dev": true,
|
| 264 |
+
"license": "MIT",
|
| 265 |
+
"optional": true,
|
| 266 |
+
"os": [
|
| 267 |
+
"linux"
|
| 268 |
+
],
|
| 269 |
+
"engines": {
|
| 270 |
+
"node": ">=18"
|
| 271 |
+
}
|
| 272 |
+
},
|
| 273 |
+
"node_modules/@esbuild/linux-s390x": {
|
| 274 |
+
"version": "0.25.12",
|
| 275 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
|
| 276 |
+
"integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
|
| 277 |
+
"cpu": [
|
| 278 |
+
"s390x"
|
| 279 |
+
],
|
| 280 |
+
"dev": true,
|
| 281 |
+
"license": "MIT",
|
| 282 |
+
"optional": true,
|
| 283 |
+
"os": [
|
| 284 |
+
"linux"
|
| 285 |
+
],
|
| 286 |
+
"engines": {
|
| 287 |
+
"node": ">=18"
|
| 288 |
+
}
|
| 289 |
+
},
|
| 290 |
+
"node_modules/@esbuild/linux-x64": {
|
| 291 |
+
"version": "0.25.12",
|
| 292 |
+
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
|
| 293 |
+
"integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
|
| 294 |
+
"cpu": [
|
| 295 |
+
"x64"
|
| 296 |
+
],
|
| 297 |
+
"dev": true,
|
| 298 |
+
"license": "MIT",
|
| 299 |
+
"optional": true,
|
| 300 |
+
"os": [
|
| 301 |
+
"linux"
|
| 302 |
+
],
|
| 303 |
+
"engines": {
|
| 304 |
+
"node": ">=18"
|
| 305 |
+
}
|
| 306 |
+
},
|
| 307 |
+
"node_modules/@esbuild/netbsd-arm64": {
|
| 308 |
+
"version": "0.25.12",
|
| 309 |
+
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
|
| 310 |
+
"integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
|
| 311 |
+
"cpu": [
|
| 312 |
+
"arm64"
|
| 313 |
+
],
|
| 314 |
+
"dev": true,
|
| 315 |
+
"license": "MIT",
|
| 316 |
+
"optional": true,
|
| 317 |
+
"os": [
|
| 318 |
+
"netbsd"
|
| 319 |
+
],
|
| 320 |
+
"engines": {
|
| 321 |
+
"node": ">=18"
|
| 322 |
+
}
|
| 323 |
+
},
|
| 324 |
+
"node_modules/@esbuild/netbsd-x64": {
|
| 325 |
+
"version": "0.25.12",
|
| 326 |
+
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
|
| 327 |
+
"integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
|
| 328 |
+
"cpu": [
|
| 329 |
+
"x64"
|
| 330 |
+
],
|
| 331 |
+
"dev": true,
|
| 332 |
+
"license": "MIT",
|
| 333 |
+
"optional": true,
|
| 334 |
+
"os": [
|
| 335 |
+
"netbsd"
|
| 336 |
+
],
|
| 337 |
+
"engines": {
|
| 338 |
+
"node": ">=18"
|
| 339 |
+
}
|
| 340 |
+
},
|
| 341 |
+
"node_modules/@esbuild/openbsd-arm64": {
|
| 342 |
+
"version": "0.25.12",
|
| 343 |
+
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
|
| 344 |
+
"integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
|
| 345 |
+
"cpu": [
|
| 346 |
+
"arm64"
|
| 347 |
+
],
|
| 348 |
+
"dev": true,
|
| 349 |
+
"license": "MIT",
|
| 350 |
+
"optional": true,
|
| 351 |
+
"os": [
|
| 352 |
+
"openbsd"
|
| 353 |
+
],
|
| 354 |
+
"engines": {
|
| 355 |
+
"node": ">=18"
|
| 356 |
+
}
|
| 357 |
+
},
|
| 358 |
+
"node_modules/@esbuild/openbsd-x64": {
|
| 359 |
+
"version": "0.25.12",
|
| 360 |
+
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
|
| 361 |
+
"integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
|
| 362 |
+
"cpu": [
|
| 363 |
+
"x64"
|
| 364 |
+
],
|
| 365 |
+
"dev": true,
|
| 366 |
+
"license": "MIT",
|
| 367 |
+
"optional": true,
|
| 368 |
+
"os": [
|
| 369 |
+
"openbsd"
|
| 370 |
+
],
|
| 371 |
+
"engines": {
|
| 372 |
+
"node": ">=18"
|
| 373 |
+
}
|
| 374 |
+
},
|
| 375 |
+
"node_modules/@esbuild/openharmony-arm64": {
|
| 376 |
+
"version": "0.25.12",
|
| 377 |
+
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
|
| 378 |
+
"integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
|
| 379 |
+
"cpu": [
|
| 380 |
+
"arm64"
|
| 381 |
+
],
|
| 382 |
+
"dev": true,
|
| 383 |
+
"license": "MIT",
|
| 384 |
+
"optional": true,
|
| 385 |
+
"os": [
|
| 386 |
+
"openharmony"
|
| 387 |
+
],
|
| 388 |
+
"engines": {
|
| 389 |
+
"node": ">=18"
|
| 390 |
+
}
|
| 391 |
+
},
|
| 392 |
+
"node_modules/@esbuild/sunos-x64": {
|
| 393 |
+
"version": "0.25.12",
|
| 394 |
+
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
|
| 395 |
+
"integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
|
| 396 |
+
"cpu": [
|
| 397 |
+
"x64"
|
| 398 |
+
],
|
| 399 |
+
"dev": true,
|
| 400 |
+
"license": "MIT",
|
| 401 |
+
"optional": true,
|
| 402 |
+
"os": [
|
| 403 |
+
"sunos"
|
| 404 |
+
],
|
| 405 |
+
"engines": {
|
| 406 |
+
"node": ">=18"
|
| 407 |
+
}
|
| 408 |
+
},
|
| 409 |
+
"node_modules/@esbuild/win32-arm64": {
|
| 410 |
+
"version": "0.25.12",
|
| 411 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
|
| 412 |
+
"integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
|
| 413 |
+
"cpu": [
|
| 414 |
+
"arm64"
|
| 415 |
+
],
|
| 416 |
+
"dev": true,
|
| 417 |
+
"license": "MIT",
|
| 418 |
+
"optional": true,
|
| 419 |
+
"os": [
|
| 420 |
+
"win32"
|
| 421 |
+
],
|
| 422 |
+
"engines": {
|
| 423 |
+
"node": ">=18"
|
| 424 |
+
}
|
| 425 |
+
},
|
| 426 |
+
"node_modules/@esbuild/win32-ia32": {
|
| 427 |
+
"version": "0.25.12",
|
| 428 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
|
| 429 |
+
"integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
|
| 430 |
+
"cpu": [
|
| 431 |
+
"ia32"
|
| 432 |
+
],
|
| 433 |
+
"dev": true,
|
| 434 |
+
"license": "MIT",
|
| 435 |
+
"optional": true,
|
| 436 |
+
"os": [
|
| 437 |
+
"win32"
|
| 438 |
+
],
|
| 439 |
+
"engines": {
|
| 440 |
+
"node": ">=18"
|
| 441 |
+
}
|
| 442 |
+
},
|
| 443 |
+
"node_modules/@esbuild/win32-x64": {
|
| 444 |
+
"version": "0.25.12",
|
| 445 |
+
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
|
| 446 |
+
"integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
|
| 447 |
+
"cpu": [
|
| 448 |
+
"x64"
|
| 449 |
+
],
|
| 450 |
+
"dev": true,
|
| 451 |
+
"license": "MIT",
|
| 452 |
+
"optional": true,
|
| 453 |
+
"os": [
|
| 454 |
+
"win32"
|
| 455 |
+
],
|
| 456 |
+
"engines": {
|
| 457 |
+
"node": ">=18"
|
| 458 |
+
}
|
| 459 |
+
},
|
| 460 |
+
"node_modules/@napi-rs/lzma-linux-x64-gnu": {
|
| 461 |
+
"version": "1.5.1",
|
| 462 |
+
"resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz",
|
| 463 |
+
"integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==",
|
| 464 |
+
"cpu": [
|
| 465 |
+
"x64"
|
| 466 |
+
],
|
| 467 |
+
"dev": true,
|
| 468 |
+
"license": "MIT",
|
| 469 |
+
"optional": true,
|
| 470 |
+
"os": [
|
| 471 |
+
"linux"
|
| 472 |
+
],
|
| 473 |
+
"engines": {
|
| 474 |
+
"node": "^22.20 || ^24.12 || >=25"
|
| 475 |
+
}
|
| 476 |
+
},
|
| 477 |
+
"node_modules/@rollup/rollup-android-arm-eabi": {
|
| 478 |
+
"version": "4.63.4",
|
| 479 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.4.tgz",
|
| 480 |
+
"integrity": "sha512-I+BSHzTAhKN2n7ZwGZsegGcZjDpLqFOMAtJz/u6uFGe0pUFbq56dEHjqJV/ZUdRJtNXNxA+hREUatZBvMR3Oiw==",
|
| 481 |
+
"cpu": [
|
| 482 |
+
"arm"
|
| 483 |
+
],
|
| 484 |
+
"dev": true,
|
| 485 |
+
"license": "MIT",
|
| 486 |
+
"optional": true,
|
| 487 |
+
"os": [
|
| 488 |
+
"android"
|
| 489 |
+
]
|
| 490 |
+
},
|
| 491 |
+
"node_modules/@rollup/rollup-android-arm64": {
|
| 492 |
+
"version": "4.63.4",
|
| 493 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.4.tgz",
|
| 494 |
+
"integrity": "sha512-pu3BdjS2LtEzRu2elmGzS3fIeWSZy4BMDIaLNwjorO76+k2d0LMluijhsDx3KQyQBQ/lLUZCQA9/s6csvUfuhw==",
|
| 495 |
+
"cpu": [
|
| 496 |
+
"arm64"
|
| 497 |
+
],
|
| 498 |
+
"dev": true,
|
| 499 |
+
"license": "MIT",
|
| 500 |
+
"optional": true,
|
| 501 |
+
"os": [
|
| 502 |
+
"android"
|
| 503 |
+
]
|
| 504 |
+
},
|
| 505 |
+
"node_modules/@rollup/rollup-darwin-arm64": {
|
| 506 |
+
"version": "4.63.4",
|
| 507 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.4.tgz",
|
| 508 |
+
"integrity": "sha512-xfSrj9MHnWK9GaSqT9U0ImHtH/N8WZlHLx4cZHiuLcqs640hvZ3hLPd5UR2AZS57FaE8HrRUSpltbZdWRxHiDA==",
|
| 509 |
+
"cpu": [
|
| 510 |
+
"arm64"
|
| 511 |
+
],
|
| 512 |
+
"dev": true,
|
| 513 |
+
"license": "MIT",
|
| 514 |
+
"optional": true,
|
| 515 |
+
"os": [
|
| 516 |
+
"darwin"
|
| 517 |
+
]
|
| 518 |
+
},
|
| 519 |
+
"node_modules/@rollup/rollup-darwin-x64": {
|
| 520 |
+
"version": "4.63.4",
|
| 521 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.4.tgz",
|
| 522 |
+
"integrity": "sha512-bqU99PLJb/dqb3S0GIMdeuyAEETSUgZBoqXYd3Sd+WCsV+MmPhnN6JrotWyir31+QgH7EvvE5/mwGJlEoci8Fw==",
|
| 523 |
+
"cpu": [
|
| 524 |
+
"x64"
|
| 525 |
+
],
|
| 526 |
+
"dev": true,
|
| 527 |
+
"license": "MIT",
|
| 528 |
+
"optional": true,
|
| 529 |
+
"os": [
|
| 530 |
+
"darwin"
|
| 531 |
+
]
|
| 532 |
+
},
|
| 533 |
+
"node_modules/@rollup/rollup-freebsd-arm64": {
|
| 534 |
+
"version": "4.63.4",
|
| 535 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.4.tgz",
|
| 536 |
+
"integrity": "sha512-JinsFZ5G40oXQb+sUuiA5x689vhr6dDYK0H0NL+rwKdL6CqnmYN8PE4ZwfRSoIjrCxqTQG/SLfTtSvHeGxoVlw==",
|
| 537 |
+
"cpu": [
|
| 538 |
+
"arm64"
|
| 539 |
+
],
|
| 540 |
+
"dev": true,
|
| 541 |
+
"license": "MIT",
|
| 542 |
+
"optional": true,
|
| 543 |
+
"os": [
|
| 544 |
+
"freebsd"
|
| 545 |
+
]
|
| 546 |
+
},
|
| 547 |
+
"node_modules/@rollup/rollup-freebsd-x64": {
|
| 548 |
+
"version": "4.63.4",
|
| 549 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.4.tgz",
|
| 550 |
+
"integrity": "sha512-GAdA4UxpiNm27cLHr2GqXBpAD0x9FqwYBY7/YSP0Ss0/PNi4k8gbviqpIpYbVSRBaS2ZcegXEzgTQMbRNCwxCw==",
|
| 551 |
+
"cpu": [
|
| 552 |
+
"x64"
|
| 553 |
+
],
|
| 554 |
+
"dev": true,
|
| 555 |
+
"license": "MIT",
|
| 556 |
+
"optional": true,
|
| 557 |
+
"os": [
|
| 558 |
+
"freebsd"
|
| 559 |
+
]
|
| 560 |
+
},
|
| 561 |
+
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
| 562 |
+
"version": "4.63.4",
|
| 563 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.4.tgz",
|
| 564 |
+
"integrity": "sha512-qDd6NoA1znaLjp4jR5U/KWCdLAKDJNB8W9ChbbDaKbo0xA+Atln5HK6LFCZ4oJQpemtRZA288DCirFRjrspptw==",
|
| 565 |
+
"cpu": [
|
| 566 |
+
"arm"
|
| 567 |
+
],
|
| 568 |
+
"dev": true,
|
| 569 |
+
"license": "MIT",
|
| 570 |
+
"optional": true,
|
| 571 |
+
"os": [
|
| 572 |
+
"linux"
|
| 573 |
+
]
|
| 574 |
+
},
|
| 575 |
+
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
| 576 |
+
"version": "4.63.4",
|
| 577 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.4.tgz",
|
| 578 |
+
"integrity": "sha512-WtB5Tz5KTNINb8ZA+8sQ7bmjuS1JrRT7YverYIhUGdWWDlpzVWmIwuZE+jidkEXUn1l0zrEkaIMa8dHF3NGcsA==",
|
| 579 |
+
"cpu": [
|
| 580 |
+
"arm"
|
| 581 |
+
],
|
| 582 |
+
"dev": true,
|
| 583 |
+
"license": "MIT",
|
| 584 |
+
"optional": true,
|
| 585 |
+
"os": [
|
| 586 |
+
"linux"
|
| 587 |
+
]
|
| 588 |
+
},
|
| 589 |
+
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
| 590 |
+
"version": "4.63.4",
|
| 591 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.4.tgz",
|
| 592 |
+
"integrity": "sha512-VcQ3L1tjnkKzWjryAVaFhHEWcqOfICX9uxVVoDzm2t0DpgKRHd2zOpVrJc0xsWeBZcBFyYROCIBdyR/fS174pg==",
|
| 593 |
+
"cpu": [
|
| 594 |
+
"arm64"
|
| 595 |
+
],
|
| 596 |
+
"dev": true,
|
| 597 |
+
"license": "MIT",
|
| 598 |
+
"optional": true,
|
| 599 |
+
"os": [
|
| 600 |
+
"linux"
|
| 601 |
+
]
|
| 602 |
+
},
|
| 603 |
+
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
| 604 |
+
"version": "4.63.4",
|
| 605 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.4.tgz",
|
| 606 |
+
"integrity": "sha512-6+ZQX6P5s0cMDN2Ypb8Lbm2+/sZYmZjdaYny992ujUU9UKi/4CWoJWsl1pNvjWJHNHGK51m+jKGLlh1ylb2ifQ==",
|
| 607 |
+
"cpu": [
|
| 608 |
+
"arm64"
|
| 609 |
+
],
|
| 610 |
+
"dev": true,
|
| 611 |
+
"license": "MIT",
|
| 612 |
+
"optional": true,
|
| 613 |
+
"os": [
|
| 614 |
+
"linux"
|
| 615 |
+
]
|
| 616 |
+
},
|
| 617 |
+
"node_modules/@rollup/rollup-linux-loong64-gnu": {
|
| 618 |
+
"version": "4.63.4",
|
| 619 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.4.tgz",
|
| 620 |
+
"integrity": "sha512-D72ZnvkFkBXOfzMMQLcwfPLyGkKb7HZ9/mf97B7v6/P5Lbv4oFOtSY/uHbS8lH6uKUOxoKiuokdb50XZSzzbJw==",
|
| 621 |
+
"cpu": [
|
| 622 |
+
"loong64"
|
| 623 |
+
],
|
| 624 |
+
"dev": true,
|
| 625 |
+
"license": "MIT",
|
| 626 |
+
"optional": true,
|
| 627 |
+
"os": [
|
| 628 |
+
"linux"
|
| 629 |
+
]
|
| 630 |
+
},
|
| 631 |
+
"node_modules/@rollup/rollup-linux-loong64-musl": {
|
| 632 |
+
"version": "4.63.4",
|
| 633 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.4.tgz",
|
| 634 |
+
"integrity": "sha512-piU6BxeqA3O9KSu3kRCIQQtNqFFaTu21SEV4FwaRZowpnj3bLaWPZHw+xFqCs0XlJ+aOH3PTRWGoglH+mKA/OA==",
|
| 635 |
+
"cpu": [
|
| 636 |
+
"loong64"
|
| 637 |
+
],
|
| 638 |
+
"dev": true,
|
| 639 |
+
"license": "MIT",
|
| 640 |
+
"optional": true,
|
| 641 |
+
"os": [
|
| 642 |
+
"linux"
|
| 643 |
+
]
|
| 644 |
+
},
|
| 645 |
+
"node_modules/@rollup/rollup-linux-ppc64-gnu": {
|
| 646 |
+
"version": "4.63.4",
|
| 647 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.4.tgz",
|
| 648 |
+
"integrity": "sha512-/5PGpHwqt2EEEOUs1XwzubE/ucr0dWDQ+to3zqi4Ds7EWpwtQ79wXc4JBoxqj/OwpawTsKWzJxHfSuBOq3DrWA==",
|
| 649 |
+
"cpu": [
|
| 650 |
+
"ppc64"
|
| 651 |
+
],
|
| 652 |
+
"dev": true,
|
| 653 |
+
"license": "MIT",
|
| 654 |
+
"optional": true,
|
| 655 |
+
"os": [
|
| 656 |
+
"linux"
|
| 657 |
+
]
|
| 658 |
+
},
|
| 659 |
+
"node_modules/@rollup/rollup-linux-ppc64-musl": {
|
| 660 |
+
"version": "4.63.4",
|
| 661 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.4.tgz",
|
| 662 |
+
"integrity": "sha512-cX3beZDLWt7G2oJF+nhChiT+qtaihs+S2xi7ziGmVB+2pwPng6D0Ed0HmElQOgv2UsUmSJJLGwpBao/3TDx3VA==",
|
| 663 |
+
"cpu": [
|
| 664 |
+
"ppc64"
|
| 665 |
+
],
|
| 666 |
+
"dev": true,
|
| 667 |
+
"license": "MIT",
|
| 668 |
+
"optional": true,
|
| 669 |
+
"os": [
|
| 670 |
+
"linux"
|
| 671 |
+
]
|
| 672 |
+
},
|
| 673 |
+
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
| 674 |
+
"version": "4.63.4",
|
| 675 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.4.tgz",
|
| 676 |
+
"integrity": "sha512-1uz2mGWHyptR7DgHHrlbdRAjXK7v7elGZ9lMja910/RP+ZYbX6xAmCiU9UZSX4hqmgtHMv6lr5l3kq1HIOpcag==",
|
| 677 |
+
"cpu": [
|
| 678 |
+
"riscv64"
|
| 679 |
+
],
|
| 680 |
+
"dev": true,
|
| 681 |
+
"license": "MIT",
|
| 682 |
+
"optional": true,
|
| 683 |
+
"os": [
|
| 684 |
+
"linux"
|
| 685 |
+
]
|
| 686 |
+
},
|
| 687 |
+
"node_modules/@rollup/rollup-linux-riscv64-musl": {
|
| 688 |
+
"version": "4.63.4",
|
| 689 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.4.tgz",
|
| 690 |
+
"integrity": "sha512-nLS8topojxyz7SRpKR2IODRpQ0XPZ+xaOXvT3+hqK/Uy8Lo5HFgkkIBiIrCu5tL5YqzTvgovGw55PwpahTAGig==",
|
| 691 |
+
"cpu": [
|
| 692 |
+
"riscv64"
|
| 693 |
+
],
|
| 694 |
+
"dev": true,
|
| 695 |
+
"license": "MIT",
|
| 696 |
+
"optional": true,
|
| 697 |
+
"os": [
|
| 698 |
+
"linux"
|
| 699 |
+
]
|
| 700 |
+
},
|
| 701 |
+
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
| 702 |
+
"version": "4.63.4",
|
| 703 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.4.tgz",
|
| 704 |
+
"integrity": "sha512-gs7DRKotr3l3q+jGPQBjH0ng1FjlEDm5ueQrkw5JtQvtLyEIcLASqAEaor56BhkKRzk+IcQzrcanBdb/bBQn8g==",
|
| 705 |
+
"cpu": [
|
| 706 |
+
"s390x"
|
| 707 |
+
],
|
| 708 |
+
"dev": true,
|
| 709 |
+
"license": "MIT",
|
| 710 |
+
"optional": true,
|
| 711 |
+
"os": [
|
| 712 |
+
"linux"
|
| 713 |
+
]
|
| 714 |
+
},
|
| 715 |
+
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
| 716 |
+
"version": "4.63.4",
|
| 717 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.4.tgz",
|
| 718 |
+
"integrity": "sha512-791ET7W17NnScOZM7h4dX5hYspxE28htPFsb1awY/NRR8+PRNkS53e475rDdxXXDrP+kwnCcNWg9CX5ztn/Aqw==",
|
| 719 |
+
"cpu": [
|
| 720 |
+
"x64"
|
| 721 |
+
],
|
| 722 |
+
"dev": true,
|
| 723 |
+
"license": "MIT",
|
| 724 |
+
"optional": true,
|
| 725 |
+
"os": [
|
| 726 |
+
"linux"
|
| 727 |
+
]
|
| 728 |
+
},
|
| 729 |
+
"node_modules/@rollup/rollup-linux-x64-musl": {
|
| 730 |
+
"version": "4.63.4",
|
| 731 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.4.tgz",
|
| 732 |
+
"integrity": "sha512-iwZQRcmj7g88g3tzefIrQY7qvmuA/cfYwhrDtTBhsmukO4U2huVO5W+86XacUMRvdSFVAc6kZUZy21JaRwiB9w==",
|
| 733 |
+
"cpu": [
|
| 734 |
+
"x64"
|
| 735 |
+
],
|
| 736 |
+
"dev": true,
|
| 737 |
+
"license": "MIT",
|
| 738 |
+
"optional": true,
|
| 739 |
+
"os": [
|
| 740 |
+
"linux"
|
| 741 |
+
]
|
| 742 |
+
},
|
| 743 |
+
"node_modules/@rollup/rollup-openbsd-x64": {
|
| 744 |
+
"version": "4.63.4",
|
| 745 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.4.tgz",
|
| 746 |
+
"integrity": "sha512-dVHFp9gRWrdTpnqQuGfCwd7hOQDatK1VCP2iWhLY/cGrOQs/ucFzJ6A5SRqbXX12ZDI8EUuejSM5kwg+ja7Png==",
|
| 747 |
+
"cpu": [
|
| 748 |
+
"x64"
|
| 749 |
+
],
|
| 750 |
+
"dev": true,
|
| 751 |
+
"license": "MIT",
|
| 752 |
+
"optional": true,
|
| 753 |
+
"os": [
|
| 754 |
+
"openbsd"
|
| 755 |
+
]
|
| 756 |
+
},
|
| 757 |
+
"node_modules/@rollup/rollup-openharmony-arm64": {
|
| 758 |
+
"version": "4.63.4",
|
| 759 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.4.tgz",
|
| 760 |
+
"integrity": "sha512-t3NlauOW6gxZVVFcBEnO62Cb4wbyDFL416gTg1uFI/2tgqYQlf69FbSE115Ajre9I+c26Lk4mcmdFUsS/DGifQ==",
|
| 761 |
+
"cpu": [
|
| 762 |
+
"arm64"
|
| 763 |
+
],
|
| 764 |
+
"dev": true,
|
| 765 |
+
"license": "MIT",
|
| 766 |
+
"optional": true,
|
| 767 |
+
"os": [
|
| 768 |
+
"openharmony"
|
| 769 |
+
]
|
| 770 |
+
},
|
| 771 |
+
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
| 772 |
+
"version": "4.63.4",
|
| 773 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.4.tgz",
|
| 774 |
+
"integrity": "sha512-xWuIaSye5FWZF8+UYtVEcHtRJDN5kN9Kfgxx3Kq8XIov9KSKbc1fiqQCm90SKrgQbUXZelbnUhnlUJmfSE7P9A==",
|
| 775 |
+
"cpu": [
|
| 776 |
+
"arm64"
|
| 777 |
+
],
|
| 778 |
+
"dev": true,
|
| 779 |
+
"license": "MIT",
|
| 780 |
+
"optional": true,
|
| 781 |
+
"os": [
|
| 782 |
+
"win32"
|
| 783 |
+
]
|
| 784 |
+
},
|
| 785 |
+
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
| 786 |
+
"version": "4.63.4",
|
| 787 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.4.tgz",
|
| 788 |
+
"integrity": "sha512-9ALJJUOg/ZflMJepVo2PlgsGxSaxN7SQ4Z8GoZfVlarWr6r3rkHUNsd/zAio7p4YMtChSMXPionxej4Hkf6CXQ==",
|
| 789 |
+
"cpu": [
|
| 790 |
+
"ia32"
|
| 791 |
+
],
|
| 792 |
+
"dev": true,
|
| 793 |
+
"license": "MIT",
|
| 794 |
+
"optional": true,
|
| 795 |
+
"os": [
|
| 796 |
+
"win32"
|
| 797 |
+
]
|
| 798 |
+
},
|
| 799 |
+
"node_modules/@rollup/rollup-win32-x64-gnu": {
|
| 800 |
+
"version": "4.63.4",
|
| 801 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.4.tgz",
|
| 802 |
+
"integrity": "sha512-blj9z5qx/Pv4WU0W1NMFDB97e0JH5ed+aZGywW8WCvp/NhWX/4PFAq5uu6Q0AebNn+Vo6KzUYDT++JzTT5ojlQ==",
|
| 803 |
+
"cpu": [
|
| 804 |
+
"x64"
|
| 805 |
+
],
|
| 806 |
+
"dev": true,
|
| 807 |
+
"license": "MIT",
|
| 808 |
+
"optional": true,
|
| 809 |
+
"os": [
|
| 810 |
+
"win32"
|
| 811 |
+
]
|
| 812 |
+
},
|
| 813 |
+
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
| 814 |
+
"version": "4.63.4",
|
| 815 |
+
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.4.tgz",
|
| 816 |
+
"integrity": "sha512-Erx822VRBwLa124shbj+wNXe//BOgMEctDV0m1aqTQdNO1S69DgNUCFKC1RCeZfixs1J31l6igk1ziyXErbigQ==",
|
| 817 |
+
"cpu": [
|
| 818 |
+
"x64"
|
| 819 |
+
],
|
| 820 |
+
"dev": true,
|
| 821 |
+
"license": "MIT",
|
| 822 |
+
"optional": true,
|
| 823 |
+
"os": [
|
| 824 |
+
"win32"
|
| 825 |
+
]
|
| 826 |
+
},
|
| 827 |
+
"node_modules/@types/estree": {
|
| 828 |
+
"version": "1.0.9",
|
| 829 |
+
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
|
| 830 |
+
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
|
| 831 |
+
"dev": true,
|
| 832 |
+
"license": "MIT"
|
| 833 |
+
},
|
| 834 |
+
"node_modules/esbuild": {
|
| 835 |
+
"version": "0.25.12",
|
| 836 |
+
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
|
| 837 |
+
"integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
|
| 838 |
+
"dev": true,
|
| 839 |
+
"hasInstallScript": true,
|
| 840 |
+
"license": "MIT",
|
| 841 |
+
"bin": {
|
| 842 |
+
"esbuild": "bin/esbuild"
|
| 843 |
+
},
|
| 844 |
+
"engines": {
|
| 845 |
+
"node": ">=18"
|
| 846 |
+
},
|
| 847 |
+
"optionalDependencies": {
|
| 848 |
+
"@esbuild/aix-ppc64": "0.25.12",
|
| 849 |
+
"@esbuild/android-arm": "0.25.12",
|
| 850 |
+
"@esbuild/android-arm64": "0.25.12",
|
| 851 |
+
"@esbuild/android-x64": "0.25.12",
|
| 852 |
+
"@esbuild/darwin-arm64": "0.25.12",
|
| 853 |
+
"@esbuild/darwin-x64": "0.25.12",
|
| 854 |
+
"@esbuild/freebsd-arm64": "0.25.12",
|
| 855 |
+
"@esbuild/freebsd-x64": "0.25.12",
|
| 856 |
+
"@esbuild/linux-arm": "0.25.12",
|
| 857 |
+
"@esbuild/linux-arm64": "0.25.12",
|
| 858 |
+
"@esbuild/linux-ia32": "0.25.12",
|
| 859 |
+
"@esbuild/linux-loong64": "0.25.12",
|
| 860 |
+
"@esbuild/linux-mips64el": "0.25.12",
|
| 861 |
+
"@esbuild/linux-ppc64": "0.25.12",
|
| 862 |
+
"@esbuild/linux-riscv64": "0.25.12",
|
| 863 |
+
"@esbuild/linux-s390x": "0.25.12",
|
| 864 |
+
"@esbuild/linux-x64": "0.25.12",
|
| 865 |
+
"@esbuild/netbsd-arm64": "0.25.12",
|
| 866 |
+
"@esbuild/netbsd-x64": "0.25.12",
|
| 867 |
+
"@esbuild/openbsd-arm64": "0.25.12",
|
| 868 |
+
"@esbuild/openbsd-x64": "0.25.12",
|
| 869 |
+
"@esbuild/openharmony-arm64": "0.25.12",
|
| 870 |
+
"@esbuild/sunos-x64": "0.25.12",
|
| 871 |
+
"@esbuild/win32-arm64": "0.25.12",
|
| 872 |
+
"@esbuild/win32-ia32": "0.25.12",
|
| 873 |
+
"@esbuild/win32-x64": "0.25.12"
|
| 874 |
+
}
|
| 875 |
+
},
|
| 876 |
+
"node_modules/fdir": {
|
| 877 |
+
"version": "6.5.0",
|
| 878 |
+
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
| 879 |
+
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
| 880 |
+
"dev": true,
|
| 881 |
+
"license": "MIT",
|
| 882 |
+
"engines": {
|
| 883 |
+
"node": ">=12.0.0"
|
| 884 |
+
},
|
| 885 |
+
"peerDependencies": {
|
| 886 |
+
"picomatch": "^3 || ^4"
|
| 887 |
+
},
|
| 888 |
+
"peerDependenciesMeta": {
|
| 889 |
+
"picomatch": {
|
| 890 |
+
"optional": true
|
| 891 |
+
}
|
| 892 |
+
}
|
| 893 |
+
},
|
| 894 |
+
"node_modules/fsevents": {
|
| 895 |
+
"version": "2.3.3",
|
| 896 |
+
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
| 897 |
+
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
| 898 |
+
"dev": true,
|
| 899 |
+
"hasInstallScript": true,
|
| 900 |
+
"license": "MIT",
|
| 901 |
+
"optional": true,
|
| 902 |
+
"os": [
|
| 903 |
+
"darwin"
|
| 904 |
+
],
|
| 905 |
+
"engines": {
|
| 906 |
+
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
| 907 |
+
}
|
| 908 |
+
},
|
| 909 |
+
"node_modules/nanoid": {
|
| 910 |
+
"version": "3.3.19",
|
| 911 |
+
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz",
|
| 912 |
+
"integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==",
|
| 913 |
+
"dev": true,
|
| 914 |
+
"funding": [
|
| 915 |
+
{
|
| 916 |
+
"type": "github",
|
| 917 |
+
"url": "https://github.com/sponsors/ai"
|
| 918 |
+
}
|
| 919 |
+
],
|
| 920 |
+
"license": "MIT",
|
| 921 |
+
"bin": {
|
| 922 |
+
"nanoid": "bin/nanoid.cjs"
|
| 923 |
+
},
|
| 924 |
+
"engines": {
|
| 925 |
+
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
| 926 |
+
}
|
| 927 |
+
},
|
| 928 |
+
"node_modules/picocolors": {
|
| 929 |
+
"version": "1.1.1",
|
| 930 |
+
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
| 931 |
+
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
| 932 |
+
"dev": true,
|
| 933 |
+
"license": "ISC"
|
| 934 |
+
},
|
| 935 |
+
"node_modules/picomatch": {
|
| 936 |
+
"version": "4.0.7",
|
| 937 |
+
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
|
| 938 |
+
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
|
| 939 |
+
"dev": true,
|
| 940 |
+
"license": "MIT",
|
| 941 |
+
"engines": {
|
| 942 |
+
"node": ">=12"
|
| 943 |
+
},
|
| 944 |
+
"funding": {
|
| 945 |
+
"url": "https://github.com/sponsors/jonschlinkert"
|
| 946 |
+
}
|
| 947 |
+
},
|
| 948 |
+
"node_modules/postcss": {
|
| 949 |
+
"version": "8.5.28",
|
| 950 |
+
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
| 951 |
+
"integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==",
|
| 952 |
+
"dev": true,
|
| 953 |
+
"funding": [
|
| 954 |
+
{
|
| 955 |
+
"type": "opencollective",
|
| 956 |
+
"url": "https://opencollective.com/postcss/"
|
| 957 |
+
},
|
| 958 |
+
{
|
| 959 |
+
"type": "tidelift",
|
| 960 |
+
"url": "https://tidelift.com/funding/github/npm/postcss"
|
| 961 |
+
},
|
| 962 |
+
{
|
| 963 |
+
"type": "github",
|
| 964 |
+
"url": "https://github.com/sponsors/ai"
|
| 965 |
+
}
|
| 966 |
+
],
|
| 967 |
+
"license": "MIT",
|
| 968 |
+
"dependencies": {
|
| 969 |
+
"nanoid": "^3.3.18",
|
| 970 |
+
"picocolors": "^1.1.1",
|
| 971 |
+
"source-map-js": "^1.2.1"
|
| 972 |
+
},
|
| 973 |
+
"engines": {
|
| 974 |
+
"node": "^10 || ^12 || >=14"
|
| 975 |
+
}
|
| 976 |
+
},
|
| 977 |
+
"node_modules/react": {
|
| 978 |
+
"version": "19.3.0",
|
| 979 |
+
"resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz",
|
| 980 |
+
"integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==",
|
| 981 |
+
"license": "MIT",
|
| 982 |
+
"engines": {
|
| 983 |
+
"node": ">=0.10.0"
|
| 984 |
+
}
|
| 985 |
+
},
|
| 986 |
+
"node_modules/react-dom": {
|
| 987 |
+
"version": "19.3.0",
|
| 988 |
+
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz",
|
| 989 |
+
"integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==",
|
| 990 |
+
"license": "MIT",
|
| 991 |
+
"dependencies": {
|
| 992 |
+
"scheduler": "^0.28.0"
|
| 993 |
+
},
|
| 994 |
+
"peerDependencies": {
|
| 995 |
+
"react": "^19.3.0"
|
| 996 |
+
}
|
| 997 |
+
},
|
| 998 |
+
"node_modules/rollup": {
|
| 999 |
+
"version": "4.63.4",
|
| 1000 |
+
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.4.tgz",
|
| 1001 |
+
"integrity": "sha512-4U0liVayNIoLp3GFl1FcI8561WepLnZ1rqfraGh7S9B3Ur5F9S283y8Futii7RUU2C/97tOBmBy7nYvhoiOpbQ==",
|
| 1002 |
+
"dev": true,
|
| 1003 |
+
"license": "MIT",
|
| 1004 |
+
"dependencies": {
|
| 1005 |
+
"@types/estree": "1.0.9"
|
| 1006 |
+
},
|
| 1007 |
+
"bin": {
|
| 1008 |
+
"rollup": "dist/bin/rollup"
|
| 1009 |
+
},
|
| 1010 |
+
"engines": {
|
| 1011 |
+
"node": ">=18.0.0",
|
| 1012 |
+
"npm": ">=8.0.0"
|
| 1013 |
+
},
|
| 1014 |
+
"optionalDependencies": {
|
| 1015 |
+
"@napi-rs/lzma-linux-x64-gnu": "1.5.1",
|
| 1016 |
+
"@rollup/rollup-android-arm-eabi": "4.63.4",
|
| 1017 |
+
"@rollup/rollup-android-arm64": "4.63.4",
|
| 1018 |
+
"@rollup/rollup-darwin-arm64": "4.63.4",
|
| 1019 |
+
"@rollup/rollup-darwin-x64": "4.63.4",
|
| 1020 |
+
"@rollup/rollup-freebsd-arm64": "4.63.4",
|
| 1021 |
+
"@rollup/rollup-freebsd-x64": "4.63.4",
|
| 1022 |
+
"@rollup/rollup-linux-arm-gnueabihf": "4.63.4",
|
| 1023 |
+
"@rollup/rollup-linux-arm-musleabihf": "4.63.4",
|
| 1024 |
+
"@rollup/rollup-linux-arm64-gnu": "4.63.4",
|
| 1025 |
+
"@rollup/rollup-linux-arm64-musl": "4.63.4",
|
| 1026 |
+
"@rollup/rollup-linux-loong64-gnu": "4.63.4",
|
| 1027 |
+
"@rollup/rollup-linux-loong64-musl": "4.63.4",
|
| 1028 |
+
"@rollup/rollup-linux-ppc64-gnu": "4.63.4",
|
| 1029 |
+
"@rollup/rollup-linux-ppc64-musl": "4.63.4",
|
| 1030 |
+
"@rollup/rollup-linux-riscv64-gnu": "4.63.4",
|
| 1031 |
+
"@rollup/rollup-linux-riscv64-musl": "4.63.4",
|
| 1032 |
+
"@rollup/rollup-linux-s390x-gnu": "4.63.4",
|
| 1033 |
+
"@rollup/rollup-linux-x64-gnu": "4.63.4",
|
| 1034 |
+
"@rollup/rollup-linux-x64-musl": "4.63.4",
|
| 1035 |
+
"@rollup/rollup-openbsd-x64": "4.63.4",
|
| 1036 |
+
"@rollup/rollup-openharmony-arm64": "4.63.4",
|
| 1037 |
+
"@rollup/rollup-win32-arm64-msvc": "4.63.4",
|
| 1038 |
+
"@rollup/rollup-win32-ia32-msvc": "4.63.4",
|
| 1039 |
+
"@rollup/rollup-win32-x64-gnu": "4.63.4",
|
| 1040 |
+
"@rollup/rollup-win32-x64-msvc": "4.63.4",
|
| 1041 |
+
"fsevents": "~2.3.2"
|
| 1042 |
+
}
|
| 1043 |
+
},
|
| 1044 |
+
"node_modules/scheduler": {
|
| 1045 |
+
"version": "0.28.0",
|
| 1046 |
+
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
|
| 1047 |
+
"integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
|
| 1048 |
+
"license": "MIT"
|
| 1049 |
+
},
|
| 1050 |
+
"node_modules/source-map-js": {
|
| 1051 |
+
"version": "1.2.1",
|
| 1052 |
+
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
| 1053 |
+
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
| 1054 |
+
"dev": true,
|
| 1055 |
+
"license": "BSD-3-Clause",
|
| 1056 |
+
"engines": {
|
| 1057 |
+
"node": ">=0.10.0"
|
| 1058 |
+
}
|
| 1059 |
+
},
|
| 1060 |
+
"node_modules/tinyglobby": {
|
| 1061 |
+
"version": "0.2.17",
|
| 1062 |
+
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
|
| 1063 |
+
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
|
| 1064 |
+
"dev": true,
|
| 1065 |
+
"license": "MIT",
|
| 1066 |
+
"dependencies": {
|
| 1067 |
+
"fdir": "^6.5.0",
|
| 1068 |
+
"picomatch": "^4.0.4"
|
| 1069 |
+
},
|
| 1070 |
+
"engines": {
|
| 1071 |
+
"node": ">=12.0.0"
|
| 1072 |
+
},
|
| 1073 |
+
"funding": {
|
| 1074 |
+
"url": "https://github.com/sponsors/SuperchupuDev"
|
| 1075 |
+
}
|
| 1076 |
+
},
|
| 1077 |
+
"node_modules/vite": {
|
| 1078 |
+
"version": "6.4.3",
|
| 1079 |
+
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
|
| 1080 |
+
"integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==",
|
| 1081 |
+
"dev": true,
|
| 1082 |
+
"license": "MIT",
|
| 1083 |
+
"dependencies": {
|
| 1084 |
+
"esbuild": "^0.25.0",
|
| 1085 |
+
"fdir": "^6.4.4",
|
| 1086 |
+
"picomatch": "^4.0.2",
|
| 1087 |
+
"postcss": "^8.5.3",
|
| 1088 |
+
"rollup": "^4.34.9",
|
| 1089 |
+
"tinyglobby": "^0.2.13"
|
| 1090 |
+
},
|
| 1091 |
+
"bin": {
|
| 1092 |
+
"vite": "bin/vite.js"
|
| 1093 |
+
},
|
| 1094 |
+
"engines": {
|
| 1095 |
+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
| 1096 |
+
},
|
| 1097 |
+
"funding": {
|
| 1098 |
+
"url": "https://github.com/vitejs/vite?sponsor=1"
|
| 1099 |
+
},
|
| 1100 |
+
"optionalDependencies": {
|
| 1101 |
+
"fsevents": "~2.3.3"
|
| 1102 |
+
},
|
| 1103 |
+
"peerDependencies": {
|
| 1104 |
+
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
|
| 1105 |
+
"jiti": ">=1.21.0",
|
| 1106 |
+
"less": "*",
|
| 1107 |
+
"lightningcss": "^1.21.0",
|
| 1108 |
+
"sass": "*",
|
| 1109 |
+
"sass-embedded": "*",
|
| 1110 |
+
"stylus": "*",
|
| 1111 |
+
"sugarss": "*",
|
| 1112 |
+
"terser": "^5.16.0",
|
| 1113 |
+
"tsx": "^4.8.1",
|
| 1114 |
+
"yaml": "^2.4.2"
|
| 1115 |
+
},
|
| 1116 |
+
"peerDependenciesMeta": {
|
| 1117 |
+
"@types/node": {
|
| 1118 |
+
"optional": true
|
| 1119 |
+
},
|
| 1120 |
+
"jiti": {
|
| 1121 |
+
"optional": true
|
| 1122 |
+
},
|
| 1123 |
+
"less": {
|
| 1124 |
+
"optional": true
|
| 1125 |
+
},
|
| 1126 |
+
"lightningcss": {
|
| 1127 |
+
"optional": true
|
| 1128 |
+
},
|
| 1129 |
+
"sass": {
|
| 1130 |
+
"optional": true
|
| 1131 |
+
},
|
| 1132 |
+
"sass-embedded": {
|
| 1133 |
+
"optional": true
|
| 1134 |
+
},
|
| 1135 |
+
"stylus": {
|
| 1136 |
+
"optional": true
|
| 1137 |
+
},
|
| 1138 |
+
"sugarss": {
|
| 1139 |
+
"optional": true
|
| 1140 |
+
},
|
| 1141 |
+
"terser": {
|
| 1142 |
+
"optional": true
|
| 1143 |
+
},
|
| 1144 |
+
"tsx": {
|
| 1145 |
+
"optional": true
|
| 1146 |
+
},
|
| 1147 |
+
"yaml": {
|
| 1148 |
+
"optional": true
|
| 1149 |
+
}
|
| 1150 |
+
}
|
| 1151 |
+
}
|
| 1152 |
+
}
|
| 1153 |
+
}
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"name":"iris-registration-poc","version":"0.1.0","private":true,"type":"module","scripts":{"dev":"vite --host 127.0.0.1","build":"vite build"},"dependencies":{"react":"^19.0.0","react-dom":"^19.0.0"},"devDependencies":{"vite":"^6.0.0"}}
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/src/main.jsx
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, {useState} from 'react';
|
| 2 |
+
import {createRoot} from 'react-dom/client';
|
| 3 |
+
import './style.css';
|
| 4 |
+
import ReviewSummary from './ReviewSummary';
|
| 5 |
+
import {requestAlignment} from './api';
|
| 6 |
+
|
| 7 |
+
function App(){
|
| 8 |
+
const [result,setResult]=useState(null), [busy,setBusy]=useState(false), [error,setError]=useState('');
|
| 9 |
+
const [view,setView]=useState('overlay'), [native,setNative]=useState(false);
|
| 10 |
+
const [engine,setEngine]=useState('classical');
|
| 11 |
+
async function submit(e){
|
| 12 |
+
e.preventDefault(); const data=new FormData(e.currentTarget);
|
| 13 |
+
data.set('exposure',data.get('exposure') ? 'true' : 'false');
|
| 14 |
+
data.set('local',engine === 'learned' || data.get('local') ? 'true' : 'false');
|
| 15 |
+
data.set('iris_crop_confirmed',data.get('iris_crop_confirmed') ? 'true' : 'false');
|
| 16 |
+
setBusy(true);setError('');setResult(null);
|
| 17 |
+
try{const body=await requestAlignment(data);setResult(body);setView(body.metrics.status === 'unaligned' ? 'reference' : 'overlay');}
|
| 18 |
+
catch(err){setError(err.message);}finally{setBusy(false);}
|
| 19 |
+
}
|
| 20 |
+
return <main><header><span>COMPUTER VISION / REGISTRATION REVIEW</span><h1>Iris registration lab</h1><p>Align source photographs. Inspect the detail. Keep the reference in control.</p></header>
|
| 21 |
+
<div className="layout"><aside><form onSubmit={submit}><h2>Image pair</h2><p>Use tight iris crops with the entire iris visible. Choose the better-exposed photograph as reference.</p>
|
| 22 |
+
<label>Alignment mode<select name="engine" value={engine} onChange={e=>setEngine(e.target.value)}><option value="classical">Standard</option><option value="learned">Learned iris alignment (experimental)</option></select></label>
|
| 23 |
+
{engine === "learned" && <label className="check"><input name="iris_crop_confirmed" type="checkbox" required/> Both inputs are equally sized square crops, centered on the iris (400–3000 pixels). This mode requires review.</label>}
|
| 24 |
+
<label>01 · Reference photograph<input name="reference" type="file" accept="image/jpeg,image/png" required /></label>
|
| 25 |
+
<label>02 · Moving photograph<input name="moving" type="file" accept="image/jpeg,image/png" required /></label>
|
| 26 |
+
<label className="check"><input name="exposure" type="checkbox" defaultChecked/> Lift darker image exposure</label>
|
| 27 |
+
{engine === "classical" && <label className="check"><input name="local" type="checkbox" defaultChecked/> Constrained local refinement</label>}
|
| 28 |
+
<button disabled={busy}>{busy?'Aligning photographs…':'Run alignment'}</button></form>
|
| 29 |
+
<p className="note">Source-image detail only. Every valid pair receives a review. If alignment is unreliable, the reference is preserved and both originals remain available.</p>
|
| 30 |
+
<p className="note">Local POC · 25 MB / 30 MP per image. Outputs are returned in memory; refresh clears the review.</p><a href="/benchmark/" target="_blank" rel="noreferrer">View synthetic benchmark report ↗</a>
|
| 31 |
+
{error && <p role="alert" className="error">{error}</p>}
|
| 32 |
+
{result && <ReviewSummary metrics={result.metrics}/>}
|
| 33 |
+
</aside><section className="workspace"><div className="toolbar"><select aria-label="Output view" value={view} onChange={e=>setView(e.target.value)}>{(result ? Object.keys(result.images) : ['overlay']).map(x=><option key={x}>{x}</option>)}</select><label className="check"><input type="checkbox" checked={native} onChange={e=>setNative(e.target.checked)}/>100% pixels</label>{result && <a download={view+'.png'} href={result.images[view]}>Download PNG</a>}</div>
|
| 34 |
+
{result?.metrics.status === 'unaligned' && <div className="originals"><figure><img src={result.images.reference} alt="Reference original"/><figcaption>Reference — unchanged</figcaption></figure><figure><img src={result.images.moving} alt="Second original, not aligned"/><figcaption>Second original — not aligned</figcaption></figure></div>}
|
| 35 |
+
<div className={'canvas '+(native?'native':'')}>{result?<img src={result.images[view]} alt={view+' registration output'}/>:<div className="empty"><div>◎</div><h2>Make the structures match.</h2><p>Upload two photographs to inspect alignment overlays and source-only output.</p><small>Synthetic tests establish code behavior, not real-eye accuracy.</small></div>}</div>
|
| 36 |
+
<p className="note">Overlay: doubled fibers indicate misalignment. Contribution: black = reference only, lighter areas include the moving photograph (maximum 50%). Composite is experimental. Local confidence: white = eligible for blending, not verified anatomy. Deformation: brightness shows local movement (12 levels per pixel).</p></section></div></main>;
|
| 37 |
+
}
|
| 38 |
+
createRoot(document.getElementById('root')).render(<App/>);
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/src/style.css
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*{box-sizing:border-box}body{margin:0;background:#0c1217;color:#e1e9ed;font:15px system-ui,sans-serif}main{max-width:1500px;margin:auto;padding:40px}header{margin-bottom:32px}header span{font-size:11px;letter-spacing:2px;color:#70d5b4}h1{font-size:38px;letter-spacing:-1.3px;margin:10px 0}p{line-height:1.65;color:#99aab5}h2{font-size:18px}.layout{display:grid;grid-template-columns:320px 1fr;gap:24px}aside,.workspace{background:#141e26;border:1px solid #2a3943;border-radius:14px;padding:24px}label{display:block;margin:24px 0 12px;font-size:13px}input[type=file]{display:block;max-width:100%;margin-top:12px;font-size:12px}input::file-selector-button,select{background:#253641;border:1px solid #40525d;color:#e1e9ed;padding:9px;border-radius:6px}button{background:#70d5b4;color:#0c2822;font-weight:700;border:0;border-radius:7px;padding:14px;width:100%;margin-top:20px;cursor:pointer}button:disabled{opacity:.5;cursor:wait}.check{display:flex;align-items:center;gap:8px;margin:0}.note{font-size:12px}.toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:20px}.canvas{height:620px;overflow:auto;background:#090e12;border-radius:8px;display:flex;align-items:center;justify-content:center}.canvas img{max-width:100%;max-height:100%;object-fit:contain}.canvas.native{display:block}.canvas.native img{max-width:none;max-height:none;display:block}.empty{text-align:center;max-width:360px;padding:20px}.empty>div{font-size:90px;color:#70d5b4}.empty small{color:#778b98}a{color:#70d5b4;font-size:12px}dt{color:#99aab5;font-size:12px}dd{margin:4px 0 14px}.error{color:#ffb4a8}@media(max-width:850px){main{padding:20px}.layout{grid-template-columns:1fr}.canvas{height:450px}.toolbar{flex-wrap:wrap}}
|
| 2 |
+
|
| 3 |
+
.review-summary{border-top:1px solid #40525d;margin-top:24px;padding-top:12px}.score{font-size:32px;color:#70d5b4;font-weight:700}.score small{display:block;font-size:13px;font-weight:400;color:#a9bcc7}.review-summary ul{padding-left:18px;font-size:13px;color:#b7c8d2;line-height:1.6}.review-summary li{margin:10px 0}.originals{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:20px}.originals figure{margin:0}.originals img{width:100%;max-height:230px;object-fit:contain}.originals figcaption{font-size:12px;color:#b7c8d2;text-align:center}
|
| 4 |
+
|
| 5 |
+
.review-summary table{width:100%;font-size:12px;border-collapse:collapse}.review-summary th,.review-summary td{text-align:left;border-bottom:1px solid #40525d;padding:8px 4px}form select{display:block;width:100%;margin-top:8px}
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/frontend/vite.config.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {defineConfig} from 'vite';
|
| 2 |
+
export default defineConfig({server:{proxy:{'/api':'http://127.0.0.1:8000','/benchmark':'http://127.0.0.1:8000'}}});
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-adjusted.png
ADDED
|
Git LFS Details
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-aligned.png
ADDED
|
Git LFS Details
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-checkerboard.png
ADDED
|
Git LFS Details
|
hf_workspace/hf_workspace/hf_workspace/hf_workspace/reports/identity-composite.png
ADDED
|
Git LFS Details
|