Wizzas commited on
Commit
e3d580c
·
verified ·
1 Parent(s): 64bcd46

One q95 rule for every product: Macaroni 1 and 2 no longer use the more sensitive limit

Browse files
README.md CHANGED
@@ -17,7 +17,7 @@ short_description: Live React dashboard and DINOv2 inspection on ZeroGPU
17
  Existing React UI, real DINOv2 inspection across all 12 VisA categories with an
18
  encoder fine-tuned on synthetic defects, 32,768-patch coreset normal-reference banks
19
  and heatmaps, and normal-only decision thresholds. The q95 sensitivity policy trades
20
- more false alarms for higher recall; Macaroni1/2 use the more sensitive q80 policy.
21
  Historical inspection decisions are preserved.
22
  Anonymous browser history is isolated and temporary. Sign in to the configured
23
  staff workspace for durable shared records when available. Do not treat anomaly
 
17
  Existing React UI, real DINOv2 inspection across all 12 VisA categories with an
18
  encoder fine-tuned on synthetic defects, 32,768-patch coreset normal-reference banks
19
  and heatmaps, and normal-only decision thresholds. The q95 sensitivity policy trades
20
+ more false alarms for higher recall; one rule is used for every product.
21
  Historical inspection decisions are preserved.
22
  Anonymous browser history is isolated and temporary. Sign in to the configured
23
  staff workspace for durable shared records when available. Do not treat anomaly
backend/calibration.py CHANGED
@@ -80,7 +80,8 @@ def calibrated_card(root, original):
80
 
81
  TUNED_POLICY = "tuned-normal-quantile-v1"
82
  TUNED_FILENAME = "tuned_deployment_evaluation.json"
83
- TUNED_QUANTILES = {"macaroni1": 0.8, "macaroni2": 0.8}
 
84
  TUNED_DEFAULT_QUANTILE = 0.95
85
 
86
 
 
80
 
81
  TUNED_POLICY = "tuned-normal-quantile-v1"
82
  TUNED_FILENAME = "tuned_deployment_evaluation.json"
83
+ # One rule for every product (the 95th percentile of the held-out normal scores). Per-product exceptions would go here.
84
+ TUNED_QUANTILES: dict[str, float] = {}
85
  TUNED_DEFAULT_QUANTILE = 0.95
86
 
87
 
models/highres_tuned/macaroni1.json CHANGED
@@ -6,44 +6,44 @@
6
  "profile": "dinov2_tuned_v1",
7
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
8
  "bank_sha256": "bb91183ddb84d8b0168988546c4186cf6de6512e4d72196a0a4b13fd9699d148",
9
- "threshold": 0.0831331416964531,
10
- "uncertainty_margin": 0.004156657084822655,
11
  "heatmap_scale": 0.07764787554740862,
12
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
13
  "bank_size_bytes": 23276388,
14
  "encoder_size_bytes": 44136744,
15
  "calibration": {
16
- "method": "Fixed linear 80th percentile of heldout normal scores; no anomalous calibration",
17
  "normal": 90,
18
  "anomalous": 0,
19
  "seed": 42,
20
  "policy": "tuned-normal-quantile-v1",
21
- "quantile": 0.8,
22
- "calibration_above_threshold": 18,
23
  "future_false_positive_rate_guaranteed": false
24
  },
25
  "train_normal_count": 810,
26
  "metrics": {
27
  "image_auroc": 0.9471999999999999,
28
  "average_precision": 0.9581494503739729,
29
- "precision": 0.8198198198198198,
30
- "recall": 0.91,
31
- "f1": 0.862559241706161,
32
- "false_positive_rate": 0.2,
33
  "confusion_matrix": [
34
  [
35
- 80,
36
- 20
37
  ],
38
  [
39
- 9,
40
- 91
41
  ]
42
  ],
43
  "n_images": 200,
44
  "pixel_auroc_224": 0.9962604306654536,
45
  "pixel_average_precision_224": 0.1985339563300542,
46
- "uncertain_fraction": 0.095,
47
  "latency_median_ms": null,
48
  "peak_gpu_mb": null
49
  },
 
