Datasets:
Download source/legacy_project/code/replay_analysis.py from Ethosoft/RefSeg-CA: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/datasets/Ethosoft/RefSeg-CA/resolve/main/source/legacy_project/code/replay_analysis.py
- Command line
-
hf download hf://datasets/Ethosoft/RefSeg-CA/source/legacy_project/code/replay_analysis.py
-
curl -L -o replay_analysis.py https://huggingface.co/datasets/Ethosoft/RefSeg-CA/resolve/main/source/legacy_project/code/replay_analysis.py
1.62 kB
| """Recompute the published scene-bootstrap summaries from archived records. | |
| This replay uses the stored fitted decisions. It does not refit calibration or | |
| modify the original results. Run analyze.py after a fresh GPU inference campaign | |
| to repeat fitting, calibration and evaluation from frozen-map measurements. | |
| """ | |
| from pathlib import Path | |
| import json,gzip | |
| import numpy as np | |
| from analyze import summarize | |
| R=Path(__file__).resolve().parents[1];A=R/'results/analysis' | |
| def main(): | |
| published=json.loads((A/'summary.json').read_text());report=[] | |
| for model in ['clipseg','groundedsam']: | |
| rows=[json.loads(l) for l in gzip.open(A/(model+'_evaluated.jsonl.gz'),'rt')] | |
| expected=[r for r in published if r['model']==model];methods=list(dict.fromkeys(r['method'] for r in expected)) | |
| observed=summarize(rows,methods);index={(r['population'],r['metric'],r['method']):r for r in expected};maxdiff=0. | |
| for r in observed: | |
| old=index[(r['population'],r['metric'],r['method'])] | |
| for k in ['estimate','lo','hi','gain','gain_lo','gain_hi']: | |
| diff=abs(r[k]-old[k]);maxdiff=max(maxdiff,diff);assert diff<1e-12,(model,k,diff) | |
| assert r['clusters']==old['clusters'] and r['units']==old['units'] | |
| assert len(observed)==len(expected) | |
| report.append({'model':model,'records':len(rows),'summary_rows':len(observed),'maximum_absolute_difference':maxdiff}) | |
| out=R/'build/replay_verification.json';out.parent.mkdir(exist_ok=True);out.write_text(json.dumps(report,indent=2));print(json.dumps(report,indent=2)) | |
| if __name__=='__main__':main() | |