Spaces:
Paused
Paused
Download hf_workspace/scripts/create_client_report.py from modventures/iris: direct link, hf CLI and curl.
- Browser
- Download file 8.35 kB
-
https://huggingface.co/spaces/modventures/iris/resolve/main/hf_workspace/scripts/create_client_report.py
- Command line
-
hf download hf://spaces/modventures/iris/hf_workspace/scripts/create_client_report.py
-
curl -L -o create_client_report.py https://huggingface.co/spaces/modventures/iris/resolve/main/hf_workspace/scripts/create_client_report.py
8.35 kB
| """Results-only report of the real client baseline; no algorithm disclosures.""" | |
| import io,json,html | |
| from pathlib import Path | |
| from PIL import Image,ImageOps | |
| from reportlab.pdfgen import canvas | |
| from reportlab.lib import colors | |
| from reportlab.lib.utils import ImageReader | |
| from reportlab.platypus import Paragraph,Table,TableStyle | |
| from reportlab.lib.styles import ParagraphStyle | |
| ROOT=Path(__file__).resolve().parents[1] | |
| OUT=ROOT/'private_benchmarks/client_iris' | |
| rows=json.loads((OUT/'metrics.json').read_text()) | |
| PDF=OUT/'Client_Iris_Benchmark.pdf' | |
| W,H=595.28,841.89;M=42;INK=colors.HexColor('#172D37');GRAY=colors.HexColor('#536873');TEAL=colors.HexColor('#087E80');RED=colors.HexColor('#9D422F') | |
| c=canvas.Canvas(str(PDF),pagesize=(W,H));c.setTitle('Client Iris Samples - Initial Benchmark');c.setAuthor('Iris Registration POC') | |
| style=ParagraphStyle('body',fontName='Helvetica',fontSize=10,leading=15,textColor=GRAY) | |
| def text(s,x,y,width=511,size=10,color=GRAY): | |
| p=Paragraph(s,ParagraphStyle('p',parent=style,fontSize=size,leading=size*1.45,textColor=color));_,height=p.wrap(width,800);p.drawOn(c,x,y-height);return y-height | |
| def label(s,x,y,size=12,color=INK): | |
| c.setFillColor(color);c.setFont('Helvetica-Bold',size);c.drawString(x,y,s) | |
| def page(title,subtitle,n): | |
| c.setFillColor(TEAL);c.rect(0,H-8,W,8,fill=1,stroke=0) | |
| label('CLIENT IRIS SAMPLES / INITIAL EVALUATION',M,H-43,9,TEAL) | |
| label(title,M,H-87,25) | |
| text(subtitle,M,H-105) | |
| c.setStrokeColor(colors.HexColor('#D8E4E8'));c.line(M,47,W-M,47) | |
| text('REAL CLIENT IMAGES - PRELIMINARY RESULTS / 22 SEPTEMBER 2026',M,36,size=7) | |
| text(f'{n} / 7',W-65,36,width=30,size=8) | |
| def image(path,x,top,size,caption): | |
| with Image.open(path) as im: | |
| im=ImageOps.contain(im.convert('RGB'),(1100,1100)) | |
| buf=io.BytesIO();im.save(buf,format='JPEG',quality=93);buf.seek(0) | |
| c.drawImage(ImageReader(buf),x,top-size,width=size,height=size,preserveAspectRatio=True,anchor='c') | |
| text(caption,x,top-size-7,width=size,size=9) | |
| page('Real-image benchmark','Six client-supplied pairs evaluated using the current prototype.',1) | |
| y=H-158 | |
| label('3 pairs produced review outputs. 3 were rejected.',M,y,17,TEAL) | |
| y=text('Output generation is an operational result, not an accuracy pass. None of these pairs has an independently verified pixel-accuracy score.',M,y-15)-25 | |
| head=['Sample','Result','Finished target matched?'] | |
| data=[head]+[[r['sample'],'Review output produced' if 'metrics' in r else 'Rejected - no output','Not validated' if 'metrics' in r else 'No'] for r in rows] | |
| t=Table(data,colWidths=[60,245,206],rowHeights=[30]+[32]*6);t.setStyle(TableStyle([('BACKGROUND',(0,0),(-1,0),INK),('TEXTCOLOR',(0,0),(-1,0),colors.white),('FONTNAME',(0,0),(-1,0),'Helvetica-Bold'),('FONTNAME',(0,1),(-1,-1),'Helvetica'),('FONTSIZE',(0,0),(-1,-1),10),('VALIGN',(0,0),(-1,-1),'MIDDLE'),('LEFTPADDING',(0,0),(-1,-1),10),('ROWBACKGROUNDS',(0,1),(-1,-1),[colors.white,colors.HexColor('#F0F5F6')])])) | |
| _,height=t.wrap(511,800);t.drawOn(c,M,y-height);y-=height+28 | |
| for title,body in [ | |
| ('Scope of this test','Each sample includes two 6000 x 4000 originals and one Photoshop-finished reference. Original photographs were manually cropped to 2200 x 2200 pixels around the iris without resizing. The brighter iris crop was used as the reference. Finished client images were used only for visual comparison, never as processing inputs.'), | |
| ('What the outputs show','Samples 2, 5 and 6 produced partial review results. Remaining glare, occlusions and some fine-detail mismatch are visible. The outputs do not reproduce the client\'s isolated, finished iris presentation. Samples 1, 3 and 4 were rejected because a sufficiently reliable alignment could not be established.'), | |
| ('Accuracy and next milestone','The real pairs have no supplied ground-truth correspondence map. An honest pixel-accuracy claim requires separately checked matching landmarks and native-resolution review. These findings show that the earlier synthetic results do not establish readiness on real photographs. Further development and client review are required.')]: | |
| label(title,M,y,12);y=text(body,M,y-12,size=9.5)-21 | |
| c.showPage() | |
| reasons={'1':'Too few dependable correspondences to produce an alignment.','3':'The initial alignment could not be verified reliably.','4':'The photographs did not support a sufficiently reliable alignment.'} | |
| cards=[] | |
| for idx,r in enumerate(rows,2): | |
| n=r['sample'];folder=OUT/n;ok='metrics' in r | |
| status='Review output produced - not accuracy-validated' if ok else 'Rejected - no processed output' | |
| page('Sample '+n,status,idx) | |
| text(f"Reference: {r['reference']}<br/>Second original: {r['moving']}<br/>Client-finished reference: {r['manual_result']}",M,H-151,size=9) | |
| size=160;gap=15;top=H-222 | |
| image(folder/'reference.png',M,top,size,'Reference original / native crop') | |
| image(folder/'moving.png',M+size+gap,top,size,'Second original / native crop') | |
| image(folder/'manual_result.png',M+2*(size+gap),top,size,'Client-finished reference / separate framing') | |
| top-=215 | |
| if ok: | |
| image(folder/'before_overlay.png',M,top,size,'Overlay before registration') | |
| image(folder/'overlay.png',M+size+gap,top,size,'Overlay after registration') | |
| image(folder/'composite.png',M+2*(size+gap),top,size,'Prototype output / incomplete finish') | |
| y=top-size-53 | |
| label('Review finding',M,y,12) | |
| y=text('Registration produced an output, but glare and differences in fine structures remain. The client-finished image is shown at its own framing and scale; it is a visual target, not a pixel-for-pixel accuracy reference.',M,y-12,size=9.5)-19 | |
| label('Detail comparison',M,y,11) | |
| # Detail images have matching reference coordinates. Link to lossless originals in HTML. | |
| text('A 500 x 500 native-resolution detail comparison is included in the accompanying local HTML report. The original PNG outputs remain available for full-resolution inspection. No generated iris texture was introduced during processing.',M,y-12,size=9) | |
| else: | |
| label('No output issued',M,top-12,15,RED) | |
| y=text(reasons[n],M,top-27,size=11)-23 | |
| label('Review finding',M,y,12) | |
| text('This pair is a current limitation of the prototype. No substitute or generated result is presented. The original crops and client-finished reference are included for a complete record of the test.',M,y-13,size=10) | |
| c.showPage() | |
| pics=['reference','moving','manual_result']+(['before_overlay','overlay','composite'] if ok else []) | |
| panels=''.join(f'<figure><a href="{n}/{k}.png"><img loading="lazy" src="{n}/{k}.png"></a><figcaption>{html.escape(k.replace("_"," "))}</figcaption></figure>' for k in pics) | |
| details='' | |
| if ok: | |
| details='<h3>Native detail: same reference position, 500 x 500 pixels</h3><div class="grid">'+''.join(f'<figure><a href="{n}/{k}-detail.png"><img loading="lazy" src="{n}/{k}-detail.png"></a><figcaption>{k.replace("_"," ")}</figcaption></figure>' for k in ['reference','adjusted','overlay'])+'</div>' | |
| cards.append(f'<section><h2>Sample {n}: {status}</h2><p>Reference: {r["reference"]} | Second original: {r["moving"]} | Finished reference: {r["manual_result"]}</p><div class="grid">{panels}</div>{details}<p>{"Glare and fine-detail differences remain; finished target not validated." if ok else reasons[n]}</p></section>') | |
| c.save() | |
| (OUT/'index.html').write_text('<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Client iris benchmark</title><style>body{background:#111b22;color:#e2e9ed;font:16px system-ui;margin:32px auto;max-width:1500px;padding:0 24px}p{line-height:1.6;color:#b5c7d0}a{color:#7ee0be}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}figure{margin:0}img{width:100%}section{border-top:1px solid #40515b;padding-top:24px;margin-top:50px}@media(max-width:700px){.grid{grid-template-columns:1fr}}</style><h1>Real client iris benchmark</h1><p>Six real pairs. Three review outputs, three rejected. No independently verified pixel-accuracy scores. Native-resolution 2200 x 2200 manually selected crops; client-finished images used only for comparison. Click any image for its full-resolution PNG.</p><p>These results do not reproduce the finished client targets. Glare and some fine-detail misalignment remain. No generative texture processing was used.</p><a href="Client_Iris_Benchmark.pdf">Download results PDF</a>'+''.join(cards)+'</html>') | |
| print(PDF) | |