6
  "profile": "dinov2_tuned_v1",
7
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
8
  "bank_sha256": "bb91183ddb84d8b0168988546c4186cf6de6512e4d72196a0a4b13fd9699d148",
9
+ "threshold": 0.09831828400492666,
10
+ "uncertainty_margin": 0.004915914200246334,
11
  "heatmap_scale": 0.07764787554740862,
12
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
13
  "bank_size_bytes": 23276388,
14
  "encoder_size_bytes": 44136744,
15
  "calibration": {
16
+ "method": "Fixed linear 95th percentile of heldout normal scores; no anomalous calibration",
17
  "normal": 90,
18
  "anomalous": 0,
19
  "seed": 42,
20
  "policy": "tuned-normal-quantile-v1",
21
+ "quantile": 0.95,
22
+ "calibration_above_threshold": 5,
23
  "future_false_positive_rate_guaranteed": false
24
  },
25
  "train_normal_count": 810,
26
  "metrics": {
27
  "image_auroc": 0.9471999999999999,
28
  "average_precision": 0.9581494503739729,
29
+ "precision": 0.9493670886075949,
30
+ "recall": 0.75,
31
+ "f1": 0.8379888268156425,
32
+ "false_positive_rate": 0.04,
33
  "confusion_matrix": [
34
  [
35
+ 96,
36
+ 4
37
  ],
38
  [
39
+ 25,
40
+ 75
41
  ]
42
  ],
43
  "n_images": 200,
44
  "pixel_auroc_224": 0.9962604306654536,
45
  "pixel_average_precision_224": 0.1985339563300542,
46
+ "uncertain_fraction": 0.08,
47
  "latency_median_ms": null,
48
  "peak_gpu_mb": null
49
  },
models/highres_tuned/macaroni2.json CHANGED
@@ -6,44 +6,44 @@
6
  "profile": "dinov2_tuned_v1",
7
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
8
  "bank_sha256": "565bf9acc0869b52f4ffd1f6a9d8d3c6500555fa8a5f501bdf4cefdcadc51ae5",
9
- "threshold": 0.09993447512388229,
10
- "uncertainty_margin": 0.004996723756194115,
11
  "heatmap_scale": 0.09322665214538575,
12
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
13
  "bank_size_bytes": 23254139,
14
  "encoder_size_bytes": 44136744,
15
  "calibration": {
16
- "method": "Fixed linear 80th percentile of heldout normal scores; no anomalous calibration",
17
  "normal": 90,
18
  "anomalous": 0,
19
  "seed": 42,
20
  "policy": "tuned-normal-quantile-v1",
21
- "quantile": 0.8,
22
- "calibration_above_threshold": 18,
23
  "future_false_positive_rate_guaranteed": false
24
  },
25
  "train_normal_count": 810,
26
  "metrics": {
27
  "image_auroc": 0.8969999999999999,
28
  "average_precision": 0.9032903776564074,
29
- "precision": 0.7692307692307693,
30
- "recall": 0.9,
31
- "f1": 0.8294930875576038,
32
- "false_positive_rate": 0.27,
33
  "confusion_matrix": [
34
  [
35
- 73,
36
- 27
37
  ],
38
  [
39
- 10,
40
- 90
41
  ]
42
  ],
43
  "n_images": 200,
44
  "pixel_auroc_224": 0.9940951618855306,
45
  "pixel_average_precision_224": 0.16362726373735387,
46
- "uncertain_fraction": 0.275,
47
  "latency_median_ms": null,
48
  "peak_gpu_mb": null
49
  },
 
6
  "profile": "dinov2_tuned_v1",
7
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
8
  "bank_sha256": "565bf9acc0869b52f4ffd1f6a9d8d3c6500555fa8a5f501bdf4cefdcadc51ae5",
9
+ "threshold": 0.10864300690591334,
10
+ "uncertainty_margin": 0.005432150345295667,
11
  "heatmap_scale": 0.09322665214538575,
12
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
13
  "bank_size_bytes": 23254139,
14
  "encoder_size_bytes": 44136744,
15
  "calibration": {
16
+ "method": "Fixed linear 95th percentile of heldout normal scores; no anomalous calibration",
17
  "normal": 90,
18
  "anomalous": 0,
19
  "seed": 42,
20
  "policy": "tuned-normal-quantile-v1",
21
+ "quantile": 0.95,
22
+ "calibration_above_threshold": 5,
23
  "future_false_positive_rate_guaranteed": false
24
  },
25
  "train_normal_count": 810,
26
  "metrics": {
27
  "image_auroc": 0.8969999999999999,
28
  "average_precision": 0.9032903776564074,
29
+ "precision": 0.8902439024390244,
30
+ "recall": 0.73,
31
+ "f1": 0.8021978021978022,
32
+ "false_positive_rate": 0.09,
33
  "confusion_matrix": [
34
  [
35
+ 91,
36
+ 9
37
  ],
38
  [
39
+ 27,
40
+ 73
41
  ]
42
  ],
43
  "n_images": 200,
44
  "pixel_auroc_224": 0.9940951618855306,
45
  "pixel_average_precision_224": 0.16362726373735387,
46
+ "uncertain_fraction": 0.205,
47
  "latency_median_ms": null,
48
  "peak_gpu_mb": null
49
  },
results/tuned_deployment_evaluation.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "method": "AnomalyDINO-inspired DINOv2 ViT-S/14 fine-tuned on synthetic defects; 32,768-patch coreset memory",
3
  "profile": "dinov2_tuned_v1",
4
- "protocol": "Official VisA test assignments. The DINOv2 encoder was fine-tuned on synthetic defects made from normal training images (last 4 blocks only). The memory bank is a 32,768-patch coreset of normal-image patches per product. Thresholds are the 95th percentile of held-out normal scores (80th for Macaroni 1 and 2); held-out normals are never used to build the memory. Retrospective development evaluation on test images that were seen during development; not an untouched external test.",
5
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
6
  "device": "cuda",
7
  "categories": {
@@ -337,44 +337,44 @@
337
  "profile": "dinov2_tuned_v1",
338
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
339
  "bank_sha256": "bb91183ddb84d8b0168988546c4186cf6de6512e4d72196a0a4b13fd9699d148",
340
- "threshold": 0.0831331416964531,
341
- "uncertainty_margin": 0.004156657084822655,
342
  "heatmap_scale": 0.07764787554740862,
343
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
344
  "bank_size_bytes": 23276388,
345
  "encoder_size_bytes": 44136744,
346
  "calibration": {
347
- "method": "Fixed linear 80th percentile of heldout normal scores; no anomalous calibration",
348
  "normal": 90,
349
  "anomalous": 0,
350
  "seed": 42,
351
  "policy": "tuned-normal-quantile-v1",
352
- "quantile": 0.8,
353
- "calibration_above_threshold": 18,
354
  "future_false_positive_rate_guaranteed": false
355
  },
356
  "train_normal_count": 810,
357
  "metrics": {
358
  "image_auroc": 0.9471999999999999,
359
  "average_precision": 0.9581494503739729,
360
- "precision": 0.8198198198198198,
361
- "recall": 0.91,
362
- "f1": 0.862559241706161,
363
- "false_positive_rate": 0.2,
364
  "confusion_matrix": [
365
  [
366
- 80,
367
- 20
368
  ],
369
  [
370
- 9,
371
- 91
372
  ]
373
  ],
374
  "n_images": 200,
375
  "pixel_auroc_224": 0.9962604306654536,
376
  "pixel_average_precision_224": 0.1985339563300542,
377
- "uncertain_fraction": 0.095,
378
  "latency_median_ms": null,
379
  "peak_gpu_mb": null
380
  },
@@ -391,44 +391,44 @@
391
  "profile": "dinov2_tuned_v1",
392
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
393
  "bank_sha256": "565bf9acc0869b52f4ffd1f6a9d8d3c6500555fa8a5f501bdf4cefdcadc51ae5",
394
- "threshold": 0.09993447512388229,
395
- "uncertainty_margin": 0.004996723756194115,
396
  "heatmap_scale": 0.09322665214538575,
397
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
398
  "bank_size_bytes": 23254139,
399
  "encoder_size_bytes": 44136744,
400
  "calibration": {
401
- "method": "Fixed linear 80th percentile of heldout normal scores; no anomalous calibration",
402
  "normal": 90,
403
  "anomalous": 0,
404
  "seed": 42,
405
  "policy": "tuned-normal-quantile-v1",
406
- "quantile": 0.8,
407
- "calibration_above_threshold": 18,
408
  "future_false_positive_rate_guaranteed": false
409
  },
410
  "train_normal_count": 810,
411
  "metrics": {
412
  "image_auroc": 0.8969999999999999,
413
  "average_precision": 0.9032903776564074,
414
- "precision": 0.7692307692307693,
415
- "recall": 0.9,
416
- "f1": 0.8294930875576038,
417
- "false_positive_rate": 0.27,
418
  "confusion_matrix": [
419
  [
420
- 73,
421
- 27
422
  ],
423
  [
424
- 10,
425
- 90
426
  ]
427
  ],
428
  "n_images": 200,
429
  "pixel_auroc_224": 0.9940951618855306,
430
  "pixel_average_precision_224": 0.16362726373735387,
431
- "uncertain_fraction": 0.275,
432
  "latency_median_ms": null,
433
  "peak_gpu_mb": null
434
  },
@@ -657,16 +657,16 @@
657
  "macro_mean": {
658
  "image_auroc": 0.9710709295929593,
659
  "average_precision": 0.9764210490780011,
660
- "precision": 0.917898095712363,
661
- "recall": 0.9349999999999999,
662
- "f1": 0.925494028417261,
663
- "false_positive_rate": 0.09876512651265128,
664
  "pixel_auroc_224": 0.9880497359716026,
665
  "pixel_average_precision_224": 0.46816529534999995
666
  },
667
  "decision_policy": "tuned-normal-quantile-v1",
668
  "validation_scope": "Held-out-normal thresholds and cached-score/software consistency checks; future recall and false-alarm rates are not guaranteed.",
669
- "policy_selection_context": "Same operating policy as the previous profile (q95 for every category, q80 for macaroni1/2). The test images were already seen in development, so these figures are descriptive.",
670
  "previous_profile": {
671
  "profile": "dinov2_highres_v1",
672
  "macro_mean": {
 
1
  {
2
  "method": "AnomalyDINO-inspired DINOv2 ViT-S/14 fine-tuned on synthetic defects; 32,768-patch coreset memory",
3
  "profile": "dinov2_tuned_v1",
4
+ "protocol": "Official VisA test assignments. The DINOv2 encoder was fine-tuned on synthetic defects made from normal training images (last 4 blocks only). The memory bank is a 32,768-patch coreset of normal-image patches per product. Thresholds are the 95th percentile of held-out normal scores, the same rule for every product; held-out normals are never used to build the memory. Retrospective development evaluation on test images that were seen during development; not an untouched external test.",
5
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
6
  "device": "cuda",
7
  "categories": {
 
337
  "profile": "dinov2_tuned_v1",
338
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
339
  "bank_sha256": "bb91183ddb84d8b0168988546c4186cf6de6512e4d72196a0a4b13fd9699d148",
340
+ "threshold": 0.09831828400492666,
341
+ "uncertainty_margin": 0.004915914200246334,
342
  "heatmap_scale": 0.07764787554740862,
343
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
344
  "bank_size_bytes": 23276388,
345
  "encoder_size_bytes": 44136744,
346
  "calibration": {
347
+ "method": "Fixed linear 95th percentile of heldout normal scores; no anomalous calibration",
348
  "normal": 90,
349
  "anomalous": 0,
350
  "seed": 42,
351
  "policy": "tuned-normal-quantile-v1",
352
+ "quantile": 0.95,
353
+ "calibration_above_threshold": 5,
354
  "future_false_positive_rate_guaranteed": false
355
  },
356
  "train_normal_count": 810,
357
  "metrics": {
358
  "image_auroc": 0.9471999999999999,
359
  "average_precision": 0.9581494503739729,
360
+ "precision": 0.9493670886075949,
361
+ "recall": 0.75,
362
+ "f1": 0.8379888268156425,
363
+ "false_positive_rate": 0.04,
364
  "confusion_matrix": [
365
  [
366
+ 96,
367
+ 4
368
  ],
369
  [
370
+ 25,
371
+ 75
372
  ]
373
  ],
374
  "n_images": 200,
375
  "pixel_auroc_224": 0.9962604306654536,
376
  "pixel_average_precision_224": 0.1985339563300542,
377
+ "uncertain_fraction": 0.08,
378
  "latency_median_ms": null,
379
  "peak_gpu_mb": null
380
  },
 
391
  "profile": "dinov2_tuned_v1",
392
  "encoder_sha256": "95ac11984ecae1bb14e9a0d98e85650e73365fc3d57ed49c6bfa526e0498adcb",
393
  "bank_sha256": "565bf9acc0869b52f4ffd1f6a9d8d3c6500555fa8a5f501bdf4cefdcadc51ae5",
394
+ "threshold": 0.10864300690591334,
395
+ "uncertainty_margin": 0.005432150345295667,
396
  "heatmap_scale": 0.09322665214538575,
397
  "uncertainty_policy": "Fixed \u00b15% of threshold; operational heuristic, not calibrated confidence",
398
  "bank_size_bytes": 23254139,
399
  "encoder_size_bytes": 44136744,
400
  "calibration": {
401
+ "method": "Fixed linear 95th percentile of heldout normal scores; no anomalous calibration",
402
  "normal": 90,
403
  "anomalous": 0,
404
  "seed": 42,
405
  "policy": "tuned-normal-quantile-v1",
406
+ "quantile": 0.95,
407
+ "calibration_above_threshold": 5,
408
  "future_false_positive_rate_guaranteed": false
409
  },
410
  "train_normal_count": 810,
411
  "metrics": {
412
  "image_auroc": 0.8969999999999999,
413
  "average_precision": 0.9032903776564074,
414
+ "precision": 0.8902439024390244,
415
+ "recall": 0.73,
416
+ "f1": 0.8021978021978022,
417
+ "false_positive_rate": 0.09,
418
  "confusion_matrix": [
419
  [
420
+ 91,
421
+ 9
422
  ],
423
  [
424
+ 27,
425
+ 73
426
  ]
427
  ],
428
  "n_images": 200,
429
  "pixel_auroc_224": 0.9940951618855306,
430
  "pixel_average_precision_224": 0.16362726373735387,
431
+ "uncertain_fraction": 0.205,
432
  "latency_median_ms": null,
433
  "peak_gpu_mb": null
434
  },
 
657
  "macro_mean": {
658
  "image_auroc": 0.9710709295929593,
659
  "average_precision": 0.9764210490780011,
660
+ "precision": 0.9387781292120323,
661
+ "recall": 0.9074999999999999,
662
+ "f1": 0.9211718867297343,
663
+ "false_positive_rate": 0.07043179317931793,
664
  "pixel_auroc_224": 0.9880497359716026,
665
  "pixel_average_precision_224": 0.46816529534999995
666
  },
667
  "decision_policy": "tuned-normal-quantile-v1",
668
  "validation_scope": "Held-out-normal thresholds and cached-score/software consistency checks; future recall and false-alarm rates are not guaranteed.",
669
+ "policy_selection_context": "One rule for every product: the 95th percentile of held-out normal scores. The test images were already seen in development, so these figures are descriptive.",
670
  "previous_profile": {
671
  "profile": "dinov2_highres_v1",
672
  "macro_mean": {