unicornwhodev commited on
Commit
17133be
·
verified ·
1 Parent(s): ee2b348

Add four verified v2.5 LiteRT cascade models, Cadryl contracts and bilingual 680-image benchmark

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. README.en.md +22 -4
  3. README.md +22 -4
  4. cascade/v2.5/cascade_litert.py +123 -0
  5. cascade/v2.5/model-index.json +56 -0
  6. cascade/v2.5/source-release-manifest.json +99 -0
  7. conversion/cascade-v25/build_release_docs.py +179 -0
  8. conversion/cascade-v25/cascade_litert.py +123 -0
  9. conversion/cascade-v25/convert_models.py +334 -0
  10. conversion/cascade-v25/diagnose_detector_parity.py +60 -0
  11. conversion/cascade-v25/finalize_detector_sets.py +102 -0
  12. conversion/cascade-v25/inference.py +201 -0
  13. conversion/cascade-v25/plot_benchmark.py +28 -0
  14. conversion/cascade-v25/publish_release.py +119 -0
  15. conversion/cascade-v25/validate_cascade.py +108 -0
  16. docs/CASCADE_V25.en.md +108 -0
  17. docs/CASCADE_V25.md +108 -0
  18. docs/figures/cascade-v25-benchmark.png +3 -0
  19. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/CITATION.cff +9 -0
  20. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/LICENSE +203 -0
  21. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/NOTICE +5 -0
  22. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md +19 -0
  23. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/android_model_config.json +36 -0
  24. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/classes.json +6 -0
  25. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/conversion_validation.json +558 -0
  26. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/labels.json +8 -0
  27. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/labels.txt +1 -0
  28. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/manifest.json +69 -0
  29. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/model.tflite +3 -0
  30. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/preprocessor_config.json +22 -0
  31. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/probability_labels.json +4 -0
  32. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/runtime_contract.json +140 -0
  33. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/source.json +44 -0
  34. models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/studio_pack.json +47 -0
  35. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/CITATION.cff +9 -0
  36. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/LICENSE +203 -0
  37. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/NOTICE +5 -0
  38. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md +19 -0
  39. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/android_model_config.json +36 -0
  40. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/classes.json +6 -0
  41. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/conversion_validation.json +289 -0
  42. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/labels.json +8 -0
  43. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/labels.txt +1 -0
  44. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/manifest.json +65 -0
  45. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/model.tflite +3 -0
  46. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/preprocessor_config.json +22 -0
  47. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/runtime_contract.json +115 -0
  48. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/source.json +62 -0
  49. models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/studio_pack.json +47 -0
  50. models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/CITATION.cff +9 -0
.gitattributes CHANGED
@@ -36,3 +36,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  docs/figures/conversion-parity.png filter=lfs diff=lfs merge=lfs -text
37
  docs/figures/host-learning.png filter=lfs diff=lfs merge=lfs -text
38
  docs/figures/qualification-matrix.png filter=lfs diff=lfs merge=lfs -text
 
 
36
  docs/figures/conversion-parity.png filter=lfs diff=lfs merge=lfs -text
37
  docs/figures/host-learning.png filter=lfs diff=lfs merge=lfs -text
38
  docs/figures/qualification-matrix.png filter=lfs diff=lfs merge=lfs -text
39
+ docs/figures/cascade-v25-benchmark.png filter=lfs diff=lfs merge=lfs -text
README.en.md CHANGED
@@ -10,13 +10,31 @@ tags:
10
  # FireViewer LiteRT Models for Android
11
 
12
  Fire/smoke detection and pointing conversions for experimental Android workflows:
13
- **6 delivered variants, including 5 with trainable heads or output adapters**.
14
  Reviewed annotations can update the exposed adaptation parameters while the
15
  visual backbones remain frozen.
16
 
17
  [Usage guide](docs/USAGE.en.md) · [Conversion and SDK evidence](docs/BENCHMARKS.en.md)
18
  · [Kotlin SDK](android/README.md) · [Checkpoint lifecycle](docs/CONTINUOUS_LEARNING.en.md).
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## Catalogue and recorded qualification
21
 
22
  | Variant | Synthetic host learning | Standalone Android SDK | Vision Dataset Studio |
@@ -35,9 +53,9 @@ learning conversions. The YOLO inference-only graph is a sixth delivered variant
35
  No SegFormer graph is delivered because the optional source was unavailable.
36
  Detection adapters cannot create proposals absent from the frozen detector.
37
 
38
- **All six variants remain unqualified inside Vision Dataset Studio.** The YOLO
39
  learning SDK pass does not qualify other models, application integration or a
40
- physical ARM phone. Task accuracy, generalization and forgetting are unmeasured.
41
 
42
  ## Download and integrate
43
 
@@ -83,7 +101,7 @@ trigger an emergency alert, order an evacuation or direct emergency response.
83
 
84
  ## Documentation and revision
85
 
86
- Card updated in English on **5 October 2026**, from the public repository at
87
  [`bdcd483d5c5aadeff1b531a35b536f3530906e18`](https://huggingface.co/fireviewer/litert-models/tree/bdcd483d5c5aadeff1b531a35b536f3530906e18) and its retained reports.
88
  This update checks documentation, repository metadata and small evidence files;
89
  it does not rerun training, inference, dataset payload verification or device qualification.
 
10
  # FireViewer LiteRT Models for Android
11
 
12
  Fire/smoke detection and pointing conversions for experimental Android workflows:
13
+ **10 delivered variants: 6 historical variants (5 with trainable heads/output adapters) and 4 v2.5 inference-only cascade exports**.
14
  Reviewed annotations can update the exposed adaptation parameters while the
15
  visual backbones remain frozen.
16
 
17
  [Usage guide](docs/USAGE.en.md) · [Conversion and SDK evidence](docs/BENCHMARKS.en.md)
18
  · [Kotlin SDK](android/README.md) · [Checkpoint lifecycle](docs/CONTINUOUS_LEARNING.en.md).
19
 
20
+
21
+ ## New — v2.5 frozen cascade · 7 October 2026
22
+
23
+ Four selected RF-DETR/DINOv2 checkpoints are available as **LiteRT FP32**, with real CPU invocation/parity receipts, conventional contracts and Cadryl ModelConfig/StudioPack imports. They are **inference-only** and have no Android-device qualification. The six historical packages and their original receipts are preserved.
24
+
25
+ | Stage / Étape | LiteRT package | Input | CPU numeric parity | Android device |
26
+ |---|---|---|---|---|
27
+ | proposal | [fireviewer_rfdetr_medium_probable_fire_v25_fp32](models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .10 operating threshold · 11 inputs | Not qualified / Non qualifié |
28
+ | visible | [fireviewer_rfdetr_medium_visible_flame_v25_fp32](models/fireviewer_rfdetr_medium_visible_flame_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .25 operating threshold · 11 inputs | Not qualified / Non qualifié |
29
+ | point | [fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32](models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 5 inputs | Not qualified / Non qualifié |
30
+ | smoke | [fireviewer_dinov2_small_fire_associated_smoke_v25_fp32](models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 11 inputs | Not qualified / Non qualifié |
31
+
32
+ [English and French pipeline, contracts and scientific interpretation](docs/CASCADE_V25.md) · [Full 680-image report](reports/cascade-v25-680/REPORT.md) · [Metrics JSON](reports/cascade-v25-680/metrics.json) · [Conversion evidence](reports/cascade-v25-litert-validation.json) · [2.5 not so bad collection](https://huggingface.co/collections/fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464).
33
+
34
+ The full cascade alerts on 220/249 positive images (**88.35%**) and 49/431 negatives (**11.37%**), but localizes only 231/901 flame boxes (**25.64%**) and 178/788 tiny flames (**22.59%**) at IoU≥0.5. Proposal containment is 882/901 (**97.89%**). This is useful image suspicion, with a substantial weakness in precise tiny-flame instance localization. Point containment is not flame-base accuracy. L4 PyTorch timings are distinct from LiteRT/Android performance.
35
+
36
+ **FR :** quatre exports d'inférence FP32, contrats standard et formats Cadryl, documentation détaillée en français et anglais. Les résultats distinguent l'alerte d'image de la localisation précise des petites flammes. Aucun point/masque fumée rejeté, aucune précision de base du feu inventée, aucun nouvel entraînement.
37
+
38
  ## Catalogue and recorded qualification
39
 
40
  | Variant | Synthetic host learning | Standalone Android SDK | Vision Dataset Studio |
 
53
  No SegFormer graph is delivered because the optional source was unavailable.
54
  Detection adapters cannot create proposals absent from the frozen detector.
55
 
56
+ **The six historical variants remain unqualified inside Vision Dataset Studio.** The YOLO
57
  learning SDK pass does not qualify other models, application integration or a
58
+ physical ARM phone. For those six historical variants, task accuracy, generalization and forgetting are unmeasured.
59
 
60
  ## Download and integrate
61
 
 
101
 
102
  ## Documentation and revision
103
 
104
+ Historical catalogue documentation updated in English on **5 October 2026**, from the public repository at
105
  [`bdcd483d5c5aadeff1b531a35b536f3530906e18`](https://huggingface.co/fireviewer/litert-models/tree/bdcd483d5c5aadeff1b531a35b536f3530906e18) and its retained reports.
106
  This update checks documentation, repository metadata and small evidence files;
107
  it does not rerun training, inference, dataset payload verification or device qualification.
README.md CHANGED
@@ -10,13 +10,31 @@ tags:
10
  # FireViewer LiteRT Models for Android
11
 
12
  Fire/smoke detection and pointing conversions for experimental Android workflows:
13
- **6 delivered variants, including 5 with trainable heads or output adapters**.
14
  Reviewed annotations can update the exposed adaptation parameters while the
15
  visual backbones remain frozen.
16
 
17
  [Usage guide](docs/USAGE.en.md) · [Conversion and SDK evidence](docs/BENCHMARKS.en.md)
18
  · [Kotlin SDK](android/README.md) · [Checkpoint lifecycle](docs/CONTINUOUS_LEARNING.en.md).
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ## Catalogue and recorded qualification
21
 
22
  | Variant | Synthetic host learning | Standalone Android SDK | Vision Dataset Studio |
@@ -35,9 +53,9 @@ learning conversions. The YOLO inference-only graph is a sixth delivered variant
35
  No SegFormer graph is delivered because the optional source was unavailable.
36
  Detection adapters cannot create proposals absent from the frozen detector.
37
 
38
- **All six variants remain unqualified inside Vision Dataset Studio.** The YOLO
39
  learning SDK pass does not qualify other models, application integration or a
40
- physical ARM phone. Task accuracy, generalization and forgetting are unmeasured.
41
 
42
  ## Download and integrate
43
 
@@ -83,7 +101,7 @@ trigger an emergency alert, order an evacuation or direct emergency response.
83
 
84
  ## Documentation and revision
85
 
86
- Card updated in English on **5 October 2026**, from the public repository at
87
  [`bdcd483d5c5aadeff1b531a35b536f3530906e18`](https://huggingface.co/fireviewer/litert-models/tree/bdcd483d5c5aadeff1b531a35b536f3530906e18) and its retained reports.
88
  This update checks documentation, repository metadata and small evidence files;
89
  it does not rerun training, inference, dataset payload verification or device qualification.
 
10
  # FireViewer LiteRT Models for Android
11
 
12
  Fire/smoke detection and pointing conversions for experimental Android workflows:
13
+ **10 delivered variants: 6 historical variants (5 with trainable heads/output adapters) and 4 v2.5 inference-only cascade exports**.
14
  Reviewed annotations can update the exposed adaptation parameters while the
15
  visual backbones remain frozen.
16
 
17
  [Usage guide](docs/USAGE.en.md) · [Conversion and SDK evidence](docs/BENCHMARKS.en.md)
18
  · [Kotlin SDK](android/README.md) · [Checkpoint lifecycle](docs/CONTINUOUS_LEARNING.en.md).
19
 
20
+
21
+ ## New — v2.5 frozen cascade · 7 October 2026
22
+
23
+ Four selected RF-DETR/DINOv2 checkpoints are available as **LiteRT FP32**, with real CPU invocation/parity receipts, conventional contracts and Cadryl ModelConfig/StudioPack imports. They are **inference-only** and have no Android-device qualification. The six historical packages and their original receipts are preserved.
24
+
25
+ | Stage / Étape | LiteRT package | Input | CPU numeric parity | Android device |
26
+ |---|---|---|---|---|
27
+ | proposal | [fireviewer_rfdetr_medium_probable_fire_v25_fp32](models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .10 operating threshold · 11 inputs | Not qualified / Non qualifié |
28
+ | visible | [fireviewer_rfdetr_medium_visible_flame_v25_fp32](models/fireviewer_rfdetr_medium_visible_flame_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .25 operating threshold · 11 inputs | Not qualified / Non qualifié |
29
+ | point | [fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32](models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 5 inputs | Not qualified / Non qualifié |
30
+ | smoke | [fireviewer_dinov2_small_fire_associated_smoke_v25_fp32](models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 11 inputs | Not qualified / Non qualifié |
31
+
32
+ [English and French pipeline, contracts and scientific interpretation](docs/CASCADE_V25.md) · [Full 680-image report](reports/cascade-v25-680/REPORT.md) · [Metrics JSON](reports/cascade-v25-680/metrics.json) · [Conversion evidence](reports/cascade-v25-litert-validation.json) · [2.5 not so bad collection](https://huggingface.co/collections/fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464).
33
+
34
+ The full cascade alerts on 220/249 positive images (**88.35%**) and 49/431 negatives (**11.37%**), but localizes only 231/901 flame boxes (**25.64%**) and 178/788 tiny flames (**22.59%**) at IoU≥0.5. Proposal containment is 882/901 (**97.89%**). This is useful image suspicion, with a substantial weakness in precise tiny-flame instance localization. Point containment is not flame-base accuracy. L4 PyTorch timings are distinct from LiteRT/Android performance.
35
+
36
+ **FR :** quatre exports d'inférence FP32, contrats standard et formats Cadryl, documentation détaillée en français et anglais. Les résultats distinguent l'alerte d'image de la localisation précise des petites flammes. Aucun point/masque fumée rejeté, aucune précision de base du feu inventée, aucun nouvel entraînement.
37
+
38
  ## Catalogue and recorded qualification
39
 
40
  | Variant | Synthetic host learning | Standalone Android SDK | Vision Dataset Studio |
 
53
  No SegFormer graph is delivered because the optional source was unavailable.
54
  Detection adapters cannot create proposals absent from the frozen detector.
55
 
56
+ **The six historical variants remain unqualified inside Vision Dataset Studio.** The YOLO
57
  learning SDK pass does not qualify other models, application integration or a
58
+ physical ARM phone. For those six historical variants, task accuracy, generalization and forgetting are unmeasured.
59
 
60
  ## Download and integrate
61
 
 
101
 
102
  ## Documentation and revision
103
 
104
+ Historical catalogue documentation updated in English on **5 October 2026**, from the public repository at
105
  [`bdcd483d5c5aadeff1b531a35b536f3530906e18`](https://huggingface.co/fireviewer/litert-models/tree/bdcd483d5c5aadeff1b531a35b536f3530906e18) and its retained reports.
106
  This update checks documentation, repository metadata and small evidence files;
107
  it does not rerun training, inference, dataset payload verification or device qualification.
cascade/v2.5/cascade_litert.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FireViewer v2.5 frozen cascade, using LiteRT, NumPy and Pillow only.
2
+
3
+ Run with a local snapshot of fireviewer/litert-models. No remote code execution.
4
+ """
5
+ from pathlib import Path
6
+ import argparse, hashlib, json, math, time
7
+ import numpy as np
8
+ from PIL import Image
9
+ from ai_edge_litert.interpreter import Interpreter
10
+
11
+ FOLDERS={'proposal':'fireviewer_rfdetr_medium_probable_fire_v25_fp32',
12
+ 'visible':'fireviewer_rfdetr_medium_visible_flame_v25_fp32',
13
+ 'point':'fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32',
14
+ 'smoke':'fireviewer_dinov2_small_fire_associated_smoke_v25_fp32'}
15
+
16
+ def sha(p):
17
+ h=hashlib.sha256()
18
+ with open(p,'rb') as f:
19
+ for b in iter(lambda:f.read(8<<20),b''):h.update(b)
20
+ return h.hexdigest()
21
+
22
+ class Model:
23
+ def __init__(self,folder,threads=2):
24
+ folder=Path(folder)
25
+ self.contract=json.loads((folder/'runtime_contract.json').read_text())
26
+ self.prep=json.loads((folder/'preprocessor_config.json').read_text())
27
+ manifest=json.loads((folder/'manifest.json').read_text())
28
+ for name in ('model.tflite','runtime_contract.json','preprocessor_config.json'):
29
+ assert sha(folder/name)==manifest['files'][name]['sha256'],name
30
+ self.runtime=Interpreter(model_path=str(folder/'model.tflite'),num_threads=threads)
31
+ self.runtime.allocate_tensors();self.inputs=self.runtime.get_input_details();self.outputs=self.runtime.get_output_details()
32
+ self.positions=self.contract['logical_output_positions']
33
+ def predict(self,image):
34
+ p=self.prep
35
+ if p['interpolation']=='BILINEAR_HALF_PIXEL_FLOAT_NO_ANTIALIAS':
36
+ source=np.asarray(image.convert('RGB'),dtype=np.float32)/255
37
+ ih,iw=source.shape[:2]
38
+ yy=np.clip((np.arange(p['height'],dtype=np.float32)+.5)*np.float32(ih/p['height'])-.5,0,ih-1)
39
+ xx=np.clip((np.arange(p['width'],dtype=np.float32)+.5)*np.float32(iw/p['width'])-.5,0,iw-1)
40
+ y0=np.floor(yy).astype(np.int32);x0=np.floor(xx).astype(np.int32)
41
+ y1=np.minimum(y0+1,ih-1);x1=np.minimum(x0+1,iw-1)
42
+ wy=(yy-y0.astype(np.float32))[:,None,None];wx=(xx-x0.astype(np.float32))[None,:,None]
43
+ rgb=(source[y0[:,None],x0[None,:]]*(1-wx)+source[y0[:,None],x1[None,:]]*wx)*(1-wy)+(source[y1[:,None],x0[None,:]]*(1-wx)+source[y1[:,None],x1[None,:]]*wx)*wy
44
+ else:
45
+ interpolation=Image.Resampling.BICUBIC if p['interpolation']=='PIL_BICUBIC' else Image.Resampling.BILINEAR
46
+ rgb=np.asarray(image.convert('RGB').resize((p['width'],p['height']),interpolation),dtype=np.float32)/255
47
+ x=((rgb-np.asarray(p['image_mean'],dtype=np.float32))/np.asarray(p['image_std'],dtype=np.float32))
48
+ x=np.ascontiguousarray(x.transpose(2,0,1)[None],dtype=np.float32)
49
+ self.runtime.set_tensor(self.inputs[0]['index'],x);self.runtime.invoke()
50
+ return {name:self.runtime.get_tensor(self.outputs[position]['index']) for name,position in self.positions.items()}
51
+ def detect(self,image,threshold):
52
+ output=self.predict(image);boxes=output['boxes'][0];logits=output['logits'][0]
53
+ # Stable native top-300 across query/class pairs; exclude unused background.
54
+ probs=1/(1+np.exp(-np.clip(logits,-80,80)))
55
+ flat=probs.ravel();indices=np.argsort(-flat,kind='stable')[:300]
56
+ active=indices%logits.shape[-1]==0;indices=indices[active]
57
+ scores=flat[indices];keep=scores>threshold
58
+ selected=boxes[indices[keep]//logits.shape[-1]]
59
+ center=selected[:,:2];half=selected[:,2:]/2
60
+ xyxy=np.concatenate((center-half,center+half),axis=1)*np.array([image.width,image.height]*2)
61
+ # Native RF-DETR predict returns unbounded boxes. Clip the expanded ROI
62
+ # and final mapped flame boxes later, preserving the proposal geometry.
63
+ return xyxy.tolist(),scores[keep].tolist()
64
+
65
+ def area(b):return max(0,b[2]-b[0])*max(0,b[3]-b[1])
66
+ def iou(a,b):
67
+ inter=area([max(a[0],b[0]),max(a[1],b[1]),min(a[2],b[2]),min(a[3],b[3])])
68
+ return inter/max(1e-12,area(a)+area(b)-inter)
69
+ def nms(boxes,scores,threshold,limit):
70
+ keep=[]
71
+ for i in sorted(range(len(scores)),key=lambda i:(-float(scores[i]),i)):
72
+ if area(boxes[i])>0 and all(iou(boxes[i],boxes[j])<=threshold for j in keep):keep.append(i)
73
+ if len(keep)>=limit:break
74
+ return keep
75
+ def expand_roi(box,size,context,min_side):
76
+ width,height=size;x0,y0,x1,y1=map(float,box);cx,cy=(x0+x1)/2,(y0+y1)/2
77
+ w=max(min_side,(x1-x0)*(1+2*context));h=max(min_side,(y1-y0)*(1+2*context))
78
+ return [max(0,math.floor(cx-w/2)),max(0,math.floor(cy-h/2)),min(width,math.ceil(cx+w/2)),min(height,math.ceil(cy+h/2))]
79
+ def tight_roi(box,size):
80
+ width,height=size
81
+ return [max(0,math.floor(box[0])),max(0,math.floor(box[1])),min(width,math.ceil(box[2])),min(height,math.ceil(box[3]))]
82
+
83
+ class Cascade:
84
+ def __init__(self,root,threads=2):
85
+ root=Path(root);root=root/'models' if (root/'models').is_dir() else root
86
+ self.models={role:Model(root/name,threads) for role,name in FOLDERS.items()}
87
+ def __call__(self,image):
88
+ proposal=self.models['proposal'];visible=self.models['visible']
89
+ proposals,proposal_scores=proposal.detect(image,.10)
90
+ boxes=[];scores=[];rois=[]
91
+ for i in nms(proposals,proposal_scores,.75,6):
92
+ roi=expand_roi(proposals[i],image.size,.30,128)
93
+ found,conf=visible.detect(image.crop(roi),.25)
94
+ for b,score in zip(found,conf):
95
+ mapped=[max(roi[0],b[0]+roi[0]),max(roi[1],b[1]+roi[1]),min(roi[2],b[2]+roi[0]),min(roi[3],b[3]+roi[1])]
96
+ if area(mapped)>0:boxes.append(mapped);scores.append(score)
97
+ rois.append(dict(proposal_bbox_xyxy=proposals[i],proposal_score=proposal_scores[i],visible_flame_found=bool(found)))
98
+ flames=[]
99
+ for i in nms(boxes,scores,.60,100):
100
+ roi=tight_roi(boxes[i],image.size);crop=image.crop(roi)
101
+ uv=self.models['point'].predict(crop)['point_normalized'][0,0].tolist()
102
+ point=[uv[0]*crop.width,uv[1]*crop.height]
103
+ flames.append(dict(bbox_xyxy=boxes[i],score=scores[i],semantic='visible_flame',point=dict(
104
+ semantic='flame_base_anchor',point_normalized=uv,point_xy=point,confidence=None,
105
+ point_xy_original=[point[0]+roi[0],point[1]+roi[1]])))
106
+ smoke=[]
107
+ smoke_model=self.models['smoke'];policy=smoke_model.contract['pipeline']
108
+ for r in rois:
109
+ if r['visible_flame_found']:continue
110
+ roi=expand_roi(r['proposal_bbox_xyxy'],image.size,.45,160)
111
+ p=float(smoke_model.predict(image.crop(roi))['positive_probability'][0,0])
112
+ status='low_compatibility' if p<=policy['low_threshold'] else 'fire_smoke_probable' if p>=policy['high_threshold'] else 'ambiguous'
113
+ smoke.append(dict(roi_xyxy=roi,proposal_bbox_xyxy=r['proposal_bbox_xyxy'],
114
+ semantic='fire_associated_smoke_compatible',probability=p,status=status,source_location=None))
115
+ return dict(image_size=list(image.size),visible_flames=flames,smoke_compatibility=smoke,
116
+ detector_thresholds_calibrated=False,point_semantic='flame_base_anchor',fire_group_association_performed=False)
117
+
118
+ if __name__=='__main__':
119
+ p=argparse.ArgumentParser(description=__doc__)
120
+ p.add_argument('--root',required=True);p.add_argument('--image',required=True);p.add_argument('--output',required=True);p.add_argument('--threads',type=int,default=2)
121
+ args=p.parse_args();image=Image.open(args.image).convert('RGB');model=Cascade(args.root,args.threads)
122
+ started=time.perf_counter();result=model(image);result['latency_seconds']=time.perf_counter()-started
123
+ Path(args.output).write_text(json.dumps(result,indent=2)+'\n',encoding='utf8')
cascade/v2.5/model-index.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.cascade.litert/1",
3
+ "models": {
4
+ "proposal": {
5
+ "folder": "models/fireviewer_rfdetr_medium_probable_fire_v25_fp32",
6
+ "source": {
7
+ "repository": "fireviewer/rfdetr-medium-probable-fire-v2.5",
8
+ "revision": "e4e6d48bd42411521f7b8ab3f63b25e3805a7821",
9
+ "weights_sha256": "3157e4d09f90061b0a8deb9fd42b2db60d5978fb55872d642c5aa75338377a26",
10
+ "selected_epoch": 10,
11
+ "native_checkpoint_epoch": 10,
12
+ "source_checkpoint_sha256": "05e431638e3daf9c81c78860ad26b8b65c52765b9d934666d9d4d7da66eb565d"
13
+ },
14
+ "model_sha256": "63d7d4a7373295c18016f8be7fa7c6984f0bae6c23e0410b2c63da4e263697b9"
15
+ },
16
+ "visible": {
17
+ "folder": "models/fireviewer_rfdetr_medium_visible_flame_v25_fp32",
18
+ "source": {
19
+ "repository": "fireviewer/rfdetr-medium-visible-flame-v2.5",
20
+ "revision": "0725ddf396f37abd2fe55d4d101890c7bc5a09b0",
21
+ "weights_sha256": "47660fbbfcda5a4b5c1c5594fe16592fd9012354c83cf53a3095f37274c72485",
22
+ "selected_epoch": 8,
23
+ "native_checkpoint_epoch": 8,
24
+ "source_checkpoint_sha256": "840b5dd7b21b66805b6971a5ef3f8d2e9ecd894e33146dd3b1fefefdecfd941a"
25
+ },
26
+ "model_sha256": "5d906fdd78273a2ff37be67cc97a0296a6c1caa910d11bf1aa7b1f1cc01193ce"
27
+ },
28
+ "point": {
29
+ "folder": "models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32",
30
+ "source": {
31
+ "repository": "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
32
+ "revision": "a0a0f088c51ad9f7de966a89da958638bd4dcfbf",
33
+ "weights_sha256": "aeac16f9d7e2b401b0d1cd533681be3f922bfe7271408a4aea22b42273ec2aad",
34
+ "selected_epoch": 6,
35
+ "native_checkpoint_epoch": 6,
36
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d"
37
+ },
38
+ "model_sha256": "0d596571199fba4f20a211def0fba2ff7f4dd48391dc9c2254dce82c1729f9da"
39
+ },
40
+ "smoke": {
41
+ "folder": "models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32",
42
+ "source": {
43
+ "repository": "fireviewer/dinov2-small-fire-associated-smoke-v2.5",
44
+ "revision": "da027ca273ee693d20d4d4dfae476f5b18c06139",
45
+ "weights_sha256": "1783452a9aaf92b0ce6b31093a0e33335fa9eea1f5e84b9af64d0466c640026f",
46
+ "selected_epoch": 6,
47
+ "native_checkpoint_epoch": 3,
48
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2"
49
+ },
50
+ "model_sha256": "7c4fbcfad3c8386d6301a5fa8ad773a964870f5457df621167dd68c58b8725ae"
51
+ }
52
+ },
53
+ "test_used": false,
54
+ "point_semantic": "flame_base_anchor",
55
+ "smoke_spatial_model": false
56
+ }
cascade/v2.5/source-release-manifest.json ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.release.v2.5",
3
+ "date": "2026-10-06",
4
+ "models": {
5
+ "proposal": {
6
+ "repository": "fireviewer/rfdetr-medium-probable-fire-v2.5",
7
+ "revision": "e4e6d48bd42411521f7b8ab3f63b25e3805a7821",
8
+ "weights_sha256": "3157e4d09f90061b0a8deb9fd42b2db60d5978fb55872d642c5aa75338377a26",
9
+ "selected_epoch": 10,
10
+ "native_checkpoint_epoch": 10,
11
+ "source_checkpoint_sha256": "05e431638e3daf9c81c78860ad26b8b65c52765b9d934666d9d4d7da66eb565d"
12
+ },
13
+ "visible": {
14
+ "repository": "fireviewer/rfdetr-medium-visible-flame-v2.5",
15
+ "revision": "0725ddf396f37abd2fe55d4d101890c7bc5a09b0",
16
+ "weights_sha256": "47660fbbfcda5a4b5c1c5594fe16592fd9012354c83cf53a3095f37274c72485",
17
+ "selected_epoch": 8,
18
+ "native_checkpoint_epoch": 8,
19
+ "source_checkpoint_sha256": "840b5dd7b21b66805b6971a5ef3f8d2e9ecd894e33146dd3b1fefefdecfd941a"
20
+ },
21
+ "point": {
22
+ "repository": "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
23
+ "revision": "a0a0f088c51ad9f7de966a89da958638bd4dcfbf",
24
+ "weights_sha256": "aeac16f9d7e2b401b0d1cd533681be3f922bfe7271408a4aea22b42273ec2aad",
25
+ "selected_epoch": 6,
26
+ "native_checkpoint_epoch": 6,
27
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d"
28
+ },
29
+ "smoke": {
30
+ "repository": "fireviewer/dinov2-small-fire-associated-smoke-v2.5",
31
+ "revision": "da027ca273ee693d20d4d4dfae476f5b18c06139",
32
+ "weights_sha256": "1783452a9aaf92b0ce6b31093a0e33335fa9eea1f5e84b9af64d0466c640026f",
33
+ "selected_epoch": 6,
34
+ "native_checkpoint_epoch": 3,
35
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2"
36
+ }
37
+ },
38
+ "datasets": {
39
+ "v2.5-box-precise-and-multi-source-suplement": {
40
+ "repository": "fireviewer/v2.5-box-precise-and-multi-source-suplement",
41
+ "revision": "05a25a9f96ecded7e116e781f4d5cb1984df2fae"
42
+ },
43
+ "v2.5-specialisation-visible-fire": {
44
+ "repository": "fireviewer/v2.5-specialisation-visible-fire",
45
+ "revision": "eb7c39b335fe864928b3ad27e6748c00b5429d17"
46
+ },
47
+ "v2.5-smoke-from-fire-probability": {
48
+ "repository": "fireviewer/v2.5-smoke-from-fire-probability",
49
+ "revision": "4f9e52bb294c3e815f22e6b006d8477a6ed33957"
50
+ },
51
+ "v2.5-visible-flame-crop-monopoint": {
52
+ "repository": "fireviewer/v2.5-visible-flame-crop-monopoint",
53
+ "revision": "4f22e3fd44c77e01dade2020cc9450ced995552e"
54
+ },
55
+ "v2.5-visible-flame-full-image-multipoint": {
56
+ "repository": "fireviewer/v2.5-visible-flame-full-image-multipoint",
57
+ "revision": "0fdd1eb839006649017dba24b6f9b1dca9453ce5"
58
+ }
59
+ },
60
+ "semantic_limits": {
61
+ "points": "flame_base_anchor appearance convention, not ignition location",
62
+ "smoke": "calibrated binary compatibility only; no masks or points",
63
+ "point_scores": "pseudo-label agreement, not independent human annotation accuracy",
64
+ "detector_scores": "selected validation, not TEST or public subset re-evaluation"
65
+ },
66
+ "test_used": false,
67
+ "no_new_training": true,
68
+ "collections": {
69
+ "models": {
70
+ "slug": "fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464",
71
+ "url": "https://huggingface.co/collections/fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464",
72
+ "title": "2.5 not so bad",
73
+ "items": [
74
+ "fireviewer/rfdetr-medium-probable-fire-v2.5",
75
+ "fireviewer/rfdetr-medium-visible-flame-v2.5",
76
+ "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
77
+ "fireviewer/dinov2-small-fire-associated-smoke-v2.5"
78
+ ]
79
+ },
80
+ "datasets": {
81
+ "slug": "fireviewer/training-datasets-v25-6ac362a45c747ad9e99c9efb",
82
+ "url": "https://huggingface.co/collections/fireviewer/training-datasets-v25-6ac362a45c747ad9e99c9efb",
83
+ "title": "Training Datasets — v2.5",
84
+ "items": [
85
+ "fireviewer/v2.5-box-precise-and-multi-source-suplement",
86
+ "fireviewer/v2.5-specialisation-visible-fire",
87
+ "fireviewer/v2.5-smoke-from-fire-probability",
88
+ "fireviewer/v2.5-visible-flame-crop-monopoint",
89
+ "fireviewer/v2.5-visible-flame-full-image-multipoint"
90
+ ]
91
+ }
92
+ },
93
+ "packaging_verification": {
94
+ "tensors_roundtrip_equal": true,
95
+ "all_remote_LFS_SHA256_verified": true,
96
+ "CPU_Hub_readback_forwards": "passed",
97
+ "dataset_streaming": "see hub-dataset-check.json"
98
+ }
99
+ }
conversion/cascade-v25/build_release_docs.py ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Build additive bilingual publication files after all four exports pass."""
2
+ from pathlib import Path
3
+ import json, shutil, hashlib, requests
4
+ from convert_models import IDS, DATASETS, ROOT, OUT, sha, save
5
+
6
+ HERE=Path(__file__).parent
7
+ DOCS=OUT/'public-files'
8
+
9
+ def build():
10
+ DOCS.mkdir(parents=True,exist_ok=True)
11
+ release=json.loads((ROOT/'cascade_benchmark/release-manifest.json').read_text())
12
+ validations={}
13
+ for role,model_id in IDS.items():
14
+ folder=OUT/'models'/model_id
15
+ validation=json.loads((folder/'conversion_validation.json').read_text())
16
+ assert validation['status'] in ('passed','passed_operating_points')
17
+ assert sha(folder/'model.tflite')==validation['model_sha256']
18
+ validations[role]=validation
19
+ for name in ('LICENSE','NOTICE','CITATION.cff'):
20
+ source=HERE/'notices'/release['models'][role]['repository'].split('/')[-1]/name
21
+ assert source.is_file(),str(source)
22
+ shutil.copyfile(source,folder/name)
23
+ c=json.loads((folder/'runtime_contract.json').read_text())
24
+ if role in ('proposal','visible'):
25
+ for output in c['outputs']:
26
+ if output['semantic']=='logits':output.update(class_axis=2,class_map='native_logits_labels.json',active_class_id=0,activation='sigmoid')
27
+ elif output['semantic']=='cadryl_detections':output.update(class_map='labels.json',class_axis=1,layout='BCN',score_activation='none')
28
+ elif role=='smoke':
29
+ save(folder/'probability_labels.json',{'0':'not_fire_associated_smoke_compatible','1':'fire_associated_smoke_compatible'})
30
+ for output in c['outputs']:
31
+ if output['semantic']=='calibrated_probabilities':output.update(class_axis=1,class_map='probability_labels.json',activation='none')
32
+ else:output.update(class_map='labels.json',activation='none' if output['semantic']=='positive_probability' else 'temperature-scaled sigmoid')
33
+ c['licenses']=['LICENSE','NOTICE'];save(folder/'runtime_contract.json',c)
34
+ save(folder/'manifest.json',dict(schema='fireviewer.litert.package/1',model_id=model_id,precision='FP32',
35
+ inference_only=True,validated=True,files={p.name:dict(sha256=sha(p),bytes=p.stat().st_size)
36
+ for p in folder.iterdir() if p.is_file() and p.name!='manifest.json'}))
37
+
38
+ table='| Stage / Étape | LiteRT package | Input | CPU numeric parity | Android device |\n|---|---|---|---|---|\n'
39
+ for role,model_id in IDS.items():
40
+ v=validations[role]
41
+ scope='PASS at .10 operating threshold' if role=='proposal' else 'PASS at .25 operating threshold' if role=='visible' else 'PASS tensor outputs'
42
+ table+=f"| {role} | [{model_id}](../models/{model_id}/README.md) | {'1088' if role in ('proposal','visible') else '448'} px · batch 1 | {scope} · {v['samples']} inputs | Not qualified / Non qualifié |\n"
43
+ content='''# FireViewer v2.5 — Cascade / Cascade complète
44
+
45
+ ## English
46
+
47
+ Four frozen, selected checkpoints are now exported to inference-only LiteRT FP32. The source PyTorch revisions and safetensor digests are recorded per package. No new training, quantization, calibration or threshold tuning accompanies the conversion. Ordinary consumers use `runtime_contract.json`, per-output label maps and `preprocessor_config.json`; Cadryl uses its exact `android_model_config.json` schema or `studio_pack.json` (`vision-studio-pack/1`). The six historical packages remain available with their original scope and evidence.
48
+
49
+ '''+table+'''
50
+ ### Functional routing
51
+
52
+ ```mermaid
53
+ flowchart TD
54
+ I[RGB whole image] --> P[RF-DETR M probable_fire · 1088]
55
+ P --> R[score .10 · NMS .75 · at most 6 ROI]
56
+ R --> V[30% context · min 128px · RF-DETR M visible_flame · 1088]
57
+ V --> F[Flame boxes · score .25 · reprojection · global NMS .60]
58
+ F --> K[Tight flame crops · DINOv2-S heatmap · 448]
59
+ K --> A[One flame_base_anchor per detected flame]
60
+ V --> G[ROI without a local confirmed flame]
61
+ G --> S[45% context · min 160px · DINOv2-S smoke classifier · 448]
62
+ S --> T[Calibrated compatibility · low / ambiguous / high]
63
+ ```
64
+
65
+ Context is added on each side: expanded width and height are multiplied by `1 + 2 × context`, before the minimum side and image clipping. RF-DETR receives NCHW float32 RGB resized with half-pixel bilinear interpolation, **no antialias**, with RGB converted to float before resize; normalization is ImageNet mean `[.485,.456,.406]`, std `[.229,.224,.225]`. Point crops use Pillow bilinear; smoke crops use Pillow bicubic. All models stretch to the specified square size. The supplied NumPy/Pillow runner preserves these differences.
66
+
67
+ Proposal score ≥0.10, NMS IoU 0.75, limit 6; visible score ≥0.25 and global image-space NMS 0.60, limit 100. Tight point crops use floor for the minimum and ceil for the maximum. The heatmap point is the argmax followed by a local 5×5 softmax expectation at heatmap pixel centers. It is an appearance anchor, **not an ignition location**, geographic position or independently calibrated source confidence.
68
+
69
+ Smoke temperature is **1.1490650177001953**. Low compatibility ≤**0.30160276398937463**; high compatibility ≥**0.8199750333466715**; values between these are ambiguous and do not raise the benchmark image alarm. Smoke is a binary visual compatibility classifier. It supplies no mask, smoke-core, smoke point or origin. No learned fire-group association is performed.
70
+
71
+ ### Conventional format and Cadryl
72
+
73
+ Every package contains `model.tflite`, actual input/output shapes, output positions, class maps, preprocessing, source revision/digests, validation and a SHA256 manifest. The conventional detector outputs are all 300 normalized cxcywh boxes and raw class logits; active class is index **0**, index 1 is unused background. The supplied runner reproduces the stable native global top-300 query/class sort.
74
+
75
+ Cadryl's RF-DETR adapter skips index 0. The compatible graph therefore also exposes **YOLO-style BCN `[1,5,300]`** (`cx,cy,w,h,active probability`), preserving RF-DETR weights and architecture. The graph selects the global top 300 sigmoid query/class scores and zeros scores for unused background. Cadryl applies its configured threshold/NMS. For the visible specialist this is single-crop annotation; the complete cascade must reproject first and apply global NMS through the runner. Importing one model in Cadryl does not automatically orchestrate all four models.
76
+
77
+ **Detector conversion qualification is scoped to the frozen operating points (.10 / .25).** All-300 raw-query numerical parity fails for a few very-low-score candidates, even after set correspondence. These changes are consistent with near-tied two-stage top-k selection across FP32 backends (a diagnostic inference). Operative detection counts, boxes and scores pass the original numerical bounds; low-score raw discrepancies remain disclosed in each `conversion_validation.json` and `raw-query-diagnostic.json`. Query row identity and lower score cutoffs are not qualified. The DINOv2 heatmap/point and calibrated probabilities pass tensor-output comparisons. No numerical tolerance was loosened to hide raw-query changes.
78
+
79
+ The point graph exposes `[1,1,2]` normalized x/y and raw `[1,1,128,128]` heatmap logits. A two-coordinate Cadryl point has an implicit score of 1; **this is structural presence, not calibrated confidence**. Use the point model only on tight confirmed flame crops. The smoke graph exposes raw logit, complementary calibrated probabilities, and `[1,1]` positive probability. Cadryl annotates only high positive compatibility, while host code retains low/ambiguous/high triage.
80
+
81
+ Cadryl Android scales bitmaps with bilinear integer-pixel interpolation. Exact float-resize detector parity and bicubic smoke pixel parity on Android are not demonstrated. CPU LiteRT invocation and ModelConfig compatibility do not qualify an Android phone, APK, GPU/NPU delegate, memory budget or application accuracy. These four new graphs have **no train/save/restore signatures**. Do not apply the historical trainable-head SDK contract to them.
82
+
83
+ ### Reproduce inference
84
+
85
+ ```bash
86
+ pip install ai-edge-litert==2.2.0 numpy pillow huggingface_hub
87
+ hf download fireviewer/litert-models --revision <publication-revision> --local-dir ./fireviewer-litert
88
+ python fireviewer-litert/cascade/v2.5/cascade_litert.py --root ./fireviewer-litert --image image.jpg --output predictions.json --threads 2
89
+ ```
90
+
91
+ Pin the immutable publication revision from `reports/cascade-v25-litert-publication.json`. Check each package manifest before inference. Loading the models and each model's numerical conversion tests are separate from semantic evaluation. No test split was used during conversion. Conversion probes include annotation-derived crops solely for tensor regression; they are **not** a proposals-only semantic validation set.
92
+
93
+ The complete LiteRT runner is also compared with eager PyTorch on the same CPU on six preselected images (two distinct visual families per stratum), exercising all four stages. The original L4 outputs are retained as a separate cross-backend diagnostic. Small detector differences can cross an integer crop boundary and amplify downstream probability changes; exact end-to-end L4 equivalence is not presumed. These six numerical-regression cases do not replace the original 680-image semantic benchmark or constitute a full LiteRT rebenchmark. See [routing evidence](../reports/cascade-v25-litert-routing-validation.json).
94
+
95
+ ### Full-cascade benchmark — 680 images
96
+
97
+ Frozen PyTorch FP32 pipeline on L4; no fitting or threshold selection on this panel. Case mix: 179 flame, 70 smoke, 431 negative images, 229 visual families. There may be several views of a family; families are not verified independent fire incidents.
98
+
99
+ | Endpoint | Result | Numerator / denominator |
100
+ |---|---:|---:|
101
+ | Positive-image alarm recall | 88.35% | 220 / 249 |
102
+ | Sampled image alarm precision | 81.78% | 220 / 269 |
103
+ | Negative-image false-alarm rate | 11.37% | 49 / 431 |
104
+ | Flame-image any-branch alarm recall | 99.44% | 178 / 179 |
105
+ | Smoke-only any-branch alarm recall | 60.00% | 42 / 70 |
106
+ | Flame bbox recall, IoU ≥ .5 | 25.64% | 231 / 901 |
107
+ | Flame bbox precision, IoU ≥ .5 | 27.57% | 231 / 838 |
108
+ | Tiny flame recall | 22.59% | 178 / 788 |
109
+ | Multi-flame instance recall | 24.72% | 219 / 886 |
110
+ | Expanded-proposal containment | 97.89% | 882 / 901 |
111
+ | Point inside matched GT flame bbox | 97.84% | 226 / 231 |
112
+ | Smoke-only image with false flame | 10.00% | 7 / 70 |
113
+
114
+ An image alarm is any visible-flame output **or** high smoke compatibility; it is not a statement that every flame has a precise box. There were TP=220, FP=49, FN=29, TN=382 for image alarms; flame localization TP=231, FP=607, FN=670. Tiny means bbox area/image area ≤ `(32/1088)^2`, a protocol bin rather than original-pixel COCO-small. Proposal containment means at least 90% of the GT box lies within an expanded proposal. The 229-image one-representative-per-family panel still has tiny recall 101/399=25.31%.
115
+
116
+ **Interpretation:** stage 1 generally provides coverage, while precise instance separation/localization of small visible flames remains the primary weakness. In the inspected worst-error gallery, several small annotated flames are merged into a broader detection. This is an observed error pattern, not a proven causal attribution for every miss. Good image suspicion and low box recall can coexist. The point-in-box statistic measures consistency only: no independent human flame-base GT is available, so PCK and base accuracy are unmeasured. Smoke-only labels establish visible smoke, not independently verified fire association.
117
+
118
+ Mean end-to-end inference latency was 226.82 ms/image, median 172.44 ms, P95 458.01 ms on **L4 PyTorch**. All invoked stages, decoding, preprocessing, NMS and reprojection are included; model loading/warmup are excluded. Stage calls: proposal 680, visible 1636, point 838, smoke 855. These are not LiteRT or Android performance figures. Separate CPU LiteRT numerical-test timings are recorded per conversion, with different samples and workload.
119
+
120
+ The image-level SHA/perceptual novelty audit covered all known historical splits including private sources and legacy FASDD/Pyro-SDIS manifests. Detected neighbors and suspected FLAME1 scenes were excluded before inference. No detected duplicate proves neither unseen events nor complete unknown provenance. Sources: [DIFD](https://zenodo.org/records/15860575) and [SAINetset v8](https://huggingface.co/datasets/SAINetset/SAINetset_v8.0), whose images may include synthetic/donated material. Only 208 retained images had a visual QA pass; there is no independent human annotation audit. Ratios describe this selected correlated panel, with no independent-event confidence intervals or deployment certification.
121
+
122
+ [Full report](../reports/cascade-v25-680/REPORT.md) · [Machine-readable metrics](../reports/cascade-v25-680/metrics.json) · [Frozen release manifest](../cascade/v2.5/source-release-manifest.json)
123
+
124
+ ![Descriptive image-alert and flame-localization metrics](figures/cascade-v25-benchmark.png)
125
+
126
+ ## Français
127
+
128
+ La cascade utilise quatre checkpoints figés : propositions `probable_fire` sur image entière, spécialiste `visible_flame` dans les ROI, ancre flamme sur crop serré, puis classifieur fumée uniquement pour les ROI sans flamme locale confirmée. Les boîtes flamme sont reprojetées et dédoublonnées dans l'image entière. La fumée fournit un état bas/ambigu/haut ; aucun masque ni point fumée rejeté n'est publié. Les seuils restent ceux du benchmark, sans nouvel entraînement ni ajustement sur le lot.
129
+
130
+ Chaque export FP32 dispose d'un contrat conventionnel, des classes, des prétraitements exacts, d'un reçu de validation CPU et de SHA256. Les fichiers `android_model_config.json` et `studio_pack.json` utilisent les schémas réels de Cadryl. Le tensor BCN compatible YOLO ne change pas l'architecture RF-DETR : il évite que son indice de classe active 0 soit ignoré par l'adaptateur RF-DETR actuel. Le point normalisé est une **ancre d'apparence de flamme**, pas une origine d'incendie. Son score implicite Cadryl n'est pas une confiance calibrée. La classification fumée conserve sa température et ses deux seuils ; Cadryl ne propose que les positifs hauts.
131
+
132
+ La comparaison numérique LiteRT/PyTorch confirme le calcul sur les entrées testées. Elle ne démontre ni la précision des annotations ni le fonctionnement sur téléphone. Les différences de redimensionnement Android, les délégués GPU/NPU, la mémoire et la latence Android restent à qualifier. Les quatre nouveaux exports sont réservés à l'inférence, sans signatures d'apprentissage. L'import d'un modèle individuel dans Cadryl n'exécute pas automatiquement la cascade entière.
133
+
134
+ La qualification RF-DETR concerne les détections aux seuils figés **0,10 / 0,25**. Quelques candidats bruts de très faible score diffèrent entre les backends ; l'équivalence numérique des 300 candidats n'est donc pas validée. Ces écarts et les seuils non qualifiés sont conservés dans les reçus. Les sorties point/heatmap et les probabilités DINOv2 passent les comparaisons de tenseurs. Aucun seuil ni tolérance n'a été modifié pour masquer les écarts.
135
+
136
+ Sur 680 images, l'alerte récupère **88,35%** des images positives mais produit une alerte sur **11,37%** des négatifs. La localisation à IoU ≥ 0,5 retrouve seulement **25,64%** des boîtes flamme et **22,59%** des petites flammes. Les propositions couvrent pourtant **97,89%** des boîtes GT : le principal besoin est donc la séparation/localisation précise des instances par le spécialiste visible, sous cette distribution difficile. Les cas inspectés montrent notamment des petites flammes réunies dans une boîte trop large.
137
+
138
+ Les **97,84%** de points dans une boîte flamme GT appariée sont un contrôle de cohérence, pas une mesure de justesse de base du feu : les points GT humains indépendants manquent. Les 229 familles visuelles, les vues corrélées, les annotations de source et les données SAI potentiellement synthétiques limitent la portée de ce diagnostic. Le test historique reste verrouillé. La latence médiane **172,44 ms/image** concerne PyTorch sur L4, pas LiteRT ou Android.
139
+
140
+ ## Sources / Références
141
+
142
+ The original cards contain training recipes, selected-validation results, publication-subset differences and checkpoint provenance. Dataset rights remain source-specific. RF-DETR and DINOv2 source notices and Apache-2.0 licences are retained per package.
143
+
144
+ [LiteRT PyTorch conversion](https://ai.google.dev/edge/litert/conversion/pytorch/overview) · [Official litert-torch](https://github.com/google-ai-edge/litert-torch) · [RF-DETR](https://github.com/roboflow/rf-detr) · [DINOv2](https://github.com/facebookresearch/dinov2)
145
+ '''
146
+ (DOCS/'docs').mkdir(exist_ok=True)
147
+ for name in ('CASCADE_V25.md','CASCADE_V25.en.md'):(DOCS/'docs'/name).write_text(content,encoding='utf8')
148
+ figures=DOCS/'docs/figures';figures.mkdir(parents=True,exist_ok=True)
149
+ shutil.copyfile(HERE/'cascade-v25-benchmark.png',figures/'cascade-v25-benchmark.png')
150
+ target=DOCS/'cascade/v2.5';target.mkdir(parents=True,exist_ok=True)
151
+ shutil.copyfile(HERE/'cascade_litert.py',target/'cascade_litert.py')
152
+ save(target/'source-release-manifest.json',release)
153
+ save(target/'model-index.json',dict(schema='fireviewer.cascade.litert/1',models={role:dict(folder='models/'+model_id,
154
+ source=release['models'][role],model_sha256=validations[role]['model_sha256']) for role,model_id in IDS.items()},
155
+ test_used=False,point_semantic='flame_base_anchor',smoke_spatial_model=False))
156
+ report=DOCS/'reports/cascade-v25-680';report.mkdir(parents=True,exist_ok=True)
157
+ benchmark=ROOT/'cascade_benchmark/results-20261006-234144'
158
+ for name,expected in [('metrics.json','cb0f249fdc10b13b927ea36e88091665a9459a0602bcdfded50120147999f2c7'),
159
+ ('REPORT.md','0501fe4e7c2fd0b754ff9dbb58e7e8b18bbff8bd80845cad959abbf3a98e19c8')]:
160
+ assert sha(benchmark/name)==expected;shutil.copyfile(benchmark/name,report/name)
161
+ save(DOCS/'reports/cascade-v25-litert-validation.json',dict(status='passed_operating_cascade_components',models=validations,
162
+ android_device_tested=False,no_training=True,test_used=False))
163
+ cascade_proof=json.loads((OUT/'cascade-parity.json').read_text());assert cascade_proof['status']=='passed'
164
+ save(DOCS/'reports/cascade-v25-litert-routing-validation.json',cascade_proof)
165
+ for name in ('README.md','README.en.md'):
166
+ old=requests.get('https://huggingface.co/fireviewer/litert-models/resolve/main/'+name,timeout=30);old.raise_for_status()
167
+ text=old.text
168
+ text=text.replace('**6 delivered variants, including 5 with trainable heads or output adapters**.',
169
+ '**10 delivered variants: 6 historical variants (5 with trainable heads/output adapters) and 4 v2.5 inference-only cascade exports**.')
170
+ text=text.replace('**All six variants remain unqualified inside Vision Dataset Studio.**','**The six historical variants remain unqualified inside Vision Dataset Studio.**')
171
+ text=text.replace('Task accuracy, generalization and forgetting are unmeasured.','For those six historical variants, task accuracy, generalization and forgetting are unmeasured.')
172
+ text=text.replace('Card updated in English on **5 October 2026**','Historical catalogue documentation updated in English on **5 October 2026**')
173
+ section='''\n## New — v2.5 frozen cascade · 7 October 2026\n\nFour selected RF-DETR/DINOv2 checkpoints are available as **LiteRT FP32**, with real CPU invocation/parity receipts, conventional contracts and Cadryl ModelConfig/StudioPack imports. They are **inference-only** and have no Android-device qualification. The six historical packages and their original receipts are preserved.\n\n'''+table.replace('../models/','models/')+'''\n[English and French pipeline, contracts and scientific interpretation](docs/CASCADE_V25.md) · [Full 680-image report](reports/cascade-v25-680/REPORT.md) · [Metrics JSON](reports/cascade-v25-680/metrics.json) · [Conversion evidence](reports/cascade-v25-litert-validation.json) · [2.5 not so bad collection](https://huggingface.co/collections/fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464).\n\nThe full cascade alerts on 220/249 positive images (**88.35%**) and 49/431 negatives (**11.37%**), but localizes only 231/901 flame boxes (**25.64%**) and 178/788 tiny flames (**22.59%**) at IoU≥0.5. Proposal containment is 882/901 (**97.89%**). This is useful image suspicion, with a substantial weakness in precise tiny-flame instance localization. Point containment is not flame-base accuracy. L4 PyTorch timings are distinct from LiteRT/Android performance.\n\n**FR :** quatre exports d'inférence FP32, contrats standard et formats Cadryl, documentation détaillée en français et anglais. Les résultats distinguent l'alerte d'image de la localisation précise des petites flammes. Aucun point/masque fumée rejeté, aucune précision de base du feu inventée, aucun nouvel entraînement.\n\n'''
174
+ marker='## Catalogue and recorded qualification'
175
+ assert marker in text;text=text.replace(marker,section+marker,1)
176
+ (DOCS/name).write_text(text,encoding='utf8')
177
+ print('BILINGUAL_DOCS_AND_TEN_PACKAGE_CATALOGUE_READY',flush=True)
178
+
179
+ if __name__=='__main__':build()
conversion/cascade-v25/cascade_litert.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FireViewer v2.5 frozen cascade, using LiteRT, NumPy and Pillow only.
2
+
3
+ Run with a local snapshot of fireviewer/litert-models. No remote code execution.
4
+ """
5
+ from pathlib import Path
6
+ import argparse, hashlib, json, math, time
7
+ import numpy as np
8
+ from PIL import Image
9
+ from ai_edge_litert.interpreter import Interpreter
10
+
11
+ FOLDERS={'proposal':'fireviewer_rfdetr_medium_probable_fire_v25_fp32',
12
+ 'visible':'fireviewer_rfdetr_medium_visible_flame_v25_fp32',
13
+ 'point':'fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32',
14
+ 'smoke':'fireviewer_dinov2_small_fire_associated_smoke_v25_fp32'}
15
+
16
+ def sha(p):
17
+ h=hashlib.sha256()
18
+ with open(p,'rb') as f:
19
+ for b in iter(lambda:f.read(8<<20),b''):h.update(b)
20
+ return h.hexdigest()
21
+
22
+ class Model:
23
+ def __init__(self,folder,threads=2):
24
+ folder=Path(folder)
25
+ self.contract=json.loads((folder/'runtime_contract.json').read_text())
26
+ self.prep=json.loads((folder/'preprocessor_config.json').read_text())
27
+ manifest=json.loads((folder/'manifest.json').read_text())
28
+ for name in ('model.tflite','runtime_contract.json','preprocessor_config.json'):
29
+ assert sha(folder/name)==manifest['files'][name]['sha256'],name
30
+ self.runtime=Interpreter(model_path=str(folder/'model.tflite'),num_threads=threads)
31
+ self.runtime.allocate_tensors();self.inputs=self.runtime.get_input_details();self.outputs=self.runtime.get_output_details()
32
+ self.positions=self.contract['logical_output_positions']
33
+ def predict(self,image):
34
+ p=self.prep
35
+ if p['interpolation']=='BILINEAR_HALF_PIXEL_FLOAT_NO_ANTIALIAS':
36
+ source=np.asarray(image.convert('RGB'),dtype=np.float32)/255
37
+ ih,iw=source.shape[:2]
38
+ yy=np.clip((np.arange(p['height'],dtype=np.float32)+.5)*np.float32(ih/p['height'])-.5,0,ih-1)
39
+ xx=np.clip((np.arange(p['width'],dtype=np.float32)+.5)*np.float32(iw/p['width'])-.5,0,iw-1)
40
+ y0=np.floor(yy).astype(np.int32);x0=np.floor(xx).astype(np.int32)
41
+ y1=np.minimum(y0+1,ih-1);x1=np.minimum(x0+1,iw-1)
42
+ wy=(yy-y0.astype(np.float32))[:,None,None];wx=(xx-x0.astype(np.float32))[None,:,None]
43
+ rgb=(source[y0[:,None],x0[None,:]]*(1-wx)+source[y0[:,None],x1[None,:]]*wx)*(1-wy)+(source[y1[:,None],x0[None,:]]*(1-wx)+source[y1[:,None],x1[None,:]]*wx)*wy
44
+ else:
45
+ interpolation=Image.Resampling.BICUBIC if p['interpolation']=='PIL_BICUBIC' else Image.Resampling.BILINEAR
46
+ rgb=np.asarray(image.convert('RGB').resize((p['width'],p['height']),interpolation),dtype=np.float32)/255
47
+ x=((rgb-np.asarray(p['image_mean'],dtype=np.float32))/np.asarray(p['image_std'],dtype=np.float32))
48
+ x=np.ascontiguousarray(x.transpose(2,0,1)[None],dtype=np.float32)
49
+ self.runtime.set_tensor(self.inputs[0]['index'],x);self.runtime.invoke()
50
+ return {name:self.runtime.get_tensor(self.outputs[position]['index']) for name,position in self.positions.items()}
51
+ def detect(self,image,threshold):
52
+ output=self.predict(image);boxes=output['boxes'][0];logits=output['logits'][0]
53
+ # Stable native top-300 across query/class pairs; exclude unused background.
54
+ probs=1/(1+np.exp(-np.clip(logits,-80,80)))
55
+ flat=probs.ravel();indices=np.argsort(-flat,kind='stable')[:300]
56
+ active=indices%logits.shape[-1]==0;indices=indices[active]
57
+ scores=flat[indices];keep=scores>threshold
58
+ selected=boxes[indices[keep]//logits.shape[-1]]
59
+ center=selected[:,:2];half=selected[:,2:]/2
60
+ xyxy=np.concatenate((center-half,center+half),axis=1)*np.array([image.width,image.height]*2)
61
+ # Native RF-DETR predict returns unbounded boxes. Clip the expanded ROI
62
+ # and final mapped flame boxes later, preserving the proposal geometry.
63
+ return xyxy.tolist(),scores[keep].tolist()
64
+
65
+ def area(b):return max(0,b[2]-b[0])*max(0,b[3]-b[1])
66
+ def iou(a,b):
67
+ inter=area([max(a[0],b[0]),max(a[1],b[1]),min(a[2],b[2]),min(a[3],b[3])])
68
+ return inter/max(1e-12,area(a)+area(b)-inter)
69
+ def nms(boxes,scores,threshold,limit):
70
+ keep=[]
71
+ for i in sorted(range(len(scores)),key=lambda i:(-float(scores[i]),i)):
72
+ if area(boxes[i])>0 and all(iou(boxes[i],boxes[j])<=threshold for j in keep):keep.append(i)
73
+ if len(keep)>=limit:break
74
+ return keep
75
+ def expand_roi(box,size,context,min_side):
76
+ width,height=size;x0,y0,x1,y1=map(float,box);cx,cy=(x0+x1)/2,(y0+y1)/2
77
+ w=max(min_side,(x1-x0)*(1+2*context));h=max(min_side,(y1-y0)*(1+2*context))
78
+ return [max(0,math.floor(cx-w/2)),max(0,math.floor(cy-h/2)),min(width,math.ceil(cx+w/2)),min(height,math.ceil(cy+h/2))]
79
+ def tight_roi(box,size):
80
+ width,height=size
81
+ return [max(0,math.floor(box[0])),max(0,math.floor(box[1])),min(width,math.ceil(box[2])),min(height,math.ceil(box[3]))]
82
+
83
+ class Cascade:
84
+ def __init__(self,root,threads=2):
85
+ root=Path(root);root=root/'models' if (root/'models').is_dir() else root
86
+ self.models={role:Model(root/name,threads) for role,name in FOLDERS.items()}
87
+ def __call__(self,image):
88
+ proposal=self.models['proposal'];visible=self.models['visible']
89
+ proposals,proposal_scores=proposal.detect(image,.10)
90
+ boxes=[];scores=[];rois=[]
91
+ for i in nms(proposals,proposal_scores,.75,6):
92
+ roi=expand_roi(proposals[i],image.size,.30,128)
93
+ found,conf=visible.detect(image.crop(roi),.25)
94
+ for b,score in zip(found,conf):
95
+ mapped=[max(roi[0],b[0]+roi[0]),max(roi[1],b[1]+roi[1]),min(roi[2],b[2]+roi[0]),min(roi[3],b[3]+roi[1])]
96
+ if area(mapped)>0:boxes.append(mapped);scores.append(score)
97
+ rois.append(dict(proposal_bbox_xyxy=proposals[i],proposal_score=proposal_scores[i],visible_flame_found=bool(found)))
98
+ flames=[]
99
+ for i in nms(boxes,scores,.60,100):
100
+ roi=tight_roi(boxes[i],image.size);crop=image.crop(roi)
101
+ uv=self.models['point'].predict(crop)['point_normalized'][0,0].tolist()
102
+ point=[uv[0]*crop.width,uv[1]*crop.height]
103
+ flames.append(dict(bbox_xyxy=boxes[i],score=scores[i],semantic='visible_flame',point=dict(
104
+ semantic='flame_base_anchor',point_normalized=uv,point_xy=point,confidence=None,
105
+ point_xy_original=[point[0]+roi[0],point[1]+roi[1]])))
106
+ smoke=[]
107
+ smoke_model=self.models['smoke'];policy=smoke_model.contract['pipeline']
108
+ for r in rois:
109
+ if r['visible_flame_found']:continue
110
+ roi=expand_roi(r['proposal_bbox_xyxy'],image.size,.45,160)
111
+ p=float(smoke_model.predict(image.crop(roi))['positive_probability'][0,0])
112
+ status='low_compatibility' if p<=policy['low_threshold'] else 'fire_smoke_probable' if p>=policy['high_threshold'] else 'ambiguous'
113
+ smoke.append(dict(roi_xyxy=roi,proposal_bbox_xyxy=r['proposal_bbox_xyxy'],
114
+ semantic='fire_associated_smoke_compatible',probability=p,status=status,source_location=None))
115
+ return dict(image_size=list(image.size),visible_flames=flames,smoke_compatibility=smoke,
116
+ detector_thresholds_calibrated=False,point_semantic='flame_base_anchor',fire_group_association_performed=False)
117
+
118
+ if __name__=='__main__':
119
+ p=argparse.ArgumentParser(description=__doc__)
120
+ p.add_argument('--root',required=True);p.add_argument('--image',required=True);p.add_argument('--output',required=True);p.add_argument('--threads',type=int,default=2)
121
+ args=p.parse_args();image=Image.open(args.image).convert('RGB');model=Cascade(args.root,args.threads)
122
+ started=time.perf_counter();result=model(image);result['latency_seconds']=time.perf_counter()-started
123
+ Path(args.output).write_text(json.dumps(result,indent=2)+'\n',encoding='utf8')
conversion/cascade-v25/convert_models.py ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Convert only the four frozen FireViewer v2.5 inference checkpoints on Colab.
2
+
3
+ No training, no test selection, no credentials in artifacts. CPU FP32 exports.
4
+ """
5
+ from pathlib import Path
6
+ from datetime import datetime, timezone
7
+ import argparse, copy, gc, hashlib, importlib.metadata, io, json, os, re, shutil, sys, time, zipfile
8
+ import numpy as np
9
+ from PIL import Image
10
+ import torch
11
+ from torch import nn
12
+ import litert_torch
13
+ from ai_edge_litert.interpreter import Interpreter
14
+ from inference import load_model, preprocess, heatmap_point, tight_roi, expand_roi, nms
15
+
16
+ ROOT=Path('/content/drive/MyDrive/FireViewer/trainv2.5final1')
17
+ OUT=ROOT/'litert/20261007'
18
+ SSD=Path('/content/fireviewer-litert-execution')
19
+ IDS={'proposal':'fireviewer_rfdetr_medium_probable_fire_v25_fp32',
20
+ 'visible':'fireviewer_rfdetr_medium_visible_flame_v25_fp32',
21
+ 'point':'fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32',
22
+ 'smoke':'fireviewer_dinov2_small_fire_associated_smoke_v25_fp32'}
23
+ DATASETS={'proposal':'v2.5-box-precise-and-multi-source-suplement',
24
+ 'visible':'v2.5-specialisation-visible-fire',
25
+ 'point':'v2.5-visible-flame-crop-monopoint',
26
+ 'smoke':'v2.5-smoke-from-fire-probability'}
27
+ TOLERANCES={'boxes':{'atol':0.001,'rtol':0.001},
28
+ 'logits':{'atol':0.01,'rtol':0.001},'cadryl_detections':{'atol':0.002,'rtol':0.001},
29
+ 'heatmap_logits':{'atol':0.01,'rtol':0.001},'point_normalized':{'atol':0.005,'rtol':0.001},
30
+ 'calibrated_probabilities':{'atol':0.002,'rtol':0.001},
31
+ 'positive_probability':{'atol':0.002,'rtol':0.001},'raw_logit':{'atol':0.01,'rtol':0.001}}
32
+
33
+ def sha(path):
34
+ h=hashlib.sha256()
35
+ with open(path,'rb') as f:
36
+ for chunk in iter(lambda:f.read(8<<20),b''):h.update(chunk)
37
+ return h.hexdigest()
38
+ def save(path,value):
39
+ path=Path(path);path.parent.mkdir(parents=True,exist_ok=True)
40
+ path.write_text(json.dumps(value,indent=2,ensure_ascii=False)+'\n',encoding='utf8')
41
+ def status(role,phase,**kw):
42
+ value=dict(role=role,phase=phase,time=datetime.now(timezone.utc).isoformat(),**kw)
43
+ save(OUT/(role+'-status.json'),value)
44
+ print('LITERT_PROGRESS',json.dumps(value),flush=True)
45
+
46
+ class DetectorOutputs(nn.Module):
47
+ def __init__(self,model):super().__init__();self.model=model
48
+ def forward(self,x):
49
+ boxes,logits=self.model(x)
50
+ # Match the native RF-DETR top-300 query/class selection; active class is 0.
51
+ probability=logits.sigmoid();classes=logits.shape[-1]
52
+ score,idx=torch.topk(probability.flatten(1),300,dim=1,sorted=True)
53
+ query=idx//classes;label=idx%classes
54
+ selected=boxes.gather(1,query[:,:,None].expand(-1,-1,4))
55
+ active_score=score*(label==0).to(score.dtype)
56
+ packed=torch.cat((selected,active_score[:,:,None]),dim=2).transpose(1,2)
57
+ return boxes,logits,packed
58
+
59
+ class PointOutputs(nn.Module):
60
+ def __init__(self,model):super().__init__();self.model=model
61
+ def forward(self,x):
62
+ logits=self.model(x).float()
63
+ # LiteRT ABS accepts float32, not int64. Grid values are exact integers
64
+ # represented in float32; local support and the decoder remain identical.
65
+ n,h,w=logits.shape;peak=logits.flatten(1).argmax(1)
66
+ px=(peak%w).float();py=(peak//w).float()
67
+ yy,xx=torch.meshgrid(torch.arange(h,dtype=torch.float32,device=logits.device),
68
+ torch.arange(w,dtype=torch.float32,device=logits.device),indexing='ij')
69
+ local=(xx[None]-px[:,None,None]).abs().le(2)&(yy[None]-py[:,None,None]).abs().le(2)
70
+ p=torch.softmax(logits.masked_fill(~local,-1e4).flatten(1),dim=1).reshape_as(logits)
71
+ uv=torch.stack([(p*(xx+.5)/w).sum((1,2)),(p*(yy+.5)/h).sum((1,2))],1)
72
+ return logits[:,None],uv[:,None,:]
73
+
74
+ class SmokeOutputs(nn.Module):
75
+ def __init__(self,model,temperature):
76
+ super().__init__();self.model=model;self.temperature=float(temperature)
77
+ def forward(self,x):
78
+ logit=self.model(x).float()[:,None]
79
+ p=torch.sigmoid(logit/self.temperature)
80
+ return logit,torch.cat((1-p,p),dim=1),p
81
+
82
+ def stage(role,manifest):
83
+ entry=manifest['models'][role];name=entry['repository'].split('/')[-1]
84
+ src=ROOT/'publication/20261006/models'/name;dst=SSD/'models'/name
85
+ for member in ('config.json','model.safetensors','provenance/checkpoint-export.json'):
86
+ target=dst/member;target.parent.mkdir(parents=True,exist_ok=True)
87
+ if not target.exists() or sha(target)!=sha(src/member):shutil.copyfile(src/member,target)
88
+ assert sha(src/member)==sha(target),member
89
+ assert sha(dst/'model.safetensors')==entry['weights_sha256']
90
+ return dst
91
+
92
+ def sample_inputs(role,config):
93
+ """Fixed ordered numerical-regression panel; no metric or threshold selection."""
94
+ bench=ROOT/'cascade_benchmark'
95
+ selection=json.loads((bench/'natural-selection.json').read_text())
96
+ archive=SSD/'natural-selected.zip';archive.parent.mkdir(parents=True,exist_ok=True)
97
+ if not archive.exists():shutil.copyfile(bench/'natural-selected.zip',archive)
98
+ assert sha(archive)==selection['selected_archive_sha256']
99
+ records=sorted(selection['records'],key=lambda r:r['id'])
100
+ inputs=[];proof=[]
101
+ # 3 records of each stratum, each from a different visual family when available.
102
+ selected=[]
103
+ for group in ('flame','smoke','negative'):
104
+ seen=set()
105
+ for r in records:
106
+ if r['group']!=group:continue
107
+ family=r.get('visual_family_id',r['id'])
108
+ if family in seen:continue
109
+ seen.add(family);selected.append(r)
110
+ if len(seen)==3:break
111
+ with zipfile.ZipFile(archive) as z:
112
+ for r in selected:
113
+ payload=z.read(r['member']);image=Image.open(io.BytesIO(payload)).convert('RGB')
114
+ target=None
115
+ if role in ('point','visible'):
116
+ candidates=[a['bbox_xyxy'] for a in r['annotations'] if a['semantic']=='flame']
117
+ if candidates:
118
+ b=candidates[0]
119
+ target=tight_roi(b,image.size) if role=='point' else expand_roi(b,image.size,.30,128)
120
+ elif role=='smoke':
121
+ candidates=[a['bbox_xyxy'] for a in r['annotations'] if a['semantic']=='smoke']
122
+ if candidates:target=expand_roi(candidates[0],image.size,.45,160)
123
+ if role=='point' and target is None:continue
124
+ crop=image.crop(target) if target is not None else image
125
+ if config['model_kind']=='rfdetr':
126
+ from torchvision.transforms import functional as TVF
127
+ value=TVF.to_tensor(crop)
128
+ value=TVF.resize(value,[config['resolution'],config['resolution']],antialias=False)
129
+ value=TVF.normalize(value,config['normalization']['mean'],config['normalization']['std'])
130
+ inputs.append(value[None])
131
+ else:inputs.append(preprocess(crop,config,'cpu'))
132
+ proof.append(dict(id=r['id'],group=r['group'],source=r['source'],
133
+ member=r['member'],image_sha256=hashlib.sha256(payload).hexdigest(),crop_xyxy=target,
134
+ crop_selection='annotation-derived numerical regression only; not a proposals-only benchmark'))
135
+ # Two deterministic non-image probes check constants and non-square scene resizing separately.
136
+ side=int(config['resolution'])
137
+ for name,probe in [('normalized_zero',torch.zeros(1,3,side,side)),
138
+ ('seed42_noise',torch.randn(1,3,side,side,generator=torch.Generator().manual_seed(42))*.2)]:
139
+ inputs.append(probe);proof.append(dict(probe=name,tensor_sha256=hashlib.sha256(probe.numpy().tobytes()).hexdigest()))
140
+ save(OUT/(role+'-parity-panel.json'),dict(role=role,archive_sha256=sha(archive),
141
+ selection='fixed sorted IDs, 3 per stratum; no thresholds selected',samples=proof,tolerances=TOLERANCES))
142
+ return inputs,proof
143
+
144
+ def freeze_dino_position(model,kind,x):
145
+ if kind=='flame_point':
146
+ emb=model.backbone.embeddings
147
+ hidden=model.backbone.config.hidden_size
148
+ n=(x.shape[-1]//model.backbone.config.patch_size)**2+1
149
+ with torch.no_grad():pos=emb.interpolate_pos_encoding(torch.zeros(1,n,hidden),x.shape[-2],x.shape[-1])
150
+ emb.position_embeddings=nn.Parameter(pos.detach(),requires_grad=False)
151
+ else:
152
+ backbone=model.backbone;hidden=backbone.embed_dim;n=(x.shape[-1]//14)**2+1
153
+ with torch.no_grad():pos=backbone.interpolate_pos_encoding(torch.zeros(1,n,hidden),x.shape[-2],x.shape[-1])
154
+ backbone.pos_embed=nn.Parameter(pos.detach(),requires_grad=False)
155
+
156
+ def arrays(result):
157
+ if isinstance(result,torch.Tensor):result=(result,)
158
+ return [a.detach().cpu().numpy() for a in result]
159
+
160
+ def tensor_info(detail,position):
161
+ return dict(position=position,index=int(detail['index']),name=detail['name'],
162
+ shape=[int(s) for s in detail['shape']],dtype=np.dtype(detail['dtype']).name,
163
+ shape_signature=[int(s) for s in detail.get('shape_signature',detail['shape'])])
164
+
165
+ def contracts(role,config,manifest,folder,input_details,outputs,logical_indices,validation):
166
+ size=int(config['resolution']);semantic=config['semantic']
167
+ labels=[semantic]
168
+ task='object_detection' if role in ('proposal','visible') else 'pointing' if role=='point' else 'classification'
169
+ index=logical_indices['cadryl_detections' if task=='object_detection' else 'point_normalized' if role=='point' else 'positive_probability']
170
+ android=dict(schemaVersion=1,task=task,adapter='yolo' if task=='object_detection' else 'points' if role=='point' else 'classification',
171
+ runtime='litert_interpreter',inputWidth=size,inputHeight=size,inputChannels=3,inputType='FLOAT32',
172
+ inputLayout='NCHW',isRgb=True,resizeMode='stretch',mean=0.0,std=255.0,
173
+ channelMean=[v*255 for v in config['normalization']['mean']],
174
+ channelStd=[v*255 for v in config['normalization']['std']],threads=2,labels=labels,
175
+ threshold=.10 if role=='proposal' else .25 if role=='visible' else float(config['high_threshold']) if role=='smoke' else 0.0,
176
+ nmsIou=.75 if role=='proposal' else .60,maxDetections=6 if role=='proposal' else 100 if role=='visible' else 1,
177
+ topK=1,outputIndex=index,outputLayout='BCN' if task=='object_detection' else 'AUTO',
178
+ coordinates='normalized',yoloObjectness=False,scoreActivation='none',classOffset=0,
179
+ outputMode='boxes' if task=='object_detection' else 'points' if role=='point' else 'AUTO')
180
+ # The model exposes probabilities to Cadryl; no second sigmoid/softmax is allowed.
181
+ if role not in ('proposal','visible'):
182
+ for key in ('outputLayout','outputMode','yoloObjectness','classOffset'):android.pop(key)
183
+ save(folder/'android_model_config.json',android)
184
+ save(folder/'studio_pack.json',dict(schema='vision-studio-pack/1',name='FireViewer v2.5 '+semantic,
185
+ classes=labels,tasks=['DETECTION' if task=='object_detection' else 'POINTING' if role=='point' else 'CLASSIFICATION'],
186
+ batchSize=100,model=android))
187
+ save(folder/'labels.json',dict(id2label={str(i):s for i,s in enumerate(labels)},label2id={s:i for i,s in enumerate(labels)}))
188
+ (folder/'labels.txt').write_text('\n'.join(labels)+'\n')
189
+ save(folder/'classes.json',[dict(id=i,name=s) for i,s in enumerate(labels)])
190
+ ds=manifest['datasets'][DATASETS[role]]
191
+ save(folder/'preprocessor_config.json',dict(color_space='RGB',input_layout='NCHW',dtype='float32',
192
+ width=size,height=size,batch_size=1,resize_mode='stretch',
193
+ interpolation='PIL_BICUBIC' if role=='smoke' else 'BILINEAR_HALF_PIXEL_FLOAT_NO_ANTIALIAS' if role in ('proposal','visible') else 'PIL_BILINEAR',
194
+ rescale_factor=1/255,image_mean=config['normalization']['mean'],image_std=config['normalization']['std'],
195
+ cadryl_interpolation='Android bilinear bitmap scaling; float-resize detector and smoke bicubic pixel parity not qualified on Android'))
196
+ limits=dict(inference_only=True,training_signatures=False,test_evaluated=False,
197
+ android_device_tested=False,gpu_delegate_tested=False,
198
+ point='flame_base_anchor appearance convention, not ignition or source geography',
199
+ smoke='binary visual compatibility, no smoke masks, core points, or source position',
200
+ probabilities_calibrated='smoke calibration retained; detector alert thresholds not calibrated',
201
+ numerical_parity_not_semantic_accuracy=True)
202
+ pipeline=dict(role=role,input_domain='whole image' if role=='proposal' else 'predicted probable_fire crop' if role=='visible' else 'tight predicted visible_flame crop' if role=='point' else 'probable_fire ROI without local confirmed flame',
203
+ context_fraction=.30 if role=='visible' else .45 if role=='smoke' else 0,
204
+ min_crop_side=128 if role=='visible' else 160 if role=='smoke' else None,
205
+ point_decoder='argmax then local 5x5 softmax expectation at pixel centers' if role=='point' else None,
206
+ global_visible_nms_iou=.60,proposal_nms_iou=.75,proposal_limit=6,
207
+ note='Cadryl runs one selected model; cascade orchestration requires the supplied runner. Visible Cadryl applies per-crop NMS; reference cascade applies NMS after whole-image reprojection.')
208
+ if role=='smoke':pipeline.update(temperature=config['temperature'],low_threshold=config['low_threshold'],high_threshold=config['high_threshold'],ambiguous_interval=[config['low_threshold'],config['high_threshold']],cadryl_annotation='only high positive compatibility; negative and ambiguous outcomes require host triage')
209
+ if role in ('proposal','visible'):
210
+ save(folder/'native_logits_labels.json',{'0':semantic,'1':'unused_background'})
211
+ pipeline.update(native_query_count=300,native_logits_active_class=0,
212
+ cadryl_encoding='BCN [cx,cy,w,h,active probability]; top300 over sigmoid query/class scores; non-active class scores zeroed',
213
+ tie_handling='torch.topk in packed graph; conventional host decode uses stable global score sort')
214
+ save(folder/'runtime_contract.json',dict(schema='fireviewer.litert.inference/1',model_id=IDS[role],
215
+ semantic=semantic,task=task,artifact='model.tflite',format='TFLite FlatBuffer / LiteRT',precision='FP32',
216
+ source=manifest['models'][role],dataset=ds,inputs=[tensor_info(d,i) for i,d in enumerate(input_details)],
217
+ outputs=outputs,logical_output_positions=logical_indices,preprocessing='preprocessor_config.json',
218
+ class_map='labels.json',coordinates='normalized top-left origin, x right, y down',
219
+ cadryl_model_config='android_model_config.json',cadryl_studio_pack='studio_pack.json',
220
+ pipeline=pipeline,limits=limits,validation='conversion_validation.json'))
221
+ save(folder/'source.json',dict(**manifest['models'][role],dataset=ds,config=config))
222
+ save(folder/'conversion_validation.json',validation)
223
+ title='FireViewer v2.5 — '+semantic+' — LiteRT FP32'
224
+ (folder/'README.md').write_text(f'''# {title}
225
+
226
+ ## English
227
+
228
+ Static batch-1 inference export of the frozen [{manifest['models'][role]['repository']}](https://huggingface.co/{manifest['models'][role]['repository']}/tree/{manifest['models'][role]['revision']}) checkpoint. No additional training or quantization. RGB input is stretched to {size}×{size}, converted to NCHW float32, rescaled by 1/255 and normalized with ImageNet mean/std. The exact tensors and output positions are in `runtime_contract.json`; `labels.txt`, `labels.json` and `classes.json` provide the class map.
229
+
230
+ Load `model.tflite` with a LiteRT Interpreter. For Cadryl import `android_model_config.json`, or `studio_pack.json` as a Vision Studio Pack. Contracts contain only supported Cadryl ModelConfig fields. The RF-DETR adapter is deliberately encoded as YOLO BCN to preserve active class index 0. This is a tensor encoding, not a change of detector architecture. A smoke import annotates only high positive compatibility; host code retains low/ambiguous/high triage. The point model applies only to tight flame crops and returns one appearance anchor, with no calibrated point confidence.
231
+
232
+ Training corpus: [{ds['repository']}](https://huggingface.co/datasets/{ds['repository']}/tree/{ds['revision']}). Its public licensed subset does not necessarily equal the complete internal training corpus. Checkpoint provenance remains in the original model card.
233
+
234
+ Real CPU LiteRT allocation/invocation and eager-PyTorch numerical comparisons: **{validation['status']}**, {validation['samples']} fixed probes/crops. Evidence and predeclared tolerances are in `conversion_validation.json`. Numerical agreement is not a semantic benchmark or an Android-device qualification. GPU delegates, Android latency and Android smoke bicubic preprocessing are unqualified. These exports have no train/restore/save signatures and are inference-only.
235
+
236
+ The 680-image full-cascade benchmark used frozen PyTorch FP32 models on L4. Image alert recall 220/249=88.35%; negative false-alarm rate 49/431=11.37%. Flame localization recall at IoU≥0.5: 231/901=25.64%, tiny recall 178/788=22.59%. Proposal containment: 882/901=97.89%. Do not confuse image alerting with exhaustive precise flame localization. Point-in-matched-box consistency 226/231=97.84% is not independent flame-base accuracy. See the repository cascade benchmark report for families, source limitations and denominators.
237
+
238
+ ## Français
239
+
240
+ Export d'inférence statique, batch 1, du checkpoint figé ci-dessus. Aucune nouvelle phase d'entraînement ni quantification. Entrée RGB redimensionnée par étirement à {size}×{size}, float32 NCHW, normalisation ImageNet. Les classes, les sorties réelles et leurs positions figurent dans les contrats JSON. Cadryl utilise `android_model_config.json` ou le pack `studio_pack.json`. Le détecteur reste RF-DETR ; seul son encodage de sortie compatible Cadryl est BCN YOLO, pour conserver la classe active d'indice 0.
241
+
242
+ La validation numérique CPU LiteRT/PyTorch est **{validation['status']}** sur {validation['samples']} entrées figées. Elle ne remplace ni une qualification Android ni une validation scientifique des annotations. Le point est une ancre d'apparence de flamme, pas une origine d'incendie. La fumée fournit une compatibilité binaire calibrée, aucun masque ni point. La cascade complète nécessite l'orchestration proposée ; l'import individuel dans Cadryl n'exécute pas les quatre modèles. Le test historique demeure verrouillé.
243
+ ''',encoding='utf8')
244
+ files={p.name:dict(sha256=sha(p),bytes=p.stat().st_size) for p in folder.iterdir() if p.is_file() and p.name!='manifest.json'}
245
+ save(folder/'manifest.json',dict(schema='fireviewer.litert.package/1',model_id=IDS[role],precision='FP32',
246
+ inference_only=True,validated=True,files=files))
247
+
248
+ def run(role,reuse_graph=False):
249
+ OUT.mkdir(parents=True,exist_ok=True);SSD.mkdir(parents=True,exist_ok=True)
250
+ manifest=json.loads((ROOT/'cascade_benchmark/release-manifest.json').read_text())
251
+ threads=min(4,os.cpu_count() or 2);torch.set_num_threads(threads)
252
+ torch.set_grad_enabled(False);torch.manual_seed(42)
253
+ status(role,'loading',threads=threads)
254
+ directory=stage(role,manifest);model,config=load_model(directory,'cpu')
255
+ samples,panel=sample_inputs(role,config);kind=config['model_kind']
256
+ folder=OUT/'models'/IDS[role];folder.mkdir(parents=True,exist_ok=True)
257
+ # Store original eager outputs before position freezing or export-mode changes.
258
+ native=[]
259
+ if kind=='rfdetr':
260
+ from rfdetr.export.prepare import prepare_export_graph
261
+ from rfdetr.export._backend import _switch_to_export_mode
262
+ native_model=model.model.model.eval()
263
+ for x in samples:
264
+ value=native_model(x);native.append([value['pred_boxes'].cpu().numpy(),value['pred_logits'].cpu().numpy()])
265
+ graph=prepare_export_graph(native_model,model.model_config,shape=(config['resolution'],config['resolution']),device='cpu')
266
+ _switch_to_export_mode(graph.model);wrapped=DetectorOutputs(graph.model).eval()
267
+ names=['boxes','logits','cadryl_detections']
268
+ else:
269
+ for x in samples:native.append(arrays(model(x)))
270
+ freeze_dino_position(model,kind,samples[0])
271
+ wrapped=(PointOutputs(model) if role=='point' else SmokeOutputs(model,config['temperature'])).eval()
272
+ names=['heatmap_logits','point_normalized'] if role=='point' else ['raw_logit','calibrated_probabilities','positive_probability']
273
+ eager=[arrays(wrapped(x)) for x in samples]
274
+ preparation=[]
275
+ for i,original in enumerate(native):
276
+ actual=eager[i][:2] if kind=='rfdetr' else [eager[i][0][:,0] if role=='point' else eager[i][0][:,0]]
277
+ for j,(a,b) in enumerate(zip(original,actual)):
278
+ tol=TOLERANCES['boxes' if kind=='rfdetr' and j==0 else 'logits']
279
+ ok=bool(np.allclose(a,b,**tol));preparation.append(dict(sample=i,output=j,pass_=ok,max_abs=float(np.abs(a-b).max())))
280
+ assert ok,('preparation changed eager output',i,j,preparation[-1])
281
+ if role=='point':
282
+ original_uv=heatmap_point(torch.from_numpy(original[0])).numpy()[:,None,:]
283
+ actual_uv=eager[i][1]
284
+ ok=bool(np.allclose(original_uv,actual_uv,atol=1e-7,rtol=0))
285
+ preparation.append(dict(sample=i,output='original_point_decoder',pass_=ok,max_abs=float(np.abs(original_uv-actual_uv).max())))
286
+ assert ok,'The float-grid point decoder changed the reference point'
287
+ status(role,'converting',samples=len(samples),input_shape=list(samples[0].shape),preparation_max_abs=max(r['max_abs'] for r in preparation))
288
+ target=SSD/(IDS[role]+'.tflite')
289
+ if reuse_graph:
290
+ assert target.is_file(),'No retained inference graph to revalidate'
291
+ else:
292
+ converted=litert_torch.convert(wrapped,(samples[0],));converted.export(str(target))
293
+ status(role,'validating',bytes=target.stat().st_size)
294
+ interpreter=Interpreter(model_path=str(target),num_threads=threads)
295
+ interpreter.allocate_tensors();ins=interpreter.get_input_details();outs=interpreter.get_output_details()
296
+ assert len(ins)==1 and list(ins[0]['shape'])==list(samples[0].shape) and ins[0]['dtype']==np.float32
297
+ # Converter signature keys record tuple order; interpreter details may use another order.
298
+ signature=interpreter._get_full_signature_list()
299
+ assert len(signature)==1,signature
300
+ output_keys=next(iter(signature.values()))['outputs']
301
+ index_to_position={int(d['index']):i for i,d in enumerate(outs)}
302
+ order={name:index_to_position[int(output_keys['output_'+str(i)])] for i,name in enumerate(names)}
303
+ checks=[];timings=[]
304
+ for i,x in enumerate(samples):
305
+ interpreter.set_tensor(ins[0]['index'],x.numpy())
306
+ start=time.perf_counter();interpreter.invoke();timings.append(time.perf_counter()-start)
307
+ for j,name in enumerate(names):
308
+ actual=interpreter.get_tensor(outs[order[name]]['index']);expected=eager[i][j]
309
+ tol=TOLERANCES[name]
310
+ ok=bool(np.isfinite(actual).all() and np.allclose(actual,expected,**tol))
311
+ check=dict(sample=i,output=name,pass_=ok,max_abs=float(np.abs(actual-expected).max()),
312
+ mean_abs=float(np.abs(actual-expected).mean()),atol=tol['atol'],rtol=tol['rtol'])
313
+ checks.append(check)
314
+ print('PARITY',json.dumps(check),flush=True)
315
+ assert ok,check
316
+ validation=dict(status='passed',samples=len(samples),source=manifest['models'][role],
317
+ input_panel=panel,tolerances=TOLERANCES,checks=checks,preparation_checks=preparation,
318
+ interpreter='ai_edge_litert CPU',threads=threads,precision='FP32',
319
+ model_sha256=sha(target),model_bytes=target.stat().st_size,
320
+ cpu_latency_seconds=dict(median=float(np.median(timings)),p95=float(np.percentile(timings,95)),samples=len(timings),
321
+ warmup_excluded=False,not_android=True),
322
+ versions={name:importlib.metadata.version(name) for name in ('torch','rfdetr','transformers','litert-torch','ai-edge-litert')},
323
+ output_positions=order,signatures=interpreter.get_signature_list(),
324
+ android_device_tested=False,test_used=False,no_training=True)
325
+ shutil.copyfile(target,folder/'model.tflite');assert sha(folder/'model.tflite')==validation['model_sha256']
326
+ output_info=[dict(**tensor_info(d,i),semantic=next(name for name,pos in order.items() if pos==i)) for i,d in enumerate(outs)]
327
+ contracts(role,config,manifest,folder,ins,output_info,order,validation)
328
+ status(role,'complete',sha256=validation['model_sha256'],bytes=validation['model_bytes'],samples=len(samples),folder=str(folder),output_positions=order)
329
+
330
+ if __name__=='__main__':
331
+ p=argparse.ArgumentParser();p.add_argument('--role',choices=list(IDS),required=True);p.add_argument('--reuse-graph',action='store_true');args=p.parse_args()
332
+ try:run(args.role,args.reuse_graph)
333
+ except Exception as e:
334
+ status(args.role,'failed',error_type=type(e).__name__,message=str(e)[:2000]);raise
conversion/cascade-v25/diagnose_detector_parity.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Inspect RF-DETR set-output permutations without relaxing numerical bounds."""
2
+ import argparse,json,time
3
+ from pathlib import Path
4
+ import numpy as np
5
+ import torch
6
+ from scipy.optimize import linear_sum_assignment
7
+ from ai_edge_litert.interpreter import Interpreter
8
+ import convert_models as c
9
+ from inference import load_model
10
+
11
+ def matched(a,b):
12
+ cost=np.abs(a[:,None,:]-b[None,:,:]).mean(2)
13
+ rows,columns=linear_sum_assignment(cost)
14
+ return b[columns],columns
15
+
16
+ def run(role):
17
+ torch.set_num_threads(4);torch.set_grad_enabled(False)
18
+ release=json.loads((c.ROOT/'cascade_benchmark/release-manifest.json').read_text())
19
+ model,config=load_model(c.stage(role,release),'cpu')
20
+ model.model.model.eval()
21
+ samples,panel=c.sample_inputs(role,config)
22
+ target=c.SSD/(c.IDS[role]+'.tflite')
23
+ interpreter=Interpreter(model_path=str(target),num_threads=4);interpreter.allocate_tensors()
24
+ ins=interpreter.get_input_details();outs=interpreter.get_output_details()
25
+ sig=next(iter(interpreter._get_full_signature_list().values()))['outputs']
26
+ positions={j:next(i for i,d in enumerate(outs) if int(d['index'])==int(sig['output_'+str(j)])) for j in range(3)}
27
+ cases=[]
28
+ cache=c.SSD/'parity-cache';cache.mkdir(exist_ok=True)
29
+ for i,x in enumerate(samples):
30
+ value=model.model.model(x)
31
+ native=[value['pred_boxes'].numpy(),value['pred_logits'].numpy()]
32
+ interpreter.set_tensor(ins[0]['index'],x.numpy());interpreter.invoke()
33
+ actual=[interpreter.get_tensor(outs[positions[j]]['index']) for j in range(3)]
34
+ np.savez(cache/(role+'-'+str(i)+'.npz'),native_boxes=native[0],native_logits=native[1],lite_boxes=actual[0],lite_logits=actual[1],lite_packed=actual[2])
35
+ expected=np.concatenate([native[0][0],native[1][0]/10],axis=1)
36
+ got=np.concatenate([actual[0][0],actual[1][0]/10],axis=1)
37
+ _,permutation=matched(expected,got)
38
+ boxes=actual[0][0][permutation];logits=actual[1][0][permutation]
39
+ threshold=.10 if role=='proposal' else .25
40
+ ep=1/(1+np.exp(-np.clip(native[1][0][:,0],-80,80)));ap=1/(1+np.exp(-np.clip(actual[1][0][:,0],-80,80)))
41
+ eb=native[0][0][ep>threshold];ab=actual[0][0][ap>threshold]
42
+ high_max=None;high_score_max=None
43
+ if len(eb)==len(ab) and len(eb):
44
+ ea=np.concatenate([eb,ep[ep>threshold,None]],axis=1)
45
+ aa=np.concatenate([ab,ap[ap>threshold,None]],axis=1)
46
+ aligned,_=matched(ea,aa)
47
+ high_max=float(np.abs(ea[:,:4]-aligned[:,:4]).max());high_score_max=float(np.abs(ea[:,4]-aligned[:,4]).max())
48
+ case=dict(sample=i,probe=panel[i],changed_query_positions=int((permutation!=np.arange(300)).sum()),
49
+ by_position_box_max=float(np.abs(native[0]-actual[0]).max()),
50
+ matched_box_max=float(np.abs(native[0][0]-boxes).max()),matched_logit_max=float(np.abs(native[1][0]-logits).max()),
51
+ matched_box_pass=bool(np.allclose(native[0][0],boxes,**c.TOLERANCES['boxes'])),
52
+ matched_logit_pass=bool(np.allclose(native[1][0],logits,**c.TOLERANCES['logits'])),
53
+ operating_threshold=threshold,native_above_threshold=len(eb),lite_above_threshold=len(ab),
54
+ operating_box_max=high_max,operating_score_max=high_score_max)
55
+ cases.append(case);print('DETECTOR_PARITY_DIAG',json.dumps(case),flush=True)
56
+ c.save(c.OUT/(role+'-permutation-diagnostic.json'),dict(role=role,source=release['models'][role],
57
+ model_sha256=c.sha(target),cases=cases,output_identity='unordered detections; row index not cross-backend identity'))
58
+
59
+ if __name__=='__main__':
60
+ p=argparse.ArgumentParser();p.add_argument('--role',required=True,choices=['proposal','visible']);a=p.parse_args();run(a.role)
conversion/cascade-v25/finalize_detector_sets.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Qualify operative detector outputs; disclose failed all-query array parity."""
2
+ import importlib.metadata,json,shutil
3
+ import numpy as np
4
+ from scipy.optimize import linear_sum_assignment
5
+ from ai_edge_litert.interpreter import Interpreter
6
+ import convert_models as c
7
+
8
+ def align(expected,actual):
9
+ assert expected.shape==actual.shape,('detection count differs',expected.shape,actual.shape)
10
+ if not len(expected):return actual,np.zeros(0,dtype=int)
11
+ cost=np.abs(expected[:,None,:]-actual[None,:,:]).mean(2)
12
+ _,permutation=linear_sum_assignment(cost)
13
+ return actual[permutation],permutation
14
+
15
+ def native_detections(boxes,logits,threshold):
16
+ probability=1/(1+np.exp(-np.clip(logits,-80,80)))
17
+ flat=probability.ravel();idx=np.argsort(-flat,kind='stable')[:300]
18
+ idx=idx[(idx%logits.shape[-1]==0)&(flat[idx]>threshold)]
19
+ return np.concatenate((boxes[idx//logits.shape[-1]],flat[idx,None]),axis=1)
20
+
21
+ def run(role):
22
+ release=json.loads((c.ROOT/'cascade_benchmark/release-manifest.json').read_text())
23
+ config=json.loads((c.SSD/'models'/release['models'][role]['repository'].split('/')[-1]/'config.json').read_text())
24
+ diagnostic=json.loads((c.OUT/(role+'-permutation-diagnostic.json')).read_text())
25
+ target=c.SSD/(c.IDS[role]+'.tflite');assert c.sha(target)==diagnostic['model_sha256']
26
+ threshold=.10 if role=='proposal' else .25
27
+ checks=[];raw=[]
28
+ for case in diagnostic['cases']:
29
+ i=case['sample'];arrays=np.load(c.SSD/'parity-cache'/(role+'-'+str(i)+'.npz'))
30
+ nb=arrays['native_boxes'][0];nl=arrays['native_logits'][0]
31
+ ab=arrays['lite_boxes'][0];al=arrays['lite_logits'][0]
32
+ expected=native_detections(nb,nl,threshold)
33
+ actual=native_detections(ab,al,threshold)
34
+ matched,_=align(expected,actual)
35
+ for name,got in [('conventional',matched),('cadryl',None)]:
36
+ if name=='cadryl':
37
+ packed=arrays['lite_packed'][0].T
38
+ got,_=align(expected,packed[packed[:,4]>threshold])
39
+ box_ok=bool(np.allclose(expected[:,:4],got[:,:4],**c.TOLERANCES['boxes']))
40
+ score_ok=bool(np.allclose(expected[:,4],got[:,4],atol=.002,rtol=.001))
41
+ assert box_ok and score_ok,(role,i,name)
42
+ checks.append(dict(sample=i,output=name,operating_threshold=threshold,count=len(expected),pass_=True,
43
+ box_max_abs=float(np.abs(expected[:,:4]-got[:,:4]).max()) if len(expected) else 0,
44
+ score_max_abs=float(np.abs(expected[:,4]-got[:,4]).max()) if len(expected) else 0,
45
+ box_tolerance=c.TOLERANCES['boxes'],score_tolerance=dict(atol=.002,rtol=.001)))
46
+ # Quantify the remaining raw-query differences under a set correspondence.
47
+ combined=np.concatenate((nb,nl/10),axis=1);actual_combined=np.concatenate((ab,al/10),axis=1)
48
+ _,permutation=align(combined,actual_combined)
49
+ boxes=ab[permutation];logits=al[permutation]
50
+ bad_box=~np.isclose(nb,boxes,**c.TOLERANCES['boxes']).all(1)
51
+ bad_logit=~np.isclose(nl,logits,**c.TOLERANCES['logits']).all(1)
52
+ bad=bad_box|bad_logit
53
+ np_native=1/(1+np.exp(-np.clip(nl[:,0],-80,80)))
54
+ np_lite=1/(1+np.exp(-np.clip(logits[:,0],-80,80)))
55
+ max_inactive=float(max(np_native[bad].max(),np_lite[bad].max())) if bad.any() else 0
56
+ assert max_inactive<threshold,'Raw mismatch involves an operative query'
57
+ raw.append(dict(sample=i,all_query_box_pass=not bad_box.any(),all_query_logit_pass=not bad_logit.any(),
58
+ divergent_queries=int(bad.sum()),max_divergent_active_class_probability=max_inactive,
59
+ by_position_box_max=case['by_position_box_max'],set_matched_box_max=case['matched_box_max'],
60
+ set_matched_logit_max=case['matched_logit_max']))
61
+ interpreter=Interpreter(model_path=str(target),num_threads=4);interpreter.allocate_tensors()
62
+ ins=interpreter.get_input_details();outs=interpreter.get_output_details()
63
+ sig=next(iter(interpreter._get_full_signature_list().values()))['outputs']
64
+ order={name:next(i for i,d in enumerate(outs) if int(d['index'])==int(sig['output_'+str(j)]))
65
+ for j,name in enumerate(['boxes','logits','cadryl_detections'])}
66
+ validation=dict(status='passed_operating_points',samples=len(diagnostic['cases']),
67
+ qualification_scope='Conventional and Cadryl decoded detection sets at the fixed .10 proposal / .25 visible operating thresholds',
68
+ all_raw_queries_equivalent=False,lower_thresholds_qualified=False,query_row_identity_stable=False,
69
+ explanation='A few very-low-score candidates differ, consistent with near-tied two-stage top-k selection across backends (an inference from the diagnostic). All-300 raw numerical parity fails. This is disclosed, not hidden by a looser tolerance. Operative detection counts, boxes and scores pass the original bounds on this fixed panel.',
70
+ source=release['models'][role],input_panel=[x['probe'] for x in diagnostic['cases']],checks=checks,
71
+ raw_query_diagnostics=raw,tolerances=c.TOLERANCES,model_sha256=c.sha(target),model_bytes=target.stat().st_size,
72
+ interpreter='ai_edge_litert CPU XNNPACK',threads=4,precision='FP32',
73
+ versions={name:importlib.metadata.version(name) for name in ('torch','rfdetr','transformers','litert-torch','ai-edge-litert')},
74
+ output_positions=order,signatures=interpreter.get_signature_list(),android_device_tested=False,
75
+ test_used=False,no_training=True)
76
+ folder=c.OUT/'models'/c.IDS[role];folder.mkdir(parents=True,exist_ok=True)
77
+ shutil.copyfile(target,folder/'model.tflite');assert c.sha(folder/'model.tflite')==validation['model_sha256']
78
+ info=[dict(**c.tensor_info(d,i),semantic=next(name for name,pos in order.items() if pos==i)) for i,d in enumerate(outs)]
79
+ c.contracts(role,config,release,folder,ins,info,order,validation)
80
+ contract=json.loads((folder/'runtime_contract.json').read_text())
81
+ contract['numerical_qualification']=dict(status=validation['status'],operating_threshold=threshold,
82
+ all_raw_queries_equivalent=False,lower_score_cutoffs_qualified=False,query_row_identity_stable=False,
83
+ scope=validation['qualification_scope'])
84
+ c.save(folder/'runtime_contract.json',contract)
85
+ with (folder/'README.md').open('a',encoding='utf8') as f:
86
+ f.write('\n## RF-DETR conversion scope / Périmètre numérique\n\n'
87
+ 'Operative conventional/Cadryl detection sets pass at the frozen '+str(threshold)+' cutoff. '
88
+ 'All-300 raw-query parity fails for a few very-low-score candidates; lower cutoffs and row identity are unqualified. '
89
+ 'These discrepancies are retained in conversion_validation.json and raw-query-diagnostic.json.\n\n'
90
+ 'La qualification concerne les détections au seuil figé '+str(threshold)+'. Quelques candidats bruts de très faible score diffèrent ; '
91
+ 'l\'équivalence des 300 candidats et des seuils plus bas reste non validée. Les écarts sont conservés dans les reçus.\n')
92
+ shutil.copyfile(c.OUT/(role+'-permutation-diagnostic.json'),folder/'raw-query-diagnostic.json')
93
+ c.save(folder/'manifest.json',dict(schema='fireviewer.litert.package/1',model_id=c.IDS[role],precision='FP32',inference_only=True,
94
+ validated=True,qualification_scope=validation['qualification_scope'],files={p.name:dict(sha256=c.sha(p),bytes=p.stat().st_size)
95
+ for p in folder.iterdir() if p.is_file() and p.name!='manifest.json'}))
96
+ c.status(role,'complete_operating_points',sha256=validation['model_sha256'],samples=validation['samples'],
97
+ all_raw_queries_equivalent=False,operating_threshold=threshold,max_operating_box_error=max(x['box_max_abs'] for x in checks),
98
+ max_operating_score_error=max(x['score_max_abs'] for x in checks),raw_divergent_queries=sum(x['divergent_queries'] for x in raw),
99
+ max_divergent_probability=max(x['max_divergent_active_class_probability'] for x in raw))
100
+
101
+ if __name__=='__main__':
102
+ for role in ('proposal','visible'):run(role)
conversion/cascade-v25/inference.py ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Explicit, tensor-only loading for FireViewer v2.5 research checkpoints.
2
+
3
+ No automatic Hugging Face trust_remote_code, cloud credentials or smoke point model.
4
+ The optional smoke backbone uses a pinned official facebookresearch source.
5
+ """
6
+ from pathlib import Path
7
+ from types import SimpleNamespace
8
+ import argparse, hashlib, json, math, tempfile
9
+ import numpy as np
10
+ from PIL import Image
11
+ import torch
12
+ from torch import nn
13
+ from torch.nn import functional as F
14
+ from safetensors.torch import load_file
15
+
16
+ class FlameHeatmap(nn.Module):
17
+ def __init__(self,backbone):
18
+ super().__init__(); self.backbone=backbone
19
+ self.head=nn.Sequential(nn.Conv2d(backbone.config.hidden_size,128,3,padding=1),nn.GroupNorm(8,128),nn.GELU(),
20
+ nn.Upsample(scale_factor=2,mode='bilinear',align_corners=False),nn.Conv2d(128,64,3,padding=1),
21
+ nn.GroupNorm(8,64),nn.GELU(),nn.Upsample(scale_factor=2,mode='bilinear',align_corners=False),nn.Conv2d(64,1,1))
22
+ def forward(self,x):
23
+ tokens=self.backbone(pixel_values=x).last_hidden_state[:,1:]
24
+ side=x.shape[-1]//self.backbone.config.patch_size
25
+ return self.head(tokens.transpose(1,2).reshape(x.shape[0],-1,side,side)).squeeze(1)
26
+
27
+ class SmokeClassifier(nn.Module):
28
+ def __init__(self,backbone):
29
+ super().__init__(); self.backbone=backbone
30
+ self.head=nn.Sequential(nn.LayerNorm(384),nn.Dropout(.15),nn.Linear(384,1))
31
+ def forward(self,x):return self.head(self.backbone(x)).squeeze(1)
32
+
33
+ def sha(path):
34
+ h=hashlib.sha256()
35
+ with open(path,'rb') as f:
36
+ for b in iter(lambda:f.read(8<<20),b''):h.update(b)
37
+ return h.hexdigest()
38
+
39
+ def load_model(directory,device='cpu'):
40
+ """Load a downloaded, revision-pinned model repository directory."""
41
+ root=Path(directory); config=json.loads((root/'config.json').read_text())
42
+ proof=json.loads((root/'provenance/checkpoint-export.json').read_text())
43
+ assert sha(root/'model.safetensors')==proof['safe_weights_sha256'], 'weights checksum mismatch'
44
+ state=load_file(root/'model.safetensors',device='cpu')
45
+ kind=config['model_kind']
46
+ if kind=='rfdetr':
47
+ import importlib.metadata
48
+ from rfdetr import RFDETRMedium
49
+ if importlib.metadata.version('rfdetr')!='1.11.0':
50
+ raise RuntimeError('Install rfdetr==1.11.0 for this checkpoint')
51
+ # RF-DETR 1.11 expects a native wrapper. Construct it from local safe tensors
52
+ # and plain JSON; no externally supplied pickle is loaded by this helper.
53
+ with tempfile.TemporaryDirectory(prefix='fireviewer-rfdetr-') as tmp:
54
+ native=Path(tmp)/'local_safe_wrapper.pth'
55
+ torch.save(dict(model=state,args=SimpleNamespace(**config['checkpoint_args']),
56
+ epoch=config['selected_epoch']-1),native)
57
+ model=RFDETRMedium(pretrain_weights=str(native),resolution=config['resolution'],
58
+ positional_encoding_size=config['positional_encoding_size'],num_classes=1,
59
+ num_select=300,device=device,compile=False,gradient_checkpointing=False)
60
+ return model,config
61
+ if kind=='flame_point':
62
+ from transformers import Dinov2Config,Dinov2Model
63
+ model=FlameHeatmap(Dinov2Model(Dinov2Config(**config['backbone_config'])))
64
+ # Transformers 5 renamed the separate attention projections. Values,
65
+ # shapes and the model architecture remain unchanged; loading stays strict.
66
+ if 'backbone.encoder.layer.0.attention.q_proj.weight' in model.state_dict():
67
+ aliases={'.attention.attention.query.':'.attention.q_proj.',
68
+ '.attention.attention.key.':'.attention.k_proj.',
69
+ '.attention.attention.value.':'.attention.v_proj.',
70
+ '.attention.output.dense.':'.attention.o_proj.'}
71
+ renamed={}
72
+ for key,value in state.items():
73
+ target=key
74
+ for old,new in aliases.items():target=target.replace(old,new)
75
+ if target in renamed:raise RuntimeError('Attention alias collision')
76
+ renamed[target]=value
77
+ state=renamed
78
+ elif kind=='smoke_classifier':
79
+ revision=config['dino_source_revision']
80
+ if revision!='7764ea0f912e53c92e82eb78a2a1631e92725fc8':
81
+ raise ValueError('Unexpected official DINOv2 source revision')
82
+ backbone=torch.hub.load('facebookresearch/dinov2:'+revision,'dinov2_vits14',
83
+ pretrained=False,trust_repo=True,skip_validation=False)
84
+ model=SmokeClassifier(backbone)
85
+ else:raise ValueError(kind)
86
+ model.load_state_dict(state,strict=True)
87
+ model.to(device).eval();return model,config
88
+
89
+ def preprocess(crop,config,device):
90
+ interpolation=Image.Resampling.BICUBIC if config['model_kind']=='smoke_classifier' else Image.Resampling.BILINEAR
91
+ rgb=np.array(crop.convert('RGB').resize((config['resolution'],config['resolution']),interpolation),copy=True)
92
+ x=torch.from_numpy(rgb).permute(2,0,1).float()/255
93
+ mean=torch.tensor(config['normalization']['mean'])[:,None,None]
94
+ std=torch.tensor(config['normalization']['std'])[:,None,None]
95
+ return ((x-mean)/std)[None].to(device)
96
+
97
+ def heatmap_point(logits):
98
+ a=logits.float();n,h,w=a.shape;peak=a.flatten(1).argmax(1);px=peak%w;py=peak//w
99
+ yy,xx=torch.meshgrid(torch.arange(h,device=a.device),torch.arange(w,device=a.device),indexing='ij')
100
+ local=(xx[None]-px[:,None,None]).abs().le(2)&(yy[None]-py[:,None,None]).abs().le(2)
101
+ p=F.softmax(a.masked_fill(~local,-1e4).flatten(1),dim=1).reshape_as(a)
102
+ return torch.stack([(p*(xx+.5)/w).sum((1,2)),(p*(yy+.5)/h).sum((1,2))],1)
103
+
104
+ @torch.inference_mode()
105
+ def predict_point(model,config,crop,device='cpu'):
106
+ logits=model(preprocess(crop,config,device))
107
+ assert torch.isfinite(logits).all()
108
+ uv=heatmap_point(logits)[0].cpu().tolist()
109
+ return dict(semantic='flame_base_anchor',point_normalized=uv,
110
+ point_xy=[uv[0]*crop.width,uv[1]*crop.height],confidence=None)
111
+
112
+ @torch.inference_mode()
113
+ def predict_smoke(model,config,crop,device='cpu'):
114
+ logit=model(preprocess(crop,config,device)).float()[0]
115
+ assert torch.isfinite(logit)
116
+ probability=float(torch.sigmoid(logit/config['temperature']).cpu())
117
+ low=config['low_threshold'];high=config['high_threshold']
118
+ status=('low_compatibility' if low is not None and probability<=low else
119
+ 'fire_smoke_probable' if high is not None and probability>=high else 'ambiguous')
120
+ return dict(semantic='fire_associated_smoke_compatible',probability=probability,status=status,
121
+ source_location=None)
122
+
123
+ def area(b):return max(0,b[2]-b[0])*max(0,b[3]-b[1])
124
+ def iou(a,b):
125
+ intersection=area([max(a[0],b[0]),max(a[1],b[1]),min(a[2],b[2]),min(a[3],b[3])])
126
+ return intersection/max(1e-12,area(a)+area(b)-intersection)
127
+ def nms(boxes,scores,threshold,limit=None):
128
+ keep=[]
129
+ for i in sorted(range(len(scores)),key=lambda i:(-float(scores[i]),i)):
130
+ if area(boxes[i])>0 and all(iou(boxes[i],boxes[j])<=threshold for j in keep):keep.append(i)
131
+ if limit is not None and len(keep)>=limit:break
132
+ return keep
133
+ def expand_roi(box,size,context=.30,min_side=128):
134
+ width,height=size;x0,y0,x1,y1=map(float,box);cx,cy=(x0+x1)/2,(y0+y1)/2
135
+ w=max(min_side,(x1-x0)*(1+2*context));h=max(min_side,(y1-y0)*(1+2*context))
136
+ return [max(0,math.floor(cx-w/2)),max(0,math.floor(cy-h/2)),min(width,math.ceil(cx+w/2)),min(height,math.ceil(cy+h/2))]
137
+ def tight_roi(box,size):
138
+ width,height=size
139
+ return [max(0,math.floor(box[0])),max(0,math.floor(box[1])),min(width,math.ceil(box[2])),min(height,math.ceil(box[3]))]
140
+ def detections(model,image,threshold):
141
+ result=model.predict(image,threshold=threshold,include_source_image=False)
142
+ mask=result.class_id==0
143
+ return result.xyxy[mask].tolist(),result.confidence[mask].tolist()
144
+
145
+ @torch.inference_mode()
146
+ def cascade(image,proposal,visible,point_model=None,smoke_model=None,device='cpu',flame_threshold=.25):
147
+ """Research comparison recipe; detector thresholds are not calibrated alert thresholds."""
148
+ proposals,proposal_scores=detections(proposal[0],image,.10)
149
+ selected=nms(proposals,proposal_scores,.75,6)
150
+ boxes=[];scores=[];roi_records=[]
151
+ for idx in selected:
152
+ box=proposals[idx];roi=expand_roi(box,image.size,.30,128)
153
+ found,conf=detections(visible[0],image.crop(roi),flame_threshold)
154
+ local_keep=list(range(len(found)))
155
+ for j in local_keep:
156
+ b=found[j]
157
+ mapped=[max(roi[0],b[0]+roi[0]),max(roi[1],b[1]+roi[1]),
158
+ min(roi[2],b[2]+roi[0]),min(roi[3],b[3]+roi[1])]
159
+ if area(mapped)>0:boxes.append(mapped);scores.append(conf[j])
160
+ roi_records.append(dict(proposal_bbox_xyxy=box,proposal_score=proposal_scores[idx],
161
+ visible_flame_found=bool(local_keep)))
162
+ flames=[]
163
+ for idx in nms(boxes,scores,.60,100):
164
+ entry=dict(bbox_xyxy=boxes[idx],score=scores[idx],semantic='visible_flame')
165
+ if point_model:
166
+ roi=tight_roi(boxes[idx],image.size)
167
+ if roi[2]>roi[0] and roi[3]>roi[1]:
168
+ prediction=predict_point(*point_model,image.crop(roi),device=device)
169
+ prediction['point_xy_original']=[prediction['point_xy'][0]+roi[0],prediction['point_xy'][1]+roi[1]]
170
+ entry['point']=prediction
171
+ flames.append(entry)
172
+ smoke=[]
173
+ if smoke_model:
174
+ for r in roi_records:
175
+ if r['visible_flame_found']:continue
176
+ roi=expand_roi(r['proposal_bbox_xyxy'],image.size,.45,160)
177
+ smoke.append(dict(roi_xyxy=roi,proposal_bbox_xyxy=r['proposal_bbox_xyxy'],
178
+ **predict_smoke(*smoke_model,image.crop(roi),device=device)))
179
+ return dict(image_size=list(image.size),visible_flames=flames,smoke_compatibility=smoke,
180
+ detector_thresholds_calibrated=False,point_semantic='flame_base_anchor',
181
+ fire_group_association_performed=False)
182
+
183
+ def main():
184
+ p=argparse.ArgumentParser(description=__doc__)
185
+ p.add_argument('--model-dir');p.add_argument('--proposal-dir');p.add_argument('--visible-dir');p.add_argument('--point-dir');p.add_argument('--smoke-dir')
186
+ p.add_argument('--image',required=True);p.add_argument('--device',default='cpu');p.add_argument('--output',required=True)
187
+ args=p.parse_args();image=Image.open(args.image).convert('RGB')
188
+ if args.model_dir:
189
+ model,config=load_model(args.model_dir,args.device)
190
+ if config['model_kind']=='flame_point':result=predict_point(model,config,image,args.device)
191
+ elif config['model_kind']=='smoke_classifier':result=predict_smoke(model,config,image,args.device)
192
+ else:
193
+ boxes,scores=detections(model,image,.25);result=dict(bbox_xyxy=boxes,scores=scores,semantic=config['semantic'])
194
+ else:
195
+ if not(args.proposal_dir and args.visible_dir):p.error('Supply --model-dir, or both detector directories')
196
+ proposal=load_model(args.proposal_dir,args.device);visible=load_model(args.visible_dir,args.device)
197
+ point=load_model(args.point_dir,args.device) if args.point_dir else None
198
+ smoke=load_model(args.smoke_dir,args.device) if args.smoke_dir else None
199
+ result=cascade(image,proposal,visible,point,smoke,args.device)
200
+ Path(args.output).write_text(json.dumps(result,indent=2))
201
+ if __name__=='__main__':main()
conversion/cascade-v25/plot_benchmark.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Static descriptive benchmark figure; no invented confidence intervals."""
2
+ from pathlib import Path
3
+ import json
4
+ import matplotlib
5
+ matplotlib.use('Agg')
6
+ import matplotlib.pyplot as plt
7
+
8
+ root=Path(__file__).parent
9
+ j=json.loads((root.parents[1]/'cascade_benchmark/receipts/metrics-680.json').read_text(encoding='utf8'))
10
+ fig,axes=plt.subplots(2,1,figsize=(10,7.8),layout='constrained')
11
+ panels=[('Image alerts / Alertes image',[
12
+ ('Positive-image recall / Rappel images positives',j['image']['recall'],'#377eb8'),
13
+ ('Negative false-alarm rate / Fausses alertes négatives',j['image']['negative_false_alarm_rate'],'#d95f02')]),
14
+ ('Flame localization / Localisation flamme',[
15
+ ('Proposal containment / Couverture propositions',j['flame']['proposal_gt_containment_recall'],'#7a7a7a'),
16
+ ('Box recall at IoU ≥ .5 / Rappel boîtes',j['flame']['recall'],'#377eb8'),
17
+ ('Tiny flame recall / Rappel petites flammes',j['flame']['tiny_recall'],'#377eb8')])]
18
+ for ax,(title,rows) in zip(axes,panels):
19
+ values=[100*r[1]['value'] for r in rows]
20
+ ax.barh(range(len(rows)),values,color=[r[2] for r in rows],height=.58)
21
+ ax.set_yticks(range(len(rows)),[r[0] for r in rows],fontsize=9)
22
+ ax.invert_yaxis();ax.set_xlim(0,125);ax.set_xticks([0,25,50,75,100]);ax.set_xticklabels(['0%','25%','50%','75%','100%'])
23
+ ax.set_title(title,loc='left',fontsize=12,fontweight='bold')
24
+ ax.spines[['top','right','left']].set_visible(False);ax.grid(axis='x',alpha=.18);ax.set_axisbelow(True)
25
+ for i,(_,r,_) in enumerate(rows):ax.text(values[i]+1,i,f"{values[i]:.2f}% {r['success']}/{r['n']}",va='center',fontsize=9)
26
+ fig.suptitle('FireViewer v2.5 · 680 images · frozen PyTorch FP32 cascade on L4',fontsize=14,fontweight='bold')
27
+ fig.supxlabel('229 visual families; correlated views. Descriptive ratios, no independent-event confidence intervals.\nTiny: box area/image area ≤ (32/1088)². Point-base accuracy unmeasured. LiteRT/Android performance not shown.',fontsize=9)
28
+ out=root/'cascade-v25-benchmark.png';fig.savefig(out,dpi=155);print(out)
conversion/cascade-v25/publish_release.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Publish the validated allowlisted LiteRT cascade from Colab, additively."""
2
+ from pathlib import Path
3
+ from datetime import datetime, timezone
4
+ import json, io, requests, time, hashlib
5
+ from huggingface_hub import CommitOperationAdd, hf_hub_download
6
+ ROOT=Path('/content/drive/MyDrive/FireViewer/trainv2.5final1')
7
+ OUT=ROOT/'litert/20261007'
8
+ IDS={'proposal':'fireviewer_rfdetr_medium_probable_fire_v25_fp32',
9
+ 'visible':'fireviewer_rfdetr_medium_visible_flame_v25_fp32',
10
+ 'point':'fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32',
11
+ 'smoke':'fireviewer_dinov2_small_fire_associated_smoke_v25_fp32'}
12
+ def sha(path):
13
+ h=hashlib.sha256()
14
+ with Path(path).open('rb') as f:
15
+ for chunk in iter(lambda:f.read(8*1024*1024),b''):h.update(chunk)
16
+ return h.hexdigest()
17
+ def save(path,value):
18
+ path.parent.mkdir(parents=True,exist_ok=True)
19
+ path.write_text(json.dumps(value,indent=2,ensure_ascii=False)+'\n',encoding='utf8')
20
+
21
+ REPO='fireviewer/litert-models'
22
+ COLLECTION='fireviewer/25-not-so-bad-6ac47be5c15d70ee2a01d464'
23
+
24
+ def field(o,k):return o.get(k) if isinstance(o,dict) else getattr(o,k,None)
25
+
26
+ def publish(api):
27
+ identity=api.whoami();assert identity['name']=='unicornwhodev'
28
+ info=api.model_info(REPO,files_metadata=True);assert not info.private
29
+ old_models={s.rfilename:dict(bytes=s.size,sha256=field(s.lfs,'sha256')) for s in info.siblings
30
+ if s.rfilename.endswith('.tflite') and s.rfilename.startswith('models/')
31
+ and s.rfilename.split('/')[1] not in IDS.values()}
32
+ assert len(old_models)==6,'Historical inventory changed; inspect before publishing'
33
+ docs=OUT/'public-files';assert (docs/'docs/CASCADE_V25.md').is_file()
34
+ files={p.relative_to(docs).as_posix():p for p in docs.rglob('*') if p.is_file()}
35
+ for role,model_id in IDS.items():
36
+ folder=OUT/'models'/model_id
37
+ proof=json.loads((folder/'conversion_validation.json').read_text());assert proof['status'] in ('passed','passed_operating_points')
38
+ manifest=json.loads((folder/'manifest.json').read_text())
39
+ assert sha(folder/'model.tflite')==proof['model_sha256']
40
+ for name,record in manifest['files'].items():
41
+ assert name==Path(name).name and sha(folder/name)==record['sha256'] and (folder/name).stat().st_size==record['bytes']
42
+ for p in folder.iterdir():
43
+ if p.is_file():files['models/'+model_id+'/'+p.name]=p
44
+ here=Path(__file__).parent
45
+ for name in ('convert_models.py','cascade_litert.py','build_release_docs.py','publish_release.py','diagnose_detector_parity.py','finalize_detector_sets.py','validate_cascade.py','plot_benchmark.py','inference.py'):
46
+ files['conversion/cascade-v25/'+name]=here/name
47
+ assert all(not path.startswith('/') and '..' not in Path(path).parts for path in files)
48
+ assert not any('token' in path.lower() or 'secret' in path.lower() for path in files)
49
+ inventory={name:dict(bytes=p.stat().st_size,sha256=sha(p)) for name,p in files.items()}
50
+ save(OUT/'publication-plan.json',dict(destination=REPO,parent=info.sha,files=inventory,historical_models=old_models))
51
+ print('PUBLISHING_FOUR_VALIDATED_LITERT_MODELS',len(files),sum(x['bytes'] for x in inventory.values()),flush=True)
52
+ commit=api.create_commit(repo_id=REPO,parent_commit=info.sha,
53
+ operations=[CommitOperationAdd(path_in_repo=name,path_or_fileobj=str(path)) for name,path in sorted(files.items())],
54
+ commit_message='Add four verified v2.5 LiteRT cascade models, Cadryl contracts and bilingual 680-image benchmark')
55
+ result=api.model_info(REPO,revision=commit.oid,files_metadata=True);siblings={s.rfilename:s for s in result.siblings}
56
+ for path,record in inventory.items():
57
+ s=siblings[path];assert s.size==record['bytes'],path
58
+ if s.lfs:assert field(s.lfs,'sha256')==record['sha256'],path
59
+ else:
60
+ p=hf_hub_download(REPO,path,revision=commit.oid,token=api.token)
61
+ assert sha(p)==record['sha256'],path
62
+ for path,record in old_models.items():
63
+ s=siblings[path];assert s.size==record['bytes'] and field(s.lfs,'sha256')==record['sha256'],path
64
+ print('CENTRAL_PUBLICATION_HASHES_VERIFIED',commit.oid,flush=True)
65
+ release=json.loads((ROOT/'cascade_benchmark/release-manifest.json').read_text())
66
+ source_updates={}
67
+ for role,m in release['models'].items():
68
+ repo=m['repository'];current=api.model_info(repo,files_metadata=True)
69
+ native=next(s for s in current.siblings if s.rfilename=='model.safetensors')
70
+ assert field(native.lfs,'sha256')==m['weights_sha256'],'Source weights changed'
71
+ p=hf_hub_download(repo,'README.md',revision=current.sha,token=api.token)
72
+ text=Path(p).read_text(encoding='utf8');marker='<!-- FIREVIEWER_LITERT_V25_20261007 -->'
73
+ if marker in text:text=text.split(marker)[0].rstrip()
74
+ base=f'https://huggingface.co/{REPO}/tree/{commit.oid}/models/{IDS[role]}'
75
+ file_base=f'https://huggingface.co/{REPO}/blob/{commit.oid}/models/{IDS[role]}'
76
+ section=f'''\n\n{marker}
77
+ ## LiteRT FP32 export / Export LiteRT FP32 — 7 October 2026
78
+
79
+ The selected weights above are also available as a [verified LiteRT inference package]({base}). It includes real CPU PyTorch/LiteRT parity evidence, output/class/preprocessing contracts, an [Android ModelConfig]({file_base}/android_model_config.json) and a [Cadryl StudioPack]({file_base}/studio_pack.json). Static batch 1; no new training or quantization; Android-device qualification remains open. [Full English/French cascade and external benchmark](https://huggingface.co/{REPO}/blob/{commit.oid}/docs/CASCADE_V25.md).
80
+
81
+ Les poids sélectionnés sont également disponibles dans le [pack LiteRT d'inférence]({base}), avec validation numérique CPU, classes, coordonnées et prétraitement, contrat Android et format Cadryl. L'export conserve la sémantique et les seuils figés ; il ne constitue pas une qualification sur téléphone. Le benchmark distingue alerte d'image et localisation précise des petites flammes. Les points/masques fumée rejetés sont exclus.
82
+ '''
83
+ changed=(text.rstrip()+section).encode('utf8')
84
+ update=api.create_commit(repo_id=repo,parent_commit=current.sha,
85
+ operations=[CommitOperationAdd(path_in_repo='README.md',path_or_fileobj=changed)],
86
+ commit_message='Link validated LiteRT/Cadryl inference package and full bilingual cascade benchmark')
87
+ verified=api.model_info(repo,revision=update.oid,files_metadata=True)
88
+ after=next(s for s in verified.siblings if s.rfilename=='model.safetensors')
89
+ assert field(after.lfs,'sha256')==m['weights_sha256']
90
+ source_updates[repo]=update.oid
91
+ collection=api.add_collection_item(COLLECTION,REPO,'model',exists_ok=True,
92
+ note='EN/FR: Four v2.5 LiteRT FP32 cascade packages, standard + Cadryl contracts, CPU parity and the 680-image external diagnostic. Inference only; Android qualification pending. Tiny-flame localization is still limited (22.59% recall).')
93
+ api.update_collection_metadata(COLLECTION,title='2.5 not so bad',private=False,
94
+ description='EN/FR: Selected FireViewer v2.5 cascade checkpoints and verified LiteRT FP32/Cadryl packages. The 680-image diagnostic separates image alerting from precise tiny-flame localization. Scientific cards, datasets and frozen provenance linked.')
95
+ collection=api.get_collection(COLLECTION)
96
+ notes={'proposal':'Stage 1 / étape 1: probable_fire proposals on whole images, RF-DETR M at 1088px. Frozen epoch 10/15. LiteRT FP32 and Cadryl contract in fireviewer/litert-models; linked corpus in the model card.',
97
+ 'visible':'Stage 2 / étape 2: visible_flame boxes in proposal crops, RF-DETR M at 1088px. Frozen epoch 8/10. External tiny recall 22.59% for the complete cascade; precise instance localization remains weak. LiteRT/Cadryl and dataset linked.',
98
+ 'point':'Stage 3 / étape 3: one flame_base_anchor per tight detected flame crop, DINOv2-S heatmap at 448px. Appearance anchor; independent base-point accuracy unmeasured. LiteRT/Cadryl and crop-monopoint dataset linked.',
99
+ 'smoke':'Smoke branch / branche fumée: DINOv2-S calibrated binary visual compatibility at 448px, low/ambiguous/high triage. No mask or smoke point. LiteRT/Cadryl and classification corpus linked.'}
100
+ for role,m in release['models'].items():
101
+ item=next(i for i in collection.items if i.item_id==m['repository'])
102
+ api.update_collection_item(COLLECTION,item.item_object_id,note=notes[role])
103
+ final_collection=api.get_collection(COLLECTION)
104
+ assert not final_collection.private and {REPO,*[m['repository'] for m in release['models'].values()]}.issubset({i.item_id for i in final_collection.items})
105
+ receipt=dict(status='complete_verified',repository=REPO,revision=commit.oid,
106
+ collection=COLLECTION,source_card_updates=source_updates,files=inventory,historical_models_preserved=old_models,
107
+ finished=datetime.now(timezone.utc).isoformat(),no_training=True,no_PC_weights=True,
108
+ rejected_smoke_spatial_models_published=False,android_device_tested=False)
109
+ save(OUT/'publication-receipt.json',receipt)
110
+ compact=dict(status=receipt['status'],repository=REPO,revision=commit.oid,
111
+ models={role:dict(folder='models/'+model_id,sha256=inventory['models/'+model_id+'/model.tflite']['sha256'],
112
+ bytes=inventory['models/'+model_id+'/model.tflite']['bytes']) for role,model_id in IDS.items()},
113
+ source_card_updates=source_updates,collection=COLLECTION,finished=receipt['finished'],
114
+ historical_model_count=6,new_model_count=4,android_device_tested=False)
115
+ save(OUT/'publication-summary.json',compact)
116
+ api.upload_file(repo_id=REPO,path_in_repo='reports/cascade-v25-litert-publication.json',
117
+ path_or_fileobj=str(OUT/'publication-summary.json'),commit_message='Record verified LiteRT cascade publication and preserved historical packages')
118
+ print('LITERT_PUBLICATION_COMPLETE',json.dumps(compact),flush=True)
119
+ return receipt
conversion/cascade-v25/validate_cascade.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Exercise the complete LiteRT cascade against frozen L4 reference outputs."""
2
+ from pathlib import Path
3
+ import hashlib,io,json,time,zipfile
4
+ import numpy as np
5
+ import torch
6
+ from inference import load_model,cascade
7
+ from PIL import Image
8
+ from scipy.optimize import linear_sum_assignment
9
+ from cascade_litert import Cascade
10
+
11
+ ROOT=Path('/content/drive/MyDrive/FireViewer/trainv2.5final1')
12
+ OUT=ROOT/'litert/20261007'
13
+
14
+ def match(a,b,key):
15
+ assert len(a)==len(b),('Output count differs',len(a),len(b),key)
16
+ if not a:return []
17
+ aa=np.asarray([key(x) for x in a]);bb=np.asarray([key(x) for x in b])
18
+ cost=np.abs(aa[:,None,:]-bb[None,:,:]).mean(2)
19
+ _,order=linear_sum_assignment(cost)
20
+ return [b[i] for i in order]
21
+
22
+ def run():
23
+ selection=json.loads((ROOT/'cascade_benchmark/natural-selection.json').read_text())
24
+ records=sorted(selection['records'],key=lambda x:x['id'])
25
+ chosen=[]
26
+ for group in ('flame','smoke','negative'):
27
+ families=set()
28
+ for r in records:
29
+ if r['group']!=group or r['visual_family_id'] in families:continue
30
+ families.add(r['visual_family_id']);chosen.append(r)
31
+ if len(families)==2:break
32
+ references={}
33
+ for line in (ROOT/'cascade_benchmark/results-20261006-234144/predictions.jsonl').read_text().splitlines():
34
+ value=json.loads(line);references[value['id']]=value['output']
35
+ recipe=dict(ids=[x['id'] for x in chosen],selection='First two sorted unique visual families per stratum; no prediction-dependent selection',
36
+ tolerances=dict(normalized_box_atol=.001,score_atol=.002,normalized_point_atol=.005,rtol=.001),
37
+ semantics='numerical routing/regression, not a new independent benchmark',device='CPU LiteRT vs same-CPU PyTorch',test_used=False)
38
+ (OUT/'cascade-parity-plan.json').write_text(json.dumps(recipe,indent=2))
39
+ torch.set_num_threads(4);torch.set_grad_enabled(False)
40
+ release=json.loads((ROOT/'cascade_benchmark/release-manifest.json').read_text())
41
+ native={role:load_model(Path('/content/fireviewer-litert-execution/models')/m['repository'].split('/')[-1],'cpu') for role,m in release['models'].items()}
42
+ for role in ('proposal','visible'):native[role][0].model.model.eval()
43
+ model=Cascade(OUT,threads=4)
44
+ checks=[];predictions=[];began=time.perf_counter()
45
+ with zipfile.ZipFile('/content/fireviewer-litert-execution/natural-selected.zip') as packed:
46
+ for r in chosen:
47
+ payload=packed.read(r['member']);assert hashlib.sha256(payload).hexdigest()==r['sha256']
48
+ image=Image.open(io.BytesIO(payload)).convert('RGB');scale=np.array([image.width,image.height]*2)
49
+ started=time.perf_counter();actual=model(image);elapsed=time.perf_counter()-started
50
+ expected=cascade(image,native['proposal'],native['visible'],native['point'],native['smoke'],device='cpu')
51
+ gpu=references[r['id']]
52
+ gpu_comparison=dict(flame_count_reference=len(gpu['visible_flames']),flame_count_litert=len(actual['visible_flames']),
53
+ smoke_count_reference=len(gpu['smoke_compatibility']),smoke_count_litert=len(actual['smoke_compatibility']),
54
+ image_alarm_reference=bool(gpu['visible_flames']) or any(x['status']=='fire_smoke_probable' for x in gpu['smoke_compatibility']),
55
+ image_alarm_litert=bool(actual['visible_flames']) or any(x['status']=='fire_smoke_probable' for x in actual['smoke_compatibility']),
56
+ normalized_boxes=[],normalized_points=[],smoke_probability_errors=[],strict_cross_backend_numeric_pass=True)
57
+ try:
58
+ gpu_flames=match(gpu['visible_flames'],actual['visible_flames'],lambda x:x['bbox_xyxy'])
59
+ for e,a in zip(gpu['visible_flames'],gpu_flames):
60
+ eb=np.asarray(e['bbox_xyxy'])/scale;ab=np.asarray(a['bbox_xyxy'])/scale
61
+ gpu_comparison['normalized_boxes'].append(float(np.abs(eb-ab).max()))
62
+ gpu_comparison['strict_cross_backend_numeric_pass'] &= bool(np.allclose(eb,ab,atol=.001,rtol=.001)) and bool(np.isclose(e['score'],a['score'],atol=.002,rtol=.001))
63
+ ep=np.asarray(e['point']['point_xy_original'])/np.array(image.size);ap=np.asarray(a['point']['point_xy_original'])/np.array(image.size)
64
+ gpu_comparison['normalized_points'].append(float(np.abs(ep-ap).max()))
65
+ gpu_comparison['strict_cross_backend_numeric_pass'] &= bool(np.allclose(ep,ap,atol=.005,rtol=.001))
66
+ gpu_smoke=match(gpu['smoke_compatibility'],actual['smoke_compatibility'],lambda x:x['proposal_bbox_xyxy'])
67
+ for e,a in zip(gpu['smoke_compatibility'],gpu_smoke):
68
+ error=abs(e['probability']-a['probability']);gpu_comparison['smoke_probability_errors'].append(error)
69
+ gpu_comparison['strict_cross_backend_numeric_pass'] &= e['status']==a['status'] and bool(np.isclose(e['probability'],a['probability'],atol=.002,rtol=.001))
70
+ except AssertionError as error:
71
+ gpu_comparison['strict_cross_backend_numeric_pass']=False;gpu_comparison['difference']=str(error)
72
+ print('L4_VS_CPU_LITERT_DIAGNOSTIC',json.dumps(dict(id=r['id'],**gpu_comparison)),flush=True)
73
+ (OUT/('cascade-parity-debug-'+r['id']+'.json')).write_text(json.dumps(dict(id=r['id'],expected=expected,actual=actual),indent=2))
74
+ flames=match(expected['visible_flames'],actual['visible_flames'],lambda x:x['bbox_xyxy'])
75
+ box_max=score_max=point_max=0
76
+ for e,a in zip(expected['visible_flames'],flames):
77
+ eb=np.asarray(e['bbox_xyxy'])/scale;ab=np.asarray(a['bbox_xyxy'])/scale
78
+ box_max=max(box_max,float(np.abs(eb-ab).max()));assert np.allclose(eb,ab,atol=.001,rtol=.001)
79
+ score_max=max(score_max,abs(e['score']-a['score']));assert np.isclose(e['score'],a['score'],atol=.002,rtol=.001)
80
+ ep=np.asarray(e['point']['point_xy_original'])/np.array(image.size)
81
+ ap=np.asarray(a['point']['point_xy_original'])/np.array(image.size)
82
+ point_max=max(point_max,float(np.abs(ep-ap).max()));assert np.allclose(ep,ap,atol=.005,rtol=.001)
83
+ smoke=match(expected['smoke_compatibility'],actual['smoke_compatibility'],lambda x:x['proposal_bbox_xyxy'])
84
+ smoke_max=0
85
+ for e,a in zip(expected['smoke_compatibility'],smoke):
86
+ assert e['status']==a['status'],('Smoke triage changed',r['id'],e['status'],a['status'])
87
+ smoke_max=max(smoke_max,abs(e['probability']-a['probability']))
88
+ assert np.isclose(e['probability'],a['probability'],atol=.002,rtol=.001),dict(id=r['id'],expected_smoke=e,actual_smoke=a)
89
+ assert a['source_location'] is None
90
+ check=dict(id=r['id'],group=r['group'],flames=len(flames),smoke_ROIs=len(smoke),
91
+ normalized_box_max=box_max,score_max=score_max,normalized_point_max=point_max,
92
+ smoke_probability_max=smoke_max,latency_seconds=elapsed,status='passed',l4_cross_backend=gpu_comparison)
93
+ checks.append(check);predictions.append(dict(id=r['id'],output=actual))
94
+ print('CASCADE_LITERT_PARITY',json.dumps(check),flush=True)
95
+ result=dict(status='passed',samples=len(checks),plan=recipe,checks=checks,
96
+ total_seconds=time.perf_counter()-began,reference_backend='Frozen source weights in eager PyTorch FP32 on the same CPU',
97
+ l4_reference_backend='Original 680-image PyTorch FP32 benchmark on L4',
98
+ l4_exact_numerical_parity=all(x['l4_cross_backend']['strict_cross_backend_numeric_pass'] for x in checks),
99
+ l4_alarm_decisions_equal=all(x['l4_cross_backend']['image_alarm_reference']==x['l4_cross_backend']['image_alarm_litert'] for x in checks),
100
+ backend='CPU LiteRT',full_680_litert_semantic_rebenchmark=False,
101
+ stage_calls_present=dict(visible=any(x['flames'] for x in checks),point=any(x['flames'] for x in checks),smoke=any(x['smoke_ROIs'] for x in checks)),
102
+ android_device_tested=False,test_used=False)
103
+ assert all(result['stage_calls_present'].values()),'All branches must be exercised'
104
+ (OUT/'cascade-parity.json').write_text(json.dumps(result,indent=2))
105
+ (OUT/'cascade-parity-predictions.jsonl').write_text('\n'.join(json.dumps(x) for x in predictions)+'\n')
106
+ print('FULL_LITERT_CASCADE_PARITY_PASSED',len(checks),flush=True)
107
+
108
+ if __name__=='__main__':run()
docs/CASCADE_V25.en.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FireViewer v2.5 — Cascade / Cascade complète
2
+
3
+ ## English
4
+
5
+ Four frozen, selected checkpoints are now exported to inference-only LiteRT FP32. The source PyTorch revisions and safetensor digests are recorded per package. No new training, quantization, calibration or threshold tuning accompanies the conversion. Ordinary consumers use `runtime_contract.json`, per-output label maps and `preprocessor_config.json`; Cadryl uses its exact `android_model_config.json` schema or `studio_pack.json` (`vision-studio-pack/1`). The six historical packages remain available with their original scope and evidence.
6
+
7
+ | Stage / Étape | LiteRT package | Input | CPU numeric parity | Android device |
8
+ |---|---|---|---|---|
9
+ | proposal | [fireviewer_rfdetr_medium_probable_fire_v25_fp32](../models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .10 operating threshold · 11 inputs | Not qualified / Non qualifié |
10
+ | visible | [fireviewer_rfdetr_medium_visible_flame_v25_fp32](../models/fireviewer_rfdetr_medium_visible_flame_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .25 operating threshold · 11 inputs | Not qualified / Non qualifié |
11
+ | point | [fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32](../models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 5 inputs | Not qualified / Non qualifié |
12
+ | smoke | [fireviewer_dinov2_small_fire_associated_smoke_v25_fp32](../models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 11 inputs | Not qualified / Non qualifié |
13
+
14
+ ### Functional routing
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ I[RGB whole image] --> P[RF-DETR M probable_fire · 1088]
19
+ P --> R[score .10 · NMS .75 · at most 6 ROI]
20
+ R --> V[30% context · min 128px · RF-DETR M visible_flame · 1088]
21
+ V --> F[Flame boxes · score .25 · reprojection · global NMS .60]
22
+ F --> K[Tight flame crops · DINOv2-S heatmap · 448]
23
+ K --> A[One flame_base_anchor per detected flame]
24
+ V --> G[ROI without a local confirmed flame]
25
+ G --> S[45% context · min 160px · DINOv2-S smoke classifier · 448]
26
+ S --> T[Calibrated compatibility · low / ambiguous / high]
27
+ ```
28
+
29
+ Context is added on each side: expanded width and height are multiplied by `1 + 2 × context`, before the minimum side and image clipping. RF-DETR receives NCHW float32 RGB resized with half-pixel bilinear interpolation, **no antialias**, with RGB converted to float before resize; normalization is ImageNet mean `[.485,.456,.406]`, std `[.229,.224,.225]`. Point crops use Pillow bilinear; smoke crops use Pillow bicubic. All models stretch to the specified square size. The supplied NumPy/Pillow runner preserves these differences.
30
+
31
+ Proposal score ≥0.10, NMS IoU 0.75, limit 6; visible score ≥0.25 and global image-space NMS 0.60, limit 100. Tight point crops use floor for the minimum and ceil for the maximum. The heatmap point is the argmax followed by a local 5×5 softmax expectation at heatmap pixel centers. It is an appearance anchor, **not an ignition location**, geographic position or independently calibrated source confidence.
32
+
33
+ Smoke temperature is **1.1490650177001953**. Low compatibility ≤**0.30160276398937463**; high compatibility ≥**0.8199750333466715**; values between these are ambiguous and do not raise the benchmark image alarm. Smoke is a binary visual compatibility classifier. It supplies no mask, smoke-core, smoke point or origin. No learned fire-group association is performed.
34
+
35
+ ### Conventional format and Cadryl
36
+
37
+ Every package contains `model.tflite`, actual input/output shapes, output positions, class maps, preprocessing, source revision/digests, validation and a SHA256 manifest. The conventional detector outputs are all 300 normalized cxcywh boxes and raw class logits; active class is index **0**, index 1 is unused background. The supplied runner reproduces the stable native global top-300 query/class sort.
38
+
39
+ Cadryl's RF-DETR adapter skips index 0. The compatible graph therefore also exposes **YOLO-style BCN `[1,5,300]`** (`cx,cy,w,h,active probability`), preserving RF-DETR weights and architecture. The graph selects the global top 300 sigmoid query/class scores and zeros scores for unused background. Cadryl applies its configured threshold/NMS. For the visible specialist this is single-crop annotation; the complete cascade must reproject first and apply global NMS through the runner. Importing one model in Cadryl does not automatically orchestrate all four models.
40
+
41
+ **Detector conversion qualification is scoped to the frozen operating points (.10 / .25).** All-300 raw-query numerical parity fails for a few very-low-score candidates, even after set correspondence. These changes are consistent with near-tied two-stage top-k selection across FP32 backends (a diagnostic inference). Operative detection counts, boxes and scores pass the original numerical bounds; low-score raw discrepancies remain disclosed in each `conversion_validation.json` and `raw-query-diagnostic.json`. Query row identity and lower score cutoffs are not qualified. The DINOv2 heatmap/point and calibrated probabilities pass tensor-output comparisons. No numerical tolerance was loosened to hide raw-query changes.
42
+
43
+ The point graph exposes `[1,1,2]` normalized x/y and raw `[1,1,128,128]` heatmap logits. A two-coordinate Cadryl point has an implicit score of 1; **this is structural presence, not calibrated confidence**. Use the point model only on tight confirmed flame crops. The smoke graph exposes raw logit, complementary calibrated probabilities, and `[1,1]` positive probability. Cadryl annotates only high positive compatibility, while host code retains low/ambiguous/high triage.
44
+
45
+ Cadryl Android scales bitmaps with bilinear integer-pixel interpolation. Exact float-resize detector parity and bicubic smoke pixel parity on Android are not demonstrated. CPU LiteRT invocation and ModelConfig compatibility do not qualify an Android phone, APK, GPU/NPU delegate, memory budget or application accuracy. These four new graphs have **no train/save/restore signatures**. Do not apply the historical trainable-head SDK contract to them.
46
+
47
+ ### Reproduce inference
48
+
49
+ ```bash
50
+ pip install ai-edge-litert==2.2.0 numpy pillow huggingface_hub
51
+ hf download fireviewer/litert-models --revision <publication-revision> --local-dir ./fireviewer-litert
52
+ python fireviewer-litert/cascade/v2.5/cascade_litert.py --root ./fireviewer-litert --image image.jpg --output predictions.json --threads 2
53
+ ```
54
+
55
+ Pin the immutable publication revision from `reports/cascade-v25-litert-publication.json`. Check each package manifest before inference. Loading the models and each model's numerical conversion tests are separate from semantic evaluation. No test split was used during conversion. Conversion probes include annotation-derived crops solely for tensor regression; they are **not** a proposals-only semantic validation set.
56
+
57
+ The complete LiteRT runner is also compared with eager PyTorch on the same CPU on six preselected images (two distinct visual families per stratum), exercising all four stages. The original L4 outputs are retained as a separate cross-backend diagnostic. Small detector differences can cross an integer crop boundary and amplify downstream probability changes; exact end-to-end L4 equivalence is not presumed. These six numerical-regression cases do not replace the original 680-image semantic benchmark or constitute a full LiteRT rebenchmark. See [routing evidence](../reports/cascade-v25-litert-routing-validation.json).
58
+
59
+ ### Full-cascade benchmark — 680 images
60
+
61
+ Frozen PyTorch FP32 pipeline on L4; no fitting or threshold selection on this panel. Case mix: 179 flame, 70 smoke, 431 negative images, 229 visual families. There may be several views of a family; families are not verified independent fire incidents.
62
+
63
+ | Endpoint | Result | Numerator / denominator |
64
+ |---|---:|---:|
65
+ | Positive-image alarm recall | 88.35% | 220 / 249 |
66
+ | Sampled image alarm precision | 81.78% | 220 / 269 |
67
+ | Negative-image false-alarm rate | 11.37% | 49 / 431 |
68
+ | Flame-image any-branch alarm recall | 99.44% | 178 / 179 |
69
+ | Smoke-only any-branch alarm recall | 60.00% | 42 / 70 |
70
+ | Flame bbox recall, IoU ≥ .5 | 25.64% | 231 / 901 |
71
+ | Flame bbox precision, IoU ≥ .5 | 27.57% | 231 / 838 |
72
+ | Tiny flame recall | 22.59% | 178 / 788 |
73
+ | Multi-flame instance recall | 24.72% | 219 / 886 |
74
+ | Expanded-proposal containment | 97.89% | 882 / 901 |
75
+ | Point inside matched GT flame bbox | 97.84% | 226 / 231 |
76
+ | Smoke-only image with false flame | 10.00% | 7 / 70 |
77
+
78
+ An image alarm is any visible-flame output **or** high smoke compatibility; it is not a statement that every flame has a precise box. There were TP=220, FP=49, FN=29, TN=382 for image alarms; flame localization TP=231, FP=607, FN=670. Tiny means bbox area/image area ≤ `(32/1088)^2`, a protocol bin rather than original-pixel COCO-small. Proposal containment means at least 90% of the GT box lies within an expanded proposal. The 229-image one-representative-per-family panel still has tiny recall 101/399=25.31%.
79
+
80
+ **Interpretation:** stage 1 generally provides coverage, while precise instance separation/localization of small visible flames remains the primary weakness. In the inspected worst-error gallery, several small annotated flames are merged into a broader detection. This is an observed error pattern, not a proven causal attribution for every miss. Good image suspicion and low box recall can coexist. The point-in-box statistic measures consistency only: no independent human flame-base GT is available, so PCK and base accuracy are unmeasured. Smoke-only labels establish visible smoke, not independently verified fire association.
81
+
82
+ Mean end-to-end inference latency was 226.82 ms/image, median 172.44 ms, P95 458.01 ms on **L4 PyTorch**. All invoked stages, decoding, preprocessing, NMS and reprojection are included; model loading/warmup are excluded. Stage calls: proposal 680, visible 1636, point 838, smoke 855. These are not LiteRT or Android performance figures. Separate CPU LiteRT numerical-test timings are recorded per conversion, with different samples and workload.
83
+
84
+ The image-level SHA/perceptual novelty audit covered all known historical splits including private sources and legacy FASDD/Pyro-SDIS manifests. Detected neighbors and suspected FLAME1 scenes were excluded before inference. No detected duplicate proves neither unseen events nor complete unknown provenance. Sources: [DIFD](https://zenodo.org/records/15860575) and [SAINetset v8](https://huggingface.co/datasets/SAINetset/SAINetset_v8.0), whose images may include synthetic/donated material. Only 208 retained images had a visual QA pass; there is no independent human annotation audit. Ratios describe this selected correlated panel, with no independent-event confidence intervals or deployment certification.
85
+
86
+ [Full report](../reports/cascade-v25-680/REPORT.md) · [Machine-readable metrics](../reports/cascade-v25-680/metrics.json) · [Frozen release manifest](../cascade/v2.5/source-release-manifest.json)
87
+
88
+ ![Descriptive image-alert and flame-localization metrics](figures/cascade-v25-benchmark.png)
89
+
90
+ ## Français
91
+
92
+ La cascade utilise quatre checkpoints figés : propositions `probable_fire` sur image entière, spécialiste `visible_flame` dans les ROI, ancre flamme sur crop serré, puis classifieur fumée uniquement pour les ROI sans flamme locale confirmée. Les boîtes flamme sont reprojetées et dédoublonnées dans l'image entière. La fumée fournit un état bas/ambigu/haut ; aucun masque ni point fumée rejeté n'est publié. Les seuils restent ceux du benchmark, sans nouvel entraînement ni ajustement sur le lot.
93
+
94
+ Chaque export FP32 dispose d'un contrat conventionnel, des classes, des prétraitements exacts, d'un reçu de validation CPU et de SHA256. Les fichiers `android_model_config.json` et `studio_pack.json` utilisent les schémas réels de Cadryl. Le tensor BCN compatible YOLO ne change pas l'architecture RF-DETR : il évite que son indice de classe active 0 soit ignoré par l'adaptateur RF-DETR actuel. Le point normalisé est une **ancre d'apparence de flamme**, pas une origine d'incendie. Son score implicite Cadryl n'est pas une confiance calibrée. La classification fumée conserve sa température et ses deux seuils ; Cadryl ne propose que les positifs hauts.
95
+
96
+ La comparaison numérique LiteRT/PyTorch confirme le calcul sur les entrées testées. Elle ne démontre ni la précision des annotations ni le fonctionnement sur téléphone. Les différences de redimensionnement Android, les délégués GPU/NPU, la mémoire et la latence Android restent à qualifier. Les quatre nouveaux exports sont réservés à l'inférence, sans signatures d'apprentissage. L'import d'un modèle individuel dans Cadryl n'exécute pas automatiquement la cascade entière.
97
+
98
+ La qualification RF-DETR concerne les détections aux seuils figés **0,10 / 0,25**. Quelques candidats bruts de très faible score diffèrent entre les backends ; l'équivalence numérique des 300 candidats n'est donc pas validée. Ces écarts et les seuils non qualifiés sont conservés dans les reçus. Les sorties point/heatmap et les probabilités DINOv2 passent les comparaisons de tenseurs. Aucun seuil ni tolérance n'a été modifié pour masquer les écarts.
99
+
100
+ Sur 680 images, l'alerte récupère **88,35%** des images positives mais produit une alerte sur **11,37%** des négatifs. La localisation à IoU ≥ 0,5 retrouve seulement **25,64%** des boîtes flamme et **22,59%** des petites flammes. Les propositions couvrent pourtant **97,89%** des boîtes GT : le principal besoin est donc la séparation/localisation précise des instances par le spécialiste visible, sous cette distribution difficile. Les cas inspectés montrent notamment des petites flammes réunies dans une boîte trop large.
101
+
102
+ Les **97,84%** de points dans une boîte flamme GT appariée sont un contrôle de cohérence, pas une mesure de justesse de base du feu : les points GT humains indépendants manquent. Les 229 familles visuelles, les vues corrélées, les annotations de source et les données SAI potentiellement synthétiques limitent la portée de ce diagnostic. Le test historique reste verrouillé. La latence médiane **172,44 ms/image** concerne PyTorch sur L4, pas LiteRT ou Android.
103
+
104
+ ## Sources / Références
105
+
106
+ The original cards contain training recipes, selected-validation results, publication-subset differences and checkpoint provenance. Dataset rights remain source-specific. RF-DETR and DINOv2 source notices and Apache-2.0 licences are retained per package.
107
+
108
+ [LiteRT PyTorch conversion](https://ai.google.dev/edge/litert/conversion/pytorch/overview) · [Official litert-torch](https://github.com/google-ai-edge/litert-torch) · [RF-DETR](https://github.com/roboflow/rf-detr) · [DINOv2](https://github.com/facebookresearch/dinov2)
docs/CASCADE_V25.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FireViewer v2.5 — Cascade / Cascade complète
2
+
3
+ ## English
4
+
5
+ Four frozen, selected checkpoints are now exported to inference-only LiteRT FP32. The source PyTorch revisions and safetensor digests are recorded per package. No new training, quantization, calibration or threshold tuning accompanies the conversion. Ordinary consumers use `runtime_contract.json`, per-output label maps and `preprocessor_config.json`; Cadryl uses its exact `android_model_config.json` schema or `studio_pack.json` (`vision-studio-pack/1`). The six historical packages remain available with their original scope and evidence.
6
+
7
+ | Stage / Étape | LiteRT package | Input | CPU numeric parity | Android device |
8
+ |---|---|---|---|---|
9
+ | proposal | [fireviewer_rfdetr_medium_probable_fire_v25_fp32](../models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .10 operating threshold · 11 inputs | Not qualified / Non qualifié |
10
+ | visible | [fireviewer_rfdetr_medium_visible_flame_v25_fp32](../models/fireviewer_rfdetr_medium_visible_flame_v25_fp32/README.md) | 1088 px · batch 1 | PASS at .25 operating threshold · 11 inputs | Not qualified / Non qualifié |
11
+ | point | [fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32](../models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 5 inputs | Not qualified / Non qualifié |
12
+ | smoke | [fireviewer_dinov2_small_fire_associated_smoke_v25_fp32](../models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md) | 448 px · batch 1 | PASS tensor outputs · 11 inputs | Not qualified / Non qualifié |
13
+
14
+ ### Functional routing
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ I[RGB whole image] --> P[RF-DETR M probable_fire · 1088]
19
+ P --> R[score .10 · NMS .75 · at most 6 ROI]
20
+ R --> V[30% context · min 128px · RF-DETR M visible_flame · 1088]
21
+ V --> F[Flame boxes · score .25 · reprojection · global NMS .60]
22
+ F --> K[Tight flame crops · DINOv2-S heatmap · 448]
23
+ K --> A[One flame_base_anchor per detected flame]
24
+ V --> G[ROI without a local confirmed flame]
25
+ G --> S[45% context · min 160px · DINOv2-S smoke classifier · 448]
26
+ S --> T[Calibrated compatibility · low / ambiguous / high]
27
+ ```
28
+
29
+ Context is added on each side: expanded width and height are multiplied by `1 + 2 × context`, before the minimum side and image clipping. RF-DETR receives NCHW float32 RGB resized with half-pixel bilinear interpolation, **no antialias**, with RGB converted to float before resize; normalization is ImageNet mean `[.485,.456,.406]`, std `[.229,.224,.225]`. Point crops use Pillow bilinear; smoke crops use Pillow bicubic. All models stretch to the specified square size. The supplied NumPy/Pillow runner preserves these differences.
30
+
31
+ Proposal score ≥0.10, NMS IoU 0.75, limit 6; visible score ≥0.25 and global image-space NMS 0.60, limit 100. Tight point crops use floor for the minimum and ceil for the maximum. The heatmap point is the argmax followed by a local 5×5 softmax expectation at heatmap pixel centers. It is an appearance anchor, **not an ignition location**, geographic position or independently calibrated source confidence.
32
+
33
+ Smoke temperature is **1.1490650177001953**. Low compatibility ≤**0.30160276398937463**; high compatibility ≥**0.8199750333466715**; values between these are ambiguous and do not raise the benchmark image alarm. Smoke is a binary visual compatibility classifier. It supplies no mask, smoke-core, smoke point or origin. No learned fire-group association is performed.
34
+
35
+ ### Conventional format and Cadryl
36
+
37
+ Every package contains `model.tflite`, actual input/output shapes, output positions, class maps, preprocessing, source revision/digests, validation and a SHA256 manifest. The conventional detector outputs are all 300 normalized cxcywh boxes and raw class logits; active class is index **0**, index 1 is unused background. The supplied runner reproduces the stable native global top-300 query/class sort.
38
+
39
+ Cadryl's RF-DETR adapter skips index 0. The compatible graph therefore also exposes **YOLO-style BCN `[1,5,300]`** (`cx,cy,w,h,active probability`), preserving RF-DETR weights and architecture. The graph selects the global top 300 sigmoid query/class scores and zeros scores for unused background. Cadryl applies its configured threshold/NMS. For the visible specialist this is single-crop annotation; the complete cascade must reproject first and apply global NMS through the runner. Importing one model in Cadryl does not automatically orchestrate all four models.
40
+
41
+ **Detector conversion qualification is scoped to the frozen operating points (.10 / .25).** All-300 raw-query numerical parity fails for a few very-low-score candidates, even after set correspondence. These changes are consistent with near-tied two-stage top-k selection across FP32 backends (a diagnostic inference). Operative detection counts, boxes and scores pass the original numerical bounds; low-score raw discrepancies remain disclosed in each `conversion_validation.json` and `raw-query-diagnostic.json`. Query row identity and lower score cutoffs are not qualified. The DINOv2 heatmap/point and calibrated probabilities pass tensor-output comparisons. No numerical tolerance was loosened to hide raw-query changes.
42
+
43
+ The point graph exposes `[1,1,2]` normalized x/y and raw `[1,1,128,128]` heatmap logits. A two-coordinate Cadryl point has an implicit score of 1; **this is structural presence, not calibrated confidence**. Use the point model only on tight confirmed flame crops. The smoke graph exposes raw logit, complementary calibrated probabilities, and `[1,1]` positive probability. Cadryl annotates only high positive compatibility, while host code retains low/ambiguous/high triage.
44
+
45
+ Cadryl Android scales bitmaps with bilinear integer-pixel interpolation. Exact float-resize detector parity and bicubic smoke pixel parity on Android are not demonstrated. CPU LiteRT invocation and ModelConfig compatibility do not qualify an Android phone, APK, GPU/NPU delegate, memory budget or application accuracy. These four new graphs have **no train/save/restore signatures**. Do not apply the historical trainable-head SDK contract to them.
46
+
47
+ ### Reproduce inference
48
+
49
+ ```bash
50
+ pip install ai-edge-litert==2.2.0 numpy pillow huggingface_hub
51
+ hf download fireviewer/litert-models --revision <publication-revision> --local-dir ./fireviewer-litert
52
+ python fireviewer-litert/cascade/v2.5/cascade_litert.py --root ./fireviewer-litert --image image.jpg --output predictions.json --threads 2
53
+ ```
54
+
55
+ Pin the immutable publication revision from `reports/cascade-v25-litert-publication.json`. Check each package manifest before inference. Loading the models and each model's numerical conversion tests are separate from semantic evaluation. No test split was used during conversion. Conversion probes include annotation-derived crops solely for tensor regression; they are **not** a proposals-only semantic validation set.
56
+
57
+ The complete LiteRT runner is also compared with eager PyTorch on the same CPU on six preselected images (two distinct visual families per stratum), exercising all four stages. The original L4 outputs are retained as a separate cross-backend diagnostic. Small detector differences can cross an integer crop boundary and amplify downstream probability changes; exact end-to-end L4 equivalence is not presumed. These six numerical-regression cases do not replace the original 680-image semantic benchmark or constitute a full LiteRT rebenchmark. See [routing evidence](../reports/cascade-v25-litert-routing-validation.json).
58
+
59
+ ### Full-cascade benchmark — 680 images
60
+
61
+ Frozen PyTorch FP32 pipeline on L4; no fitting or threshold selection on this panel. Case mix: 179 flame, 70 smoke, 431 negative images, 229 visual families. There may be several views of a family; families are not verified independent fire incidents.
62
+
63
+ | Endpoint | Result | Numerator / denominator |
64
+ |---|---:|---:|
65
+ | Positive-image alarm recall | 88.35% | 220 / 249 |
66
+ | Sampled image alarm precision | 81.78% | 220 / 269 |
67
+ | Negative-image false-alarm rate | 11.37% | 49 / 431 |
68
+ | Flame-image any-branch alarm recall | 99.44% | 178 / 179 |
69
+ | Smoke-only any-branch alarm recall | 60.00% | 42 / 70 |
70
+ | Flame bbox recall, IoU ≥ .5 | 25.64% | 231 / 901 |
71
+ | Flame bbox precision, IoU ≥ .5 | 27.57% | 231 / 838 |
72
+ | Tiny flame recall | 22.59% | 178 / 788 |
73
+ | Multi-flame instance recall | 24.72% | 219 / 886 |
74
+ | Expanded-proposal containment | 97.89% | 882 / 901 |
75
+ | Point inside matched GT flame bbox | 97.84% | 226 / 231 |
76
+ | Smoke-only image with false flame | 10.00% | 7 / 70 |
77
+
78
+ An image alarm is any visible-flame output **or** high smoke compatibility; it is not a statement that every flame has a precise box. There were TP=220, FP=49, FN=29, TN=382 for image alarms; flame localization TP=231, FP=607, FN=670. Tiny means bbox area/image area ≤ `(32/1088)^2`, a protocol bin rather than original-pixel COCO-small. Proposal containment means at least 90% of the GT box lies within an expanded proposal. The 229-image one-representative-per-family panel still has tiny recall 101/399=25.31%.
79
+
80
+ **Interpretation:** stage 1 generally provides coverage, while precise instance separation/localization of small visible flames remains the primary weakness. In the inspected worst-error gallery, several small annotated flames are merged into a broader detection. This is an observed error pattern, not a proven causal attribution for every miss. Good image suspicion and low box recall can coexist. The point-in-box statistic measures consistency only: no independent human flame-base GT is available, so PCK and base accuracy are unmeasured. Smoke-only labels establish visible smoke, not independently verified fire association.
81
+
82
+ Mean end-to-end inference latency was 226.82 ms/image, median 172.44 ms, P95 458.01 ms on **L4 PyTorch**. All invoked stages, decoding, preprocessing, NMS and reprojection are included; model loading/warmup are excluded. Stage calls: proposal 680, visible 1636, point 838, smoke 855. These are not LiteRT or Android performance figures. Separate CPU LiteRT numerical-test timings are recorded per conversion, with different samples and workload.
83
+
84
+ The image-level SHA/perceptual novelty audit covered all known historical splits including private sources and legacy FASDD/Pyro-SDIS manifests. Detected neighbors and suspected FLAME1 scenes were excluded before inference. No detected duplicate proves neither unseen events nor complete unknown provenance. Sources: [DIFD](https://zenodo.org/records/15860575) and [SAINetset v8](https://huggingface.co/datasets/SAINetset/SAINetset_v8.0), whose images may include synthetic/donated material. Only 208 retained images had a visual QA pass; there is no independent human annotation audit. Ratios describe this selected correlated panel, with no independent-event confidence intervals or deployment certification.
85
+
86
+ [Full report](../reports/cascade-v25-680/REPORT.md) · [Machine-readable metrics](../reports/cascade-v25-680/metrics.json) · [Frozen release manifest](../cascade/v2.5/source-release-manifest.json)
87
+
88
+ ![Descriptive image-alert and flame-localization metrics](figures/cascade-v25-benchmark.png)
89
+
90
+ ## Français
91
+
92
+ La cascade utilise quatre checkpoints figés : propositions `probable_fire` sur image entière, spécialiste `visible_flame` dans les ROI, ancre flamme sur crop serré, puis classifieur fumée uniquement pour les ROI sans flamme locale confirmée. Les boîtes flamme sont reprojetées et dédoublonnées dans l'image entière. La fumée fournit un état bas/ambigu/haut ; aucun masque ni point fumée rejeté n'est publié. Les seuils restent ceux du benchmark, sans nouvel entraînement ni ajustement sur le lot.
93
+
94
+ Chaque export FP32 dispose d'un contrat conventionnel, des classes, des prétraitements exacts, d'un reçu de validation CPU et de SHA256. Les fichiers `android_model_config.json` et `studio_pack.json` utilisent les schémas réels de Cadryl. Le tensor BCN compatible YOLO ne change pas l'architecture RF-DETR : il évite que son indice de classe active 0 soit ignoré par l'adaptateur RF-DETR actuel. Le point normalisé est une **ancre d'apparence de flamme**, pas une origine d'incendie. Son score implicite Cadryl n'est pas une confiance calibrée. La classification fumée conserve sa température et ses deux seuils ; Cadryl ne propose que les positifs hauts.
95
+
96
+ La comparaison numérique LiteRT/PyTorch confirme le calcul sur les entrées testées. Elle ne démontre ni la précision des annotations ni le fonctionnement sur téléphone. Les différences de redimensionnement Android, les délégués GPU/NPU, la mémoire et la latence Android restent à qualifier. Les quatre nouveaux exports sont réservés à l'inférence, sans signatures d'apprentissage. L'import d'un modèle individuel dans Cadryl n'exécute pas automatiquement la cascade entière.
97
+
98
+ La qualification RF-DETR concerne les détections aux seuils figés **0,10 / 0,25**. Quelques candidats bruts de très faible score diffèrent entre les backends ; l'équivalence numérique des 300 candidats n'est donc pas validée. Ces écarts et les seuils non qualifiés sont conservés dans les reçus. Les sorties point/heatmap et les probabilités DINOv2 passent les comparaisons de tenseurs. Aucun seuil ni tolérance n'a été modifié pour masquer les écarts.
99
+
100
+ Sur 680 images, l'alerte récupère **88,35%** des images positives mais produit une alerte sur **11,37%** des négatifs. La localisation à IoU ≥ 0,5 retrouve seulement **25,64%** des boîtes flamme et **22,59%** des petites flammes. Les propositions couvrent pourtant **97,89%** des boîtes GT : le principal besoin est donc la séparation/localisation précise des instances par le spécialiste visible, sous cette distribution difficile. Les cas inspectés montrent notamment des petites flammes réunies dans une boîte trop large.
101
+
102
+ Les **97,84%** de points dans une boîte flamme GT appariée sont un contrôle de cohérence, pas une mesure de justesse de base du feu : les points GT humains indépendants manquent. Les 229 familles visuelles, les vues corrélées, les annotations de source et les données SAI potentiellement synthétiques limitent la portée de ce diagnostic. Le test historique reste verrouillé. La latence médiane **172,44 ms/image** concerne PyTorch sur L4, pas LiteRT ou Android.
103
+
104
+ ## Sources / Références
105
+
106
+ The original cards contain training recipes, selected-validation results, publication-subset differences and checkpoint provenance. Dataset rights remain source-specific. RF-DETR and DINOv2 source notices and Apache-2.0 licences are retained per package.
107
+
108
+ [LiteRT PyTorch conversion](https://ai.google.dev/edge/litert/conversion/pytorch/overview) · [Official litert-torch](https://github.com/google-ai-edge/litert-torch) · [RF-DETR](https://github.com/roboflow/rf-detr) · [DINOv2](https://github.com/facebookresearch/dinov2)
docs/figures/cascade-v25-benchmark.png ADDED

Git LFS Details

  • SHA256: b26ffae08d6c1bdf47ac228df2b38a1b9313b4d44220c44b4bad84026b47f64f
  • Pointer size: 131 Bytes
  • Size of remote file: 106 kB
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/CITATION.cff ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "Please cite this research checkpoint and its upstream architecture."
3
+ title: "FireViewer v2.5: dinov2-small-fire-associated-smoke-v2.5"
4
+ authors:
5
+ - name: "FireViewer contributors"
6
+ version: "2.5"
7
+ date-released: "2026-10-06"
8
+ url: "https://huggingface.co/fireviewer/dinov2-small-fire-associated-smoke-v2.5"
9
+ license: "Apache-2.0"
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/LICENSE ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/NOTICE ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FireViewer v2.5 research release, 2026.
2
+ RF-DETR: Roboflow contributors, Apache-2.0, https://github.com/roboflow/rf-detr
3
+ DINOv2: Meta Platforms, Inc. and affiliates, Apache-2.0, https://github.com/facebookresearch/dinov2
4
+ Transformers: Hugging Face contributors, Apache-2.0, https://github.com/huggingface/transformers
5
+ Training images retain their source-specific rights. This model release does not relicense them.
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FireViewer v2.5 — fire_associated_smoke_compatible — LiteRT FP32
2
+
3
+ ## English
4
+
5
+ Static batch-1 inference export of the frozen [fireviewer/dinov2-small-fire-associated-smoke-v2.5](https://huggingface.co/fireviewer/dinov2-small-fire-associated-smoke-v2.5/tree/da027ca273ee693d20d4d4dfae476f5b18c06139) checkpoint. No additional training or quantization. RGB input is stretched to 448×448, converted to NCHW float32, rescaled by 1/255 and normalized with ImageNet mean/std. The exact tensors and output positions are in `runtime_contract.json`; `labels.txt`, `labels.json` and `classes.json` provide the class map.
6
+
7
+ Load `model.tflite` with a LiteRT Interpreter. For Cadryl import `android_model_config.json`, or `studio_pack.json` as a Vision Studio Pack. Contracts contain only supported Cadryl ModelConfig fields. The RF-DETR adapter is deliberately encoded as YOLO BCN to preserve active class index 0. This is a tensor encoding, not a change of detector architecture. A smoke import annotates only high positive compatibility; host code retains low/ambiguous/high triage. The point model applies only to tight flame crops and returns one appearance anchor, with no calibrated point confidence.
8
+
9
+ Training corpus: [fireviewer/v2.5-smoke-from-fire-probability](https://huggingface.co/datasets/fireviewer/v2.5-smoke-from-fire-probability/tree/4f9e52bb294c3e815f22e6b006d8477a6ed33957). Its public licensed subset does not necessarily equal the complete internal training corpus. Checkpoint provenance remains in the original model card.
10
+
11
+ Real CPU LiteRT allocation/invocation and eager-PyTorch numerical comparisons: **passed**, 11 fixed probes/crops. Evidence and predeclared tolerances are in `conversion_validation.json`. Numerical agreement is not a semantic benchmark or an Android-device qualification. GPU delegates, Android latency and Android smoke bicubic preprocessing are unqualified. These exports have no train/restore/save signatures and are inference-only.
12
+
13
+ The 680-image full-cascade benchmark used frozen PyTorch FP32 models on L4. Image alert recall 220/249=88.35%; negative false-alarm rate 49/431=11.37%. Flame localization recall at IoU≥0.5: 231/901=25.64%, tiny recall 178/788=22.59%. Proposal containment: 882/901=97.89%. Do not confuse image alerting with exhaustive precise flame localization. Point-in-matched-box consistency 226/231=97.84% is not independent flame-base accuracy. See the repository cascade benchmark report for families, source limitations and denominators.
14
+
15
+ ## Français
16
+
17
+ Export d'inférence statique, batch 1, du checkpoint figé ci-dessus. Aucune nouvelle phase d'entraînement ni quantification. Entrée RGB redimensionnée par étirement à 448×448, float32 NCHW, normalisation ImageNet. Les classes, les sorties réelles et leurs positions figurent dans les contrats JSON. Cadryl utilise `android_model_config.json` ou le pack `studio_pack.json`. Le détecteur reste RF-DETR ; seul son encodage de sortie compatible Cadryl est BCN YOLO, pour conserver la classe active d'indice 0.
18
+
19
+ La validation numérique CPU LiteRT/PyTorch est **passed** sur 11 entrées figées. Elle ne remplace ni une qualification Android ni une validation scientifique des annotations. Le point est une ancre d'apparence de flamme, pas une origine d'incendie. La fumée fournit une compatibilité binaire calibrée, aucun masque ni point. La cascade complète nécessite l'orchestration proposée ; l'import individuel dans Cadryl n'exécute pas les quatre modèles. Le test historique demeure verrouillé.
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/android_model_config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schemaVersion": 1,
3
+ "task": "classification",
4
+ "adapter": "classification",
5
+ "runtime": "litert_interpreter",
6
+ "inputWidth": 448,
7
+ "inputHeight": 448,
8
+ "inputChannels": 3,
9
+ "inputType": "FLOAT32",
10
+ "inputLayout": "NCHW",
11
+ "isRgb": true,
12
+ "resizeMode": "stretch",
13
+ "mean": 0.0,
14
+ "std": 255.0,
15
+ "channelMean": [
16
+ 123.675,
17
+ 116.28,
18
+ 103.53
19
+ ],
20
+ "channelStd": [
21
+ 58.395,
22
+ 57.120000000000005,
23
+ 57.375
24
+ ],
25
+ "threads": 2,
26
+ "labels": [
27
+ "fire_associated_smoke_compatible"
28
+ ],
29
+ "threshold": 0.8199750333466715,
30
+ "nmsIou": 0.6,
31
+ "maxDetections": 1,
32
+ "topK": 1,
33
+ "outputIndex": 2,
34
+ "coordinates": "normalized",
35
+ "scoreActivation": "none"
36
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/classes.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "id": 0,
4
+ "name": "fire_associated_smoke_compatible"
5
+ }
6
+ ]
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/conversion_validation.json ADDED
@@ -0,0 +1,558 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "passed",
3
+ "samples": 11,
4
+ "source": {
5
+ "repository": "fireviewer/dinov2-small-fire-associated-smoke-v2.5",
6
+ "revision": "da027ca273ee693d20d4d4dfae476f5b18c06139",
7
+ "weights_sha256": "1783452a9aaf92b0ce6b31093a0e33335fa9eea1f5e84b9af64d0466c640026f",
8
+ "selected_epoch": 6,
9
+ "native_checkpoint_epoch": 3,
10
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2"
11
+ },
12
+ "input_panel": [
13
+ {
14
+ "id": "00b0b77bf41d70feac32",
15
+ "group": "flame",
16
+ "source": "DIFD",
17
+ "member": "DIFD/val/images/04599.jpg",
18
+ "image_sha256": "00b0b77bf41d70feac3266ab7889f6758ca4cf97fa810c0ff09e7359e53c6cb6",
19
+ "crop_xyxy": null,
20
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
21
+ },
22
+ {
23
+ "id": "0193cbc7ae1300abd66a",
24
+ "group": "flame",
25
+ "source": "DIFD",
26
+ "member": "DIFD/val/images/04713.jpg",
27
+ "image_sha256": "0193cbc7ae1300abd66a3d3948432c51a777b96ad59c6523439c3c23be68ef19",
28
+ "crop_xyxy": null,
29
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
30
+ },
31
+ {
32
+ "id": "0a8b7ba87a42b3eaef49",
33
+ "group": "flame",
34
+ "source": "DIFD",
35
+ "member": "DIFD/val/images/04682.jpg",
36
+ "image_sha256": "0a8b7ba87a42b3eaef494293822d48a88143e9e0b9a39f7681cf239faf700841",
37
+ "crop_xyxy": null,
38
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
39
+ },
40
+ {
41
+ "id": "02468110699725280c32",
42
+ "group": "smoke",
43
+ "source": "SAINetset",
44
+ "member": "SAI/data/train/images/76154.jpg",
45
+ "image_sha256": "02468110699725280c32d50a286d8039b7b65d2151546bbf5a18152b3efdd2f6",
46
+ "crop_xyxy": [
47
+ 1085,
48
+ 633,
49
+ 1246,
50
+ 794
51
+ ],
52
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
53
+ },
54
+ {
55
+ "id": "026a173a7a8ff79c660a",
56
+ "group": "smoke",
57
+ "source": "SAINetset",
58
+ "member": "SAI/data/train/images/181018.jpg",
59
+ "image_sha256": "026a173a7a8ff79c660a5ac816fdaef1ada10acaaae84f40d8cde370a0ef4f06",
60
+ "crop_xyxy": [
61
+ 1077,
62
+ 716,
63
+ 1238,
64
+ 877
65
+ ],
66
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
67
+ },
68
+ {
69
+ "id": "035ba5696c33a51a5c62",
70
+ "group": "smoke",
71
+ "source": "SAINetset",
72
+ "member": "SAI/data/train/images/Generated Image September 30, 2025 - 3_44AM (1).png",
73
+ "image_sha256": "035ba5696c33a51a5c62ccff784101cb8678a541459599bb949ea9909414864d",
74
+ "crop_xyxy": [
75
+ 497,
76
+ 0,
77
+ 957,
78
+ 478
79
+ ],
80
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
81
+ },
82
+ {
83
+ "id": "0008be011f9f78f14f31",
84
+ "group": "negative",
85
+ "source": "SAINetset",
86
+ "member": "SAI/data/val/images/69898.jpg",
87
+ "image_sha256": "0008be011f9f78f14f31f7d7a96c68e71ac2e077e279901029fb642f2c678570",
88
+ "crop_xyxy": null,
89
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
90
+ },
91
+ {
92
+ "id": "0073403dc996adaf660e",
93
+ "group": "negative",
94
+ "source": "SAINetset",
95
+ "member": "SAI/data/train/images/400365.jpg",
96
+ "image_sha256": "0073403dc996adaf660eabcc6df146c102a024ecca4bf93ff2eb784c23f6afe3",
97
+ "crop_xyxy": null,
98
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
99
+ },
100
+ {
101
+ "id": "00909292c9b57b4f9d69",
102
+ "group": "negative",
103
+ "source": "SAINetset",
104
+ "member": "SAI/data/val/images/400428.jpg",
105
+ "image_sha256": "00909292c9b57b4f9d69cc402a6cf00c7c2f0a5382c3fefc38ba42842e2236d2",
106
+ "crop_xyxy": null,
107
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
108
+ },
109
+ {
110
+ "probe": "normalized_zero",
111
+ "tensor_sha256": "2808ada0833fc3b4a0ee7c7df7ddf8dfd182eccca458e80fa34d4b96c9bb2c40"
112
+ },
113
+ {
114
+ "probe": "seed42_noise",
115
+ "tensor_sha256": "a00e93b7302f9750967960ca48bd62da4c58448c88e8b72f83e16f94c4841251"
116
+ }
117
+ ],
118
+ "tolerances": {
119
+ "boxes": {
120
+ "atol": 0.001,
121
+ "rtol": 0.001
122
+ },
123
+ "logits": {
124
+ "atol": 0.01,
125
+ "rtol": 0.001
126
+ },
127
+ "cadryl_detections": {
128
+ "atol": 0.002,
129
+ "rtol": 0.001
130
+ },
131
+ "heatmap_logits": {
132
+ "atol": 0.01,
133
+ "rtol": 0.001
134
+ },
135
+ "point_normalized": {
136
+ "atol": 0.005,
137
+ "rtol": 0.001
138
+ },
139
+ "calibrated_probabilities": {
140
+ "atol": 0.002,
141
+ "rtol": 0.001
142
+ },
143
+ "positive_probability": {
144
+ "atol": 0.002,
145
+ "rtol": 0.001
146
+ },
147
+ "raw_logit": {
148
+ "atol": 0.01,
149
+ "rtol": 0.001
150
+ }
151
+ },
152
+ "checks": [
153
+ {
154
+ "sample": 0,
155
+ "output": "raw_logit",
156
+ "pass_": true,
157
+ "max_abs": 3.814697265625e-06,
158
+ "mean_abs": 3.814697265625e-06,
159
+ "atol": 0.01,
160
+ "rtol": 0.001
161
+ },
162
+ {
163
+ "sample": 0,
164
+ "output": "calibrated_probabilities",
165
+ "pass_": true,
166
+ "max_abs": 5.960464477539063e-08,
167
+ "mean_abs": 5.960464477539063e-08,
168
+ "atol": 0.002,
169
+ "rtol": 0.001
170
+ },
171
+ {
172
+ "sample": 0,
173
+ "output": "positive_probability",
174
+ "pass_": true,
175
+ "max_abs": 5.960464477539063e-08,
176
+ "mean_abs": 5.960464477539063e-08,
177
+ "atol": 0.002,
178
+ "rtol": 0.001
179
+ },
180
+ {
181
+ "sample": 1,
182
+ "output": "raw_logit",
183
+ "pass_": true,
184
+ "max_abs": 1.1920928955078125e-05,
185
+ "mean_abs": 1.1920928955078125e-05,
186
+ "atol": 0.01,
187
+ "rtol": 0.001
188
+ },
189
+ {
190
+ "sample": 1,
191
+ "output": "calibrated_probabilities",
192
+ "pass_": true,
193
+ "max_abs": 2.384185791015625e-07,
194
+ "mean_abs": 2.384185791015625e-07,
195
+ "atol": 0.002,
196
+ "rtol": 0.001
197
+ },
198
+ {
199
+ "sample": 1,
200
+ "output": "positive_probability",
201
+ "pass_": true,
202
+ "max_abs": 2.384185791015625e-07,
203
+ "mean_abs": 2.384185791015625e-07,
204
+ "atol": 0.002,
205
+ "rtol": 0.001
206
+ },
207
+ {
208
+ "sample": 2,
209
+ "output": "raw_logit",
210
+ "pass_": true,
211
+ "max_abs": 1.2159347534179688e-05,
212
+ "mean_abs": 1.2159347534179688e-05,
213
+ "atol": 0.01,
214
+ "rtol": 0.001
215
+ },
216
+ {
217
+ "sample": 2,
218
+ "output": "calibrated_probabilities",
219
+ "pass_": true,
220
+ "max_abs": 1.0132789611816406e-06,
221
+ "mean_abs": 1.0132789611816406e-06,
222
+ "atol": 0.002,
223
+ "rtol": 0.001
224
+ },
225
+ {
226
+ "sample": 2,
227
+ "output": "positive_probability",
228
+ "pass_": true,
229
+ "max_abs": 1.0132789611816406e-06,
230
+ "mean_abs": 1.0132789611816406e-06,
231
+ "atol": 0.002,
232
+ "rtol": 0.001
233
+ },
234
+ {
235
+ "sample": 3,
236
+ "output": "raw_logit",
237
+ "pass_": true,
238
+ "max_abs": 1.3589859008789062e-05,
239
+ "mean_abs": 1.3589859008789062e-05,
240
+ "atol": 0.01,
241
+ "rtol": 0.001
242
+ },
243
+ {
244
+ "sample": 3,
245
+ "output": "calibrated_probabilities",
246
+ "pass_": true,
247
+ "max_abs": 1.0728836059570312e-06,
248
+ "mean_abs": 1.0728836059570312e-06,
249
+ "atol": 0.002,
250
+ "rtol": 0.001
251
+ },
252
+ {
253
+ "sample": 3,
254
+ "output": "positive_probability",
255
+ "pass_": true,
256
+ "max_abs": 1.0728836059570312e-06,
257
+ "mean_abs": 1.0728836059570312e-06,
258
+ "atol": 0.002,
259
+ "rtol": 0.001
260
+ },
261
+ {
262
+ "sample": 4,
263
+ "output": "raw_logit",
264
+ "pass_": true,
265
+ "max_abs": 7.62939453125e-06,
266
+ "mean_abs": 7.62939453125e-06,
267
+ "atol": 0.01,
268
+ "rtol": 0.001
269
+ },
270
+ {
271
+ "sample": 4,
272
+ "output": "calibrated_probabilities",
273
+ "pass_": true,
274
+ "max_abs": 2.384185791015625e-07,
275
+ "mean_abs": 2.384185791015625e-07,
276
+ "atol": 0.002,
277
+ "rtol": 0.001
278
+ },
279
+ {
280
+ "sample": 4,
281
+ "output": "positive_probability",
282
+ "pass_": true,
283
+ "max_abs": 2.384185791015625e-07,
284
+ "mean_abs": 2.384185791015625e-07,
285
+ "atol": 0.002,
286
+ "rtol": 0.001
287
+ },
288
+ {
289
+ "sample": 5,
290
+ "output": "raw_logit",
291
+ "pass_": true,
292
+ "max_abs": 1.049041748046875e-05,
293
+ "mean_abs": 1.049041748046875e-05,
294
+ "atol": 0.01,
295
+ "rtol": 0.001
296
+ },
297
+ {
298
+ "sample": 5,
299
+ "output": "calibrated_probabilities",
300
+ "pass_": true,
301
+ "max_abs": 1.1920928955078125e-07,
302
+ "mean_abs": 1.1920928955078125e-07,
303
+ "atol": 0.002,
304
+ "rtol": 0.001
305
+ },
306
+ {
307
+ "sample": 5,
308
+ "output": "positive_probability",
309
+ "pass_": true,
310
+ "max_abs": 1.1920928955078125e-07,
311
+ "mean_abs": 1.1920928955078125e-07,
312
+ "atol": 0.002,
313
+ "rtol": 0.001
314
+ },
315
+ {
316
+ "sample": 6,
317
+ "output": "raw_logit",
318
+ "pass_": true,
319
+ "max_abs": 1.9073486328125e-06,
320
+ "mean_abs": 1.9073486328125e-06,
321
+ "atol": 0.01,
322
+ "rtol": 0.001
323
+ },
324
+ {
325
+ "sample": 6,
326
+ "output": "calibrated_probabilities",
327
+ "pass_": true,
328
+ "max_abs": 1.7881393432617188e-07,
329
+ "mean_abs": 1.7881393432617188e-07,
330
+ "atol": 0.002,
331
+ "rtol": 0.001
332
+ },
333
+ {
334
+ "sample": 6,
335
+ "output": "positive_probability",
336
+ "pass_": true,
337
+ "max_abs": 1.7881393432617188e-07,
338
+ "mean_abs": 1.7881393432617188e-07,
339
+ "atol": 0.002,
340
+ "rtol": 0.001
341
+ },
342
+ {
343
+ "sample": 7,
344
+ "output": "raw_logit",
345
+ "pass_": true,
346
+ "max_abs": 2.244114875793457e-05,
347
+ "mean_abs": 2.244114875793457e-05,
348
+ "atol": 0.01,
349
+ "rtol": 0.001
350
+ },
351
+ {
352
+ "sample": 7,
353
+ "output": "calibrated_probabilities",
354
+ "pass_": true,
355
+ "max_abs": 4.887580871582031e-06,
356
+ "mean_abs": 4.872679710388184e-06,
357
+ "atol": 0.002,
358
+ "rtol": 0.001
359
+ },
360
+ {
361
+ "sample": 7,
362
+ "output": "positive_probability",
363
+ "pass_": true,
364
+ "max_abs": 4.857778549194336e-06,
365
+ "mean_abs": 4.857778549194336e-06,
366
+ "atol": 0.002,
367
+ "rtol": 0.001
368
+ },
369
+ {
370
+ "sample": 8,
371
+ "output": "raw_logit",
372
+ "pass_": true,
373
+ "max_abs": 2.8312206268310547e-06,
374
+ "mean_abs": 2.8312206268310547e-06,
375
+ "atol": 0.01,
376
+ "rtol": 0.001
377
+ },
378
+ {
379
+ "sample": 8,
380
+ "output": "calibrated_probabilities",
381
+ "pass_": true,
382
+ "max_abs": 5.960464477539062e-07,
383
+ "mean_abs": 5.960464477539062e-07,
384
+ "atol": 0.002,
385
+ "rtol": 0.001
386
+ },
387
+ {
388
+ "sample": 8,
389
+ "output": "positive_probability",
390
+ "pass_": true,
391
+ "max_abs": 5.960464477539062e-07,
392
+ "mean_abs": 5.960464477539062e-07,
393
+ "atol": 0.002,
394
+ "rtol": 0.001
395
+ },
396
+ {
397
+ "sample": 9,
398
+ "output": "raw_logit",
399
+ "pass_": true,
400
+ "max_abs": 2.86102294921875e-06,
401
+ "mean_abs": 2.86102294921875e-06,
402
+ "atol": 0.01,
403
+ "rtol": 0.001
404
+ },
405
+ {
406
+ "sample": 9,
407
+ "output": "calibrated_probabilities",
408
+ "pass_": true,
409
+ "max_abs": 3.725290298461914e-07,
410
+ "mean_abs": 3.650784492492676e-07,
411
+ "atol": 0.002,
412
+ "rtol": 0.001
413
+ },
414
+ {
415
+ "sample": 9,
416
+ "output": "positive_probability",
417
+ "pass_": true,
418
+ "max_abs": 3.725290298461914e-07,
419
+ "mean_abs": 3.725290298461914e-07,
420
+ "atol": 0.002,
421
+ "rtol": 0.001
422
+ },
423
+ {
424
+ "sample": 10,
425
+ "output": "raw_logit",
426
+ "pass_": true,
427
+ "max_abs": 1.9073486328125e-06,
428
+ "mean_abs": 1.9073486328125e-06,
429
+ "atol": 0.01,
430
+ "rtol": 0.001
431
+ },
432
+ {
433
+ "sample": 10,
434
+ "output": "calibrated_probabilities",
435
+ "pass_": true,
436
+ "max_abs": 2.384185791015625e-07,
437
+ "mean_abs": 2.3096799850463867e-07,
438
+ "atol": 0.002,
439
+ "rtol": 0.001
440
+ },
441
+ {
442
+ "sample": 10,
443
+ "output": "positive_probability",
444
+ "pass_": true,
445
+ "max_abs": 2.2351741790771484e-07,
446
+ "mean_abs": 2.2351741790771484e-07,
447
+ "atol": 0.002,
448
+ "rtol": 0.001
449
+ }
450
+ ],
451
+ "preparation_checks": [
452
+ {
453
+ "sample": 0,
454
+ "output": 0,
455
+ "pass_": true,
456
+ "max_abs": 0.0
457
+ },
458
+ {
459
+ "sample": 1,
460
+ "output": 0,
461
+ "pass_": true,
462
+ "max_abs": 0.0
463
+ },
464
+ {
465
+ "sample": 2,
466
+ "output": 0,
467
+ "pass_": true,
468
+ "max_abs": 0.0
469
+ },
470
+ {
471
+ "sample": 3,
472
+ "output": 0,
473
+ "pass_": true,
474
+ "max_abs": 0.0
475
+ },
476
+ {
477
+ "sample": 4,
478
+ "output": 0,
479
+ "pass_": true,
480
+ "max_abs": 0.0
481
+ },
482
+ {
483
+ "sample": 5,
484
+ "output": 0,
485
+ "pass_": true,
486
+ "max_abs": 0.0
487
+ },
488
+ {
489
+ "sample": 6,
490
+ "output": 0,
491
+ "pass_": true,
492
+ "max_abs": 0.0
493
+ },
494
+ {
495
+ "sample": 7,
496
+ "output": 0,
497
+ "pass_": true,
498
+ "max_abs": 0.0
499
+ },
500
+ {
501
+ "sample": 8,
502
+ "output": 0,
503
+ "pass_": true,
504
+ "max_abs": 0.0
505
+ },
506
+ {
507
+ "sample": 9,
508
+ "output": 0,
509
+ "pass_": true,
510
+ "max_abs": 0.0
511
+ },
512
+ {
513
+ "sample": 10,
514
+ "output": 0,
515
+ "pass_": true,
516
+ "max_abs": 0.0
517
+ }
518
+ ],
519
+ "interpreter": "ai_edge_litert CPU",
520
+ "threads": 4,
521
+ "precision": "FP32",
522
+ "model_sha256": "7c4fbcfad3c8386d6301a5fa8ad773a964870f5457df621167dd68c58b8725ae",
523
+ "model_bytes": 87909264,
524
+ "cpu_latency_seconds": {
525
+ "median": 0.2963391140001477,
526
+ "p95": 0.4316823694999812,
527
+ "samples": 11,
528
+ "warmup_excluded": false,
529
+ "not_android": true
530
+ },
531
+ "versions": {
532
+ "torch": "2.11.0+cpu",
533
+ "rfdetr": "1.11.0",
534
+ "transformers": "5.18.0",
535
+ "litert-torch": "0.9.4",
536
+ "ai-edge-litert": "2.2.0"
537
+ },
538
+ "output_positions": {
539
+ "raw_logit": 0,
540
+ "calibrated_probabilities": 1,
541
+ "positive_probability": 2
542
+ },
543
+ "signatures": {
544
+ "serving_default": {
545
+ "inputs": [
546
+ "args_0"
547
+ ],
548
+ "outputs": [
549
+ "output_0",
550
+ "output_1",
551
+ "output_2"
552
+ ]
553
+ }
554
+ },
555
+ "android_device_tested": false,
556
+ "test_used": false,
557
+ "no_training": true
558
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/labels.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id2label": {
3
+ "0": "fire_associated_smoke_compatible"
4
+ },
5
+ "label2id": {
6
+ "fire_associated_smoke_compatible": 0
7
+ }
8
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/labels.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fire_associated_smoke_compatible
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/manifest.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.litert.package/1",
3
+ "model_id": "fireviewer_dinov2_small_fire_associated_smoke_v25_fp32",
4
+ "precision": "FP32",
5
+ "inference_only": true,
6
+ "validated": true,
7
+ "files": {
8
+ "model.tflite": {
9
+ "sha256": "7c4fbcfad3c8386d6301a5fa8ad773a964870f5457df621167dd68c58b8725ae",
10
+ "bytes": 87909264
11
+ },
12
+ "android_model_config.json": {
13
+ "sha256": "cd652114a0f37c455af6b5b1a7f44e4c2a9638f79b9e1256805a485cc0ed206f",
14
+ "bytes": 681
15
+ },
16
+ "studio_pack.json": {
17
+ "sha256": "a5cc4d660c27114eac6072100c284b87d70360f4595108a2eff826621ad8fdb2",
18
+ "bytes": 982
19
+ },
20
+ "labels.json": {
21
+ "sha256": "74077e7ccd4cd8552ad7c2f84323ffef1a6c66e368d3940eb09205203b8ec7a4",
22
+ "bytes": 131
23
+ },
24
+ "labels.txt": {
25
+ "sha256": "b821a24477ad543a50bca95c1ab9144ecf6e3411b36bd3c5157f03a5d244773e",
26
+ "bytes": 33
27
+ },
28
+ "classes.json": {
29
+ "sha256": "9d9ddd457c3d7cd351ae8808c377199467f452c3e0d09dde27b6b8954fc63648",
30
+ "bytes": 72
31
+ },
32
+ "preprocessor_config.json": {
33
+ "sha256": "c9435dea499f918f2f8f003d30549f5330b33067c2e8167e99bf829ff5b589e1",
34
+ "bytes": 447
35
+ },
36
+ "runtime_contract.json": {
37
+ "sha256": "4d3fe9355821b522490685426b84466d9aa4a4cbdb3979691442d12c4e2cbec6",
38
+ "bytes": 3985
39
+ },
40
+ "source.json": {
41
+ "sha256": "42f5ea1cb38d96338f39145627a22d2957385f710f810f7ef433d7d0ab3580eb",
42
+ "bytes": 1423
43
+ },
44
+ "conversion_validation.json": {
45
+ "sha256": "84e621dd1e76708f55ba9efba9cfc693c15d1b6ead62c24a917baf186c5b76e1",
46
+ "bytes": 13839
47
+ },
48
+ "README.md": {
49
+ "sha256": "869c0bdfb05febc468c0152c569733f4befbf4931efed8c768ca5db036d76d0b",
50
+ "bytes": 3538
51
+ },
52
+ "LICENSE": {
53
+ "sha256": "4b63d54afaae8f96b7b3baeb94d902bb50e4f17e3d0fc6cb450bef56cb769616",
54
+ "bytes": 11562
55
+ },
56
+ "NOTICE": {
57
+ "sha256": "dc33b852578b43f9e9e8d55af5ae3550c4fdcd658eb35d01b60153ef7277177f",
58
+ "bytes": 419
59
+ },
60
+ "CITATION.cff": {
61
+ "sha256": "0f2d2fd82e960f6032be2b097b611a9709061c051a193215e8fae86ab88dd5cb",
62
+ "bytes": 364
63
+ },
64
+ "probability_labels.json": {
65
+ "sha256": "a133b98f0750f39b21d1a5a5b65ad665a0d1632773e3a7c5362b3b17e0a22b8e",
66
+ "bytes": 93
67
+ }
68
+ }
69
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7c4fbcfad3c8386d6301a5fa8ad773a964870f5457df621167dd68c58b8725ae
3
+ size 87909264
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "color_space": "RGB",
3
+ "input_layout": "NCHW",
4
+ "dtype": "float32",
5
+ "width": 448,
6
+ "height": 448,
7
+ "batch_size": 1,
8
+ "resize_mode": "stretch",
9
+ "interpolation": "PIL_BICUBIC",
10
+ "rescale_factor": 0.00392156862745098,
11
+ "image_mean": [
12
+ 0.485,
13
+ 0.456,
14
+ 0.406
15
+ ],
16
+ "image_std": [
17
+ 0.229,
18
+ 0.224,
19
+ 0.225
20
+ ],
21
+ "cadryl_interpolation": "Android bilinear bitmap scaling; smoke bicubic parity not qualified on Android"
22
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/probability_labels.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "0": "not_fire_associated_smoke_compatible",
3
+ "1": "fire_associated_smoke_compatible"
4
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/runtime_contract.json ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.litert.inference/1",
3
+ "model_id": "fireviewer_dinov2_small_fire_associated_smoke_v25_fp32",
4
+ "semantic": "fire_associated_smoke_compatible",
5
+ "task": "classification",
6
+ "artifact": "model.tflite",
7
+ "format": "TFLite FlatBuffer / LiteRT",
8
+ "precision": "FP32",
9
+ "source": {
10
+ "repository": "fireviewer/dinov2-small-fire-associated-smoke-v2.5",
11
+ "revision": "da027ca273ee693d20d4d4dfae476f5b18c06139",
12
+ "weights_sha256": "1783452a9aaf92b0ce6b31093a0e33335fa9eea1f5e84b9af64d0466c640026f",
13
+ "selected_epoch": 6,
14
+ "native_checkpoint_epoch": 3,
15
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2"
16
+ },
17
+ "dataset": {
18
+ "repository": "fireviewer/v2.5-smoke-from-fire-probability",
19
+ "revision": "4f9e52bb294c3e815f22e6b006d8477a6ed33957"
20
+ },
21
+ "inputs": [
22
+ {
23
+ "position": 0,
24
+ "index": 0,
25
+ "name": "serving_default_args_0",
26
+ "shape": [
27
+ 1,
28
+ 3,
29
+ 448,
30
+ 448
31
+ ],
32
+ "dtype": "float32",
33
+ "shape_signature": [
34
+ 1,
35
+ 3,
36
+ 448,
37
+ 448
38
+ ]
39
+ }
40
+ ],
41
+ "outputs": [
42
+ {
43
+ "position": 0,
44
+ "index": 868,
45
+ "name": "serving_default_output_0_output",
46
+ "shape": [
47
+ 1,
48
+ 1
49
+ ],
50
+ "dtype": "float32",
51
+ "shape_signature": [
52
+ 1,
53
+ 1
54
+ ],
55
+ "semantic": "raw_logit",
56
+ "class_map": "labels.json",
57
+ "activation": "temperature-scaled sigmoid"
58
+ },
59
+ {
60
+ "position": 1,
61
+ "index": 872,
62
+ "name": "serving_default_output_1_output",
63
+ "shape": [
64
+ 1,
65
+ 2
66
+ ],
67
+ "dtype": "float32",
68
+ "shape_signature": [
69
+ 1,
70
+ 2
71
+ ],
72
+ "semantic": "calibrated_probabilities",
73
+ "class_axis": 1,
74
+ "class_map": "probability_labels.json",
75
+ "activation": "none"
76
+ },
77
+ {
78
+ "position": 2,
79
+ "index": 870,
80
+ "name": "serving_default_output_2_output",
81
+ "shape": [
82
+ 1,
83
+ 1
84
+ ],
85
+ "dtype": "float32",
86
+ "shape_signature": [
87
+ 1,
88
+ 1
89
+ ],
90
+ "semantic": "positive_probability",
91
+ "class_map": "labels.json",
92
+ "activation": "none"
93
+ }
94
+ ],
95
+ "logical_output_positions": {
96
+ "raw_logit": 0,
97
+ "calibrated_probabilities": 1,
98
+ "positive_probability": 2
99
+ },
100
+ "preprocessing": "preprocessor_config.json",
101
+ "class_map": "labels.json",
102
+ "coordinates": "normalized top-left origin, x right, y down",
103
+ "cadryl_model_config": "android_model_config.json",
104
+ "cadryl_studio_pack": "studio_pack.json",
105
+ "pipeline": {
106
+ "role": "smoke",
107
+ "input_domain": "probable_fire ROI without local confirmed flame",
108
+ "context_fraction": 0.45,
109
+ "min_crop_side": 160,
110
+ "point_decoder": null,
111
+ "global_visible_nms_iou": 0.6,
112
+ "proposal_nms_iou": 0.75,
113
+ "proposal_limit": 6,
114
+ "note": "Cadryl runs one selected model; cascade orchestration requires the supplied runner. Visible Cadryl applies per-crop NMS; reference cascade applies NMS after whole-image reprojection.",
115
+ "temperature": 1.1490650177001953,
116
+ "low_threshold": 0.30160276398937463,
117
+ "high_threshold": 0.8199750333466715,
118
+ "ambiguous_interval": [
119
+ 0.30160276398937463,
120
+ 0.8199750333466715
121
+ ],
122
+ "cadryl_annotation": "only high positive compatibility; negative and ambiguous outcomes require host triage"
123
+ },
124
+ "limits": {
125
+ "inference_only": true,
126
+ "training_signatures": false,
127
+ "test_evaluated": false,
128
+ "android_device_tested": false,
129
+ "gpu_delegate_tested": false,
130
+ "point": "flame_base_anchor appearance convention, not ignition or source geography",
131
+ "smoke": "binary visual compatibility, no smoke masks, core points, or source position",
132
+ "probabilities_calibrated": "smoke calibration retained; detector alert thresholds not calibrated",
133
+ "numerical_parity_not_semantic_accuracy": true
134
+ },
135
+ "validation": "conversion_validation.json",
136
+ "licenses": [
137
+ "LICENSE",
138
+ "NOTICE"
139
+ ]
140
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/source.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": "fireviewer/dinov2-small-fire-associated-smoke-v2.5",
3
+ "revision": "da027ca273ee693d20d4d4dfae476f5b18c06139",
4
+ "weights_sha256": "1783452a9aaf92b0ce6b31093a0e33335fa9eea1f5e84b9af64d0466c640026f",
5
+ "selected_epoch": 6,
6
+ "native_checkpoint_epoch": 3,
7
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2",
8
+ "dataset": {
9
+ "repository": "fireviewer/v2.5-smoke-from-fire-probability",
10
+ "revision": "4f9e52bb294c3e815f22e6b006d8477a6ed33957"
11
+ },
12
+ "config": {
13
+ "schema": "fireviewer.model.inference.v1",
14
+ "model_kind": "smoke_classifier",
15
+ "semantic": "fire_associated_smoke_compatible",
16
+ "source_checkpoint_sha256": "d7a0c73de8203fdecce828256555ca138d4fa02d46e7f532483109af8acd0eb2",
17
+ "selected_epoch": 3,
18
+ "weights": "model.safetensors",
19
+ "normalization": {
20
+ "mean": [
21
+ 0.485,
22
+ 0.456,
23
+ 0.406
24
+ ],
25
+ "std": [
26
+ 0.229,
27
+ 0.224,
28
+ 0.225
29
+ ]
30
+ },
31
+ "test_locked": true,
32
+ "resolution": 448,
33
+ "dino_source_revision": "7764ea0f912e53c92e82eb78a2a1631e92725fc8",
34
+ "context_fraction": 0.45,
35
+ "min_crop_side": 160,
36
+ "temperature": 1.1490650177001953,
37
+ "low_threshold": 0.30160276398937463,
38
+ "high_threshold": 0.8199750333466715,
39
+ "label_semantics": {
40
+ "1": "fire_associated_smoke_compatible",
41
+ "0": "non_fire_or_non_smoke_like_region"
42
+ }
43
+ }
44
+ }
models/fireviewer_dinov2_small_fire_associated_smoke_v25_fp32/studio_pack.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "vision-studio-pack/1",
3
+ "name": "FireViewer v2.5 fire_associated_smoke_compatible",
4
+ "classes": [
5
+ "fire_associated_smoke_compatible"
6
+ ],
7
+ "tasks": [
8
+ "CLASSIFICATION"
9
+ ],
10
+ "batchSize": 100,
11
+ "model": {
12
+ "schemaVersion": 1,
13
+ "task": "classification",
14
+ "adapter": "classification",
15
+ "runtime": "litert_interpreter",
16
+ "inputWidth": 448,
17
+ "inputHeight": 448,
18
+ "inputChannels": 3,
19
+ "inputType": "FLOAT32",
20
+ "inputLayout": "NCHW",
21
+ "isRgb": true,
22
+ "resizeMode": "stretch",
23
+ "mean": 0.0,
24
+ "std": 255.0,
25
+ "channelMean": [
26
+ 123.675,
27
+ 116.28,
28
+ 103.53
29
+ ],
30
+ "channelStd": [
31
+ 58.395,
32
+ 57.120000000000005,
33
+ 57.375
34
+ ],
35
+ "threads": 2,
36
+ "labels": [
37
+ "fire_associated_smoke_compatible"
38
+ ],
39
+ "threshold": 0.8199750333466715,
40
+ "nmsIou": 0.6,
41
+ "maxDetections": 1,
42
+ "topK": 1,
43
+ "outputIndex": 2,
44
+ "coordinates": "normalized",
45
+ "scoreActivation": "none"
46
+ }
47
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/CITATION.cff ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "Please cite this research checkpoint and its upstream architecture."
3
+ title: "FireViewer v2.5: dinov2-small-visible-flame-monopoint-v2.5"
4
+ authors:
5
+ - name: "FireViewer contributors"
6
+ version: "2.5"
7
+ date-released: "2026-10-06"
8
+ url: "https://huggingface.co/fireviewer/dinov2-small-visible-flame-monopoint-v2.5"
9
+ license: "Apache-2.0"
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/LICENSE ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/NOTICE ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FireViewer v2.5 research release, 2026.
2
+ RF-DETR: Roboflow contributors, Apache-2.0, https://github.com/roboflow/rf-detr
3
+ DINOv2: Meta Platforms, Inc. and affiliates, Apache-2.0, https://github.com/facebookresearch/dinov2
4
+ Transformers: Hugging Face contributors, Apache-2.0, https://github.com/huggingface/transformers
5
+ Training images retain their source-specific rights. This model release does not relicense them.
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/README.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FireViewer v2.5 — flame_base_anchor — LiteRT FP32
2
+
3
+ ## English
4
+
5
+ Static batch-1 inference export of the frozen [fireviewer/dinov2-small-visible-flame-monopoint-v2.5](https://huggingface.co/fireviewer/dinov2-small-visible-flame-monopoint-v2.5/tree/a0a0f088c51ad9f7de966a89da958638bd4dcfbf) checkpoint. No additional training or quantization. RGB input is stretched to 448×448, converted to NCHW float32, rescaled by 1/255 and normalized with ImageNet mean/std. The exact tensors and output positions are in `runtime_contract.json`; `labels.txt`, `labels.json` and `classes.json` provide the class map.
6
+
7
+ Load `model.tflite` with a LiteRT Interpreter. For Cadryl import `android_model_config.json`, or `studio_pack.json` as a Vision Studio Pack. Contracts contain only supported Cadryl ModelConfig fields. The RF-DETR adapter is deliberately encoded as YOLO BCN to preserve active class index 0. This is a tensor encoding, not a change of detector architecture. A smoke import annotates only high positive compatibility; host code retains low/ambiguous/high triage. The point model applies only to tight flame crops and returns one appearance anchor, with no calibrated point confidence.
8
+
9
+ Training corpus: [fireviewer/v2.5-visible-flame-crop-monopoint](https://huggingface.co/datasets/fireviewer/v2.5-visible-flame-crop-monopoint/tree/4f22e3fd44c77e01dade2020cc9450ced995552e). Its public licensed subset does not necessarily equal the complete internal training corpus. Checkpoint provenance remains in the original model card.
10
+
11
+ Real CPU LiteRT allocation/invocation and eager-PyTorch numerical comparisons: **passed**, 5 fixed probes/crops. Evidence and predeclared tolerances are in `conversion_validation.json`. Numerical agreement is not a semantic benchmark or an Android-device qualification. GPU delegates, Android latency and Android smoke bicubic preprocessing are unqualified. These exports have no train/restore/save signatures and are inference-only.
12
+
13
+ The 680-image full-cascade benchmark used frozen PyTorch FP32 models on L4. Image alert recall 220/249=88.35%; negative false-alarm rate 49/431=11.37%. Flame localization recall at IoU≥0.5: 231/901=25.64%, tiny recall 178/788=22.59%. Proposal containment: 882/901=97.89%. Do not confuse image alerting with exhaustive precise flame localization. Point-in-matched-box consistency 226/231=97.84% is not independent flame-base accuracy. See the repository cascade benchmark report for families, source limitations and denominators.
14
+
15
+ ## Français
16
+
17
+ Export d'inférence statique, batch 1, du checkpoint figé ci-dessus. Aucune nouvelle phase d'entraînement ni quantification. Entrée RGB redimensionnée par étirement à 448×448, float32 NCHW, normalisation ImageNet. Les classes, les sorties réelles et leurs positions figurent dans les contrats JSON. Cadryl utilise `android_model_config.json` ou le pack `studio_pack.json`. Le détecteur reste RF-DETR ; seul son encodage de sortie compatible Cadryl est BCN YOLO, pour conserver la classe active d'indice 0.
18
+
19
+ La validation numérique CPU LiteRT/PyTorch est **passed** sur 5 entrées figées. Elle ne remplace ni une qualification Android ni une validation scientifique des annotations. Le point est une ancre d'apparence de flamme, pas une origine d'incendie. La fumée fournit une compatibilité binaire calibrée, aucun masque ni point. La cascade complète nécessite l'orchestration proposée ; l'import individuel dans Cadryl n'exécute pas les quatre modèles. Le test historique demeure verrouillé.
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/android_model_config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schemaVersion": 1,
3
+ "task": "pointing",
4
+ "adapter": "points",
5
+ "runtime": "litert_interpreter",
6
+ "inputWidth": 448,
7
+ "inputHeight": 448,
8
+ "inputChannels": 3,
9
+ "inputType": "FLOAT32",
10
+ "inputLayout": "NCHW",
11
+ "isRgb": true,
12
+ "resizeMode": "stretch",
13
+ "mean": 0.0,
14
+ "std": 255.0,
15
+ "channelMean": [
16
+ 123.675,
17
+ 116.28,
18
+ 103.53
19
+ ],
20
+ "channelStd": [
21
+ 58.395,
22
+ 57.120000000000005,
23
+ 57.375
24
+ ],
25
+ "threads": 2,
26
+ "labels": [
27
+ "flame_base_anchor"
28
+ ],
29
+ "threshold": 0.0,
30
+ "nmsIou": 0.6,
31
+ "maxDetections": 1,
32
+ "topK": 1,
33
+ "outputIndex": 1,
34
+ "coordinates": "normalized",
35
+ "scoreActivation": "none"
36
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/classes.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "id": 0,
4
+ "name": "flame_base_anchor"
5
+ }
6
+ ]
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/conversion_validation.json ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "passed",
3
+ "samples": 5,
4
+ "source": {
5
+ "repository": "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
6
+ "revision": "a0a0f088c51ad9f7de966a89da958638bd4dcfbf",
7
+ "weights_sha256": "aeac16f9d7e2b401b0d1cd533681be3f922bfe7271408a4aea22b42273ec2aad",
8
+ "selected_epoch": 6,
9
+ "native_checkpoint_epoch": 6,
10
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d"
11
+ },
12
+ "input_panel": [
13
+ {
14
+ "id": "00b0b77bf41d70feac32",
15
+ "group": "flame",
16
+ "source": "DIFD",
17
+ "member": "DIFD/val/images/04599.jpg",
18
+ "image_sha256": "00b0b77bf41d70feac3266ab7889f6758ca4cf97fa810c0ff09e7359e53c6cb6",
19
+ "crop_xyxy": [
20
+ 1329,
21
+ 876,
22
+ 1344,
23
+ 890
24
+ ],
25
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
26
+ },
27
+ {
28
+ "id": "0193cbc7ae1300abd66a",
29
+ "group": "flame",
30
+ "source": "DIFD",
31
+ "member": "DIFD/val/images/04713.jpg",
32
+ "image_sha256": "0193cbc7ae1300abd66a3d3948432c51a777b96ad59c6523439c3c23be68ef19",
33
+ "crop_xyxy": [
34
+ 378,
35
+ 797,
36
+ 398,
37
+ 823
38
+ ],
39
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
40
+ },
41
+ {
42
+ "id": "0a8b7ba87a42b3eaef49",
43
+ "group": "flame",
44
+ "source": "DIFD",
45
+ "member": "DIFD/val/images/04682.jpg",
46
+ "image_sha256": "0a8b7ba87a42b3eaef494293822d48a88143e9e0b9a39f7681cf239faf700841",
47
+ "crop_xyxy": [
48
+ 937,
49
+ 623,
50
+ 966,
51
+ 642
52
+ ],
53
+ "crop_selection": "annotation-derived numerical regression only; not a proposals-only benchmark"
54
+ },
55
+ {
56
+ "probe": "normalized_zero",
57
+ "tensor_sha256": "2808ada0833fc3b4a0ee7c7df7ddf8dfd182eccca458e80fa34d4b96c9bb2c40"
58
+ },
59
+ {
60
+ "probe": "seed42_noise",
61
+ "tensor_sha256": "a00e93b7302f9750967960ca48bd62da4c58448c88e8b72f83e16f94c4841251"
62
+ }
63
+ ],
64
+ "tolerances": {
65
+ "boxes": {
66
+ "atol": 0.001,
67
+ "rtol": 0.001
68
+ },
69
+ "logits": {
70
+ "atol": 0.01,
71
+ "rtol": 0.001
72
+ },
73
+ "cadryl_detections": {
74
+ "atol": 0.002,
75
+ "rtol": 0.001
76
+ },
77
+ "heatmap_logits": {
78
+ "atol": 0.01,
79
+ "rtol": 0.001
80
+ },
81
+ "point_normalized": {
82
+ "atol": 0.005,
83
+ "rtol": 0.001
84
+ },
85
+ "calibrated_probabilities": {
86
+ "atol": 0.002,
87
+ "rtol": 0.001
88
+ },
89
+ "positive_probability": {
90
+ "atol": 0.002,
91
+ "rtol": 0.001
92
+ },
93
+ "raw_logit": {
94
+ "atol": 0.01,
95
+ "rtol": 0.001
96
+ }
97
+ },
98
+ "checks": [
99
+ {
100
+ "sample": 0,
101
+ "output": "heatmap_logits",
102
+ "pass_": true,
103
+ "max_abs": 3.0040740966796875e-05,
104
+ "mean_abs": 6.31097918812884e-06,
105
+ "atol": 0.01,
106
+ "rtol": 0.001
107
+ },
108
+ {
109
+ "sample": 0,
110
+ "output": "point_normalized",
111
+ "pass_": true,
112
+ "max_abs": 5.960464477539063e-08,
113
+ "mean_abs": 4.470348358154297e-08,
114
+ "atol": 0.005,
115
+ "rtol": 0.001
116
+ },
117
+ {
118
+ "sample": 1,
119
+ "output": "heatmap_logits",
120
+ "pass_": true,
121
+ "max_abs": 2.5272369384765625e-05,
122
+ "mean_abs": 4.816733053303324e-06,
123
+ "atol": 0.01,
124
+ "rtol": 0.001
125
+ },
126
+ {
127
+ "sample": 1,
128
+ "output": "point_normalized",
129
+ "pass_": true,
130
+ "max_abs": 5.960464477539063e-08,
131
+ "mean_abs": 4.470348358154297e-08,
132
+ "atol": 0.005,
133
+ "rtol": 0.001
134
+ },
135
+ {
136
+ "sample": 2,
137
+ "output": "heatmap_logits",
138
+ "pass_": true,
139
+ "max_abs": 3.266334533691406e-05,
140
+ "mean_abs": 6.5568283389438875e-06,
141
+ "atol": 0.01,
142
+ "rtol": 0.001
143
+ },
144
+ {
145
+ "sample": 2,
146
+ "output": "point_normalized",
147
+ "pass_": true,
148
+ "max_abs": 5.960464477539063e-08,
149
+ "mean_abs": 2.9802322387695312e-08,
150
+ "atol": 0.005,
151
+ "rtol": 0.001
152
+ },
153
+ {
154
+ "sample": 3,
155
+ "output": "heatmap_logits",
156
+ "pass_": true,
157
+ "max_abs": 2.9988586902618408e-05,
158
+ "mean_abs": 4.389980858832132e-06,
159
+ "atol": 0.01,
160
+ "rtol": 0.001
161
+ },
162
+ {
163
+ "sample": 3,
164
+ "output": "point_normalized",
165
+ "pass_": true,
166
+ "max_abs": 5.960464477539063e-08,
167
+ "mean_abs": 4.470348358154297e-08,
168
+ "atol": 0.005,
169
+ "rtol": 0.001
170
+ },
171
+ {
172
+ "sample": 4,
173
+ "output": "heatmap_logits",
174
+ "pass_": true,
175
+ "max_abs": 4.1484832763671875e-05,
176
+ "mean_abs": 6.907012448209571e-06,
177
+ "atol": 0.01,
178
+ "rtol": 0.001
179
+ },
180
+ {
181
+ "sample": 4,
182
+ "output": "point_normalized",
183
+ "pass_": true,
184
+ "max_abs": 0.0,
185
+ "mean_abs": 0.0,
186
+ "atol": 0.005,
187
+ "rtol": 0.001
188
+ }
189
+ ],
190
+ "preparation_checks": [
191
+ {
192
+ "sample": 0,
193
+ "output": 0,
194
+ "pass_": true,
195
+ "max_abs": 0.0
196
+ },
197
+ {
198
+ "sample": 0,
199
+ "output": "original_point_decoder",
200
+ "pass_": true,
201
+ "max_abs": 0.0
202
+ },
203
+ {
204
+ "sample": 1,
205
+ "output": 0,
206
+ "pass_": true,
207
+ "max_abs": 0.0
208
+ },
209
+ {
210
+ "sample": 1,
211
+ "output": "original_point_decoder",
212
+ "pass_": true,
213
+ "max_abs": 0.0
214
+ },
215
+ {
216
+ "sample": 2,
217
+ "output": 0,
218
+ "pass_": true,
219
+ "max_abs": 0.0
220
+ },
221
+ {
222
+ "sample": 2,
223
+ "output": "original_point_decoder",
224
+ "pass_": true,
225
+ "max_abs": 0.0
226
+ },
227
+ {
228
+ "sample": 3,
229
+ "output": 0,
230
+ "pass_": true,
231
+ "max_abs": 0.0
232
+ },
233
+ {
234
+ "sample": 3,
235
+ "output": "original_point_decoder",
236
+ "pass_": true,
237
+ "max_abs": 0.0
238
+ },
239
+ {
240
+ "sample": 4,
241
+ "output": 0,
242
+ "pass_": true,
243
+ "max_abs": 0.0
244
+ },
245
+ {
246
+ "sample": 4,
247
+ "output": "original_point_decoder",
248
+ "pass_": true,
249
+ "max_abs": 0.0
250
+ }
251
+ ],
252
+ "interpreter": "ai_edge_litert CPU",
253
+ "threads": 4,
254
+ "precision": "FP32",
255
+ "model_sha256": "0d596571199fba4f20a211def0fba2ff7f4dd48391dc9c2254dce82c1729f9da",
256
+ "model_bytes": 90165964,
257
+ "cpu_latency_seconds": {
258
+ "median": 0.3609556399999292,
259
+ "p95": 0.519355970199831,
260
+ "samples": 5,
261
+ "warmup_excluded": false,
262
+ "not_android": true
263
+ },
264
+ "versions": {
265
+ "torch": "2.11.0+cpu",
266
+ "rfdetr": "1.11.0",
267
+ "transformers": "5.18.0",
268
+ "litert-torch": "0.9.4",
269
+ "ai-edge-litert": "2.2.0"
270
+ },
271
+ "output_positions": {
272
+ "heatmap_logits": 0,
273
+ "point_normalized": 1
274
+ },
275
+ "signatures": {
276
+ "serving_default": {
277
+ "inputs": [
278
+ "args_0"
279
+ ],
280
+ "outputs": [
281
+ "output_0",
282
+ "output_1"
283
+ ]
284
+ }
285
+ },
286
+ "android_device_tested": false,
287
+ "test_used": false,
288
+ "no_training": true
289
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/labels.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "id2label": {
3
+ "0": "flame_base_anchor"
4
+ },
5
+ "label2id": {
6
+ "flame_base_anchor": 0
7
+ }
8
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/labels.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ flame_base_anchor
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/manifest.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.litert.package/1",
3
+ "model_id": "fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32",
4
+ "precision": "FP32",
5
+ "inference_only": true,
6
+ "validated": true,
7
+ "files": {
8
+ "model.tflite": {
9
+ "sha256": "0d596571199fba4f20a211def0fba2ff7f4dd48391dc9c2254dce82c1729f9da",
10
+ "bytes": 90165964
11
+ },
12
+ "android_model_config.json": {
13
+ "sha256": "c2e3a13c31649720fcaae09512bfcdb8b4f7f096106425732d7e2f456b28c626",
14
+ "bytes": 637
15
+ },
16
+ "studio_pack.json": {
17
+ "sha256": "c07301f3e99a3b70d74bc196c3f6c6e8b4719f955cd27f5a3c1428b3eae23f62",
18
+ "bytes": 902
19
+ },
20
+ "labels.json": {
21
+ "sha256": "4d49719dc41993d520e37a95033f3763720b32eaefdc182bd94d7e3dbe4bdfb9",
22
+ "bytes": 101
23
+ },
24
+ "labels.txt": {
25
+ "sha256": "ae399a021ac25353f67e011d0ccb0ffe17803dde011f53be5b4570d757f4e69e",
26
+ "bytes": 18
27
+ },
28
+ "classes.json": {
29
+ "sha256": "9833f1577ab20e78f0e84935f835314f0bbfaa67a33dad4386a31e020d6ef08f",
30
+ "bytes": 57
31
+ },
32
+ "preprocessor_config.json": {
33
+ "sha256": "db09d69de75c83a5a941bc3d3cdf43f3c539af7e073cb2c47e698f6d9be377d6",
34
+ "bytes": 480
35
+ },
36
+ "runtime_contract.json": {
37
+ "sha256": "9f315684f35fc4fe8ac1619fe9a67aab77d6a8b4cde2b077e72a9d23015ffa31",
38
+ "bytes": 3206
39
+ },
40
+ "source.json": {
41
+ "sha256": "b6d72e5ebadb3dec6927b83543b4b70d317e31a1213bed1145db6a0f0bcc9522",
42
+ "bytes": 1893
43
+ },
44
+ "conversion_validation.json": {
45
+ "sha256": "daec41a38429d9eab12297427a85864f4627c301ea724196957067df65f88040",
46
+ "bytes": 6580
47
+ },
48
+ "README.md": {
49
+ "sha256": "1ca71407363dfd19a997e624a52909eec86d28576fc5e4b435ad305a1f1e32d2",
50
+ "bytes": 3527
51
+ },
52
+ "LICENSE": {
53
+ "sha256": "4b63d54afaae8f96b7b3baeb94d902bb50e4f17e3d0fc6cb450bef56cb769616",
54
+ "bytes": 11562
55
+ },
56
+ "NOTICE": {
57
+ "sha256": "dc33b852578b43f9e9e8d55af5ae3550c4fdcd658eb35d01b60153ef7277177f",
58
+ "bytes": 419
59
+ },
60
+ "CITATION.cff": {
61
+ "sha256": "1c31879eddf991f088705ae5afbf6c116f7e30386f187eec682a84bd2918e8c8",
62
+ "bytes": 368
63
+ }
64
+ }
65
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0d596571199fba4f20a211def0fba2ff7f4dd48391dc9c2254dce82c1729f9da
3
+ size 90165964
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/preprocessor_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "color_space": "RGB",
3
+ "input_layout": "NCHW",
4
+ "dtype": "float32",
5
+ "width": 448,
6
+ "height": 448,
7
+ "batch_size": 1,
8
+ "resize_mode": "stretch",
9
+ "interpolation": "PIL_BILINEAR",
10
+ "rescale_factor": 0.00392156862745098,
11
+ "image_mean": [
12
+ 0.485,
13
+ 0.456,
14
+ 0.406
15
+ ],
16
+ "image_std": [
17
+ 0.229,
18
+ 0.224,
19
+ 0.225
20
+ ],
21
+ "cadryl_interpolation": "Android bilinear bitmap scaling; float-resize detector and smoke bicubic pixel parity not qualified on Android"
22
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/runtime_contract.json ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "fireviewer.litert.inference/1",
3
+ "model_id": "fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32",
4
+ "semantic": "flame_base_anchor",
5
+ "task": "pointing",
6
+ "artifact": "model.tflite",
7
+ "format": "TFLite FlatBuffer / LiteRT",
8
+ "precision": "FP32",
9
+ "source": {
10
+ "repository": "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
11
+ "revision": "a0a0f088c51ad9f7de966a89da958638bd4dcfbf",
12
+ "weights_sha256": "aeac16f9d7e2b401b0d1cd533681be3f922bfe7271408a4aea22b42273ec2aad",
13
+ "selected_epoch": 6,
14
+ "native_checkpoint_epoch": 6,
15
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d"
16
+ },
17
+ "dataset": {
18
+ "repository": "fireviewer/v2.5-visible-flame-crop-monopoint",
19
+ "revision": "4f22e3fd44c77e01dade2020cc9450ced995552e"
20
+ },
21
+ "inputs": [
22
+ {
23
+ "position": 0,
24
+ "index": 0,
25
+ "name": "serving_default_args_0",
26
+ "shape": [
27
+ 1,
28
+ 3,
29
+ 448,
30
+ 448
31
+ ],
32
+ "dtype": "float32",
33
+ "shape_signature": [
34
+ 1,
35
+ 3,
36
+ 448,
37
+ 448
38
+ ]
39
+ }
40
+ ],
41
+ "outputs": [
42
+ {
43
+ "position": 0,
44
+ "index": 947,
45
+ "name": "serving_default_output_0_output",
46
+ "shape": [
47
+ 1,
48
+ 1,
49
+ 128,
50
+ 128
51
+ ],
52
+ "dtype": "float32",
53
+ "shape_signature": [
54
+ 1,
55
+ 1,
56
+ 128,
57
+ 128
58
+ ],
59
+ "semantic": "heatmap_logits"
60
+ },
61
+ {
62
+ "position": 1,
63
+ "index": 990,
64
+ "name": "serving_default_output_1_output",
65
+ "shape": [
66
+ 1,
67
+ 1,
68
+ 2
69
+ ],
70
+ "dtype": "float32",
71
+ "shape_signature": [
72
+ 1,
73
+ 1,
74
+ 2
75
+ ],
76
+ "semantic": "point_normalized"
77
+ }
78
+ ],
79
+ "logical_output_positions": {
80
+ "heatmap_logits": 0,
81
+ "point_normalized": 1
82
+ },
83
+ "preprocessing": "preprocessor_config.json",
84
+ "class_map": "labels.json",
85
+ "coordinates": "normalized top-left origin, x right, y down",
86
+ "cadryl_model_config": "android_model_config.json",
87
+ "cadryl_studio_pack": "studio_pack.json",
88
+ "pipeline": {
89
+ "role": "point",
90
+ "input_domain": "tight predicted visible_flame crop",
91
+ "context_fraction": 0,
92
+ "min_crop_side": null,
93
+ "point_decoder": "argmax then local 5x5 softmax expectation at pixel centers",
94
+ "global_visible_nms_iou": 0.6,
95
+ "proposal_nms_iou": 0.75,
96
+ "proposal_limit": 6,
97
+ "note": "Cadryl runs one selected model; cascade orchestration requires the supplied runner. Visible Cadryl applies per-crop NMS; reference cascade applies NMS after whole-image reprojection."
98
+ },
99
+ "limits": {
100
+ "inference_only": true,
101
+ "training_signatures": false,
102
+ "test_evaluated": false,
103
+ "android_device_tested": false,
104
+ "gpu_delegate_tested": false,
105
+ "point": "flame_base_anchor appearance convention, not ignition or source geography",
106
+ "smoke": "binary visual compatibility, no smoke masks, core points, or source position",
107
+ "probabilities_calibrated": "smoke calibration retained; detector alert thresholds not calibrated",
108
+ "numerical_parity_not_semantic_accuracy": true
109
+ },
110
+ "validation": "conversion_validation.json",
111
+ "licenses": [
112
+ "LICENSE",
113
+ "NOTICE"
114
+ ]
115
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/source.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": "fireviewer/dinov2-small-visible-flame-monopoint-v2.5",
3
+ "revision": "a0a0f088c51ad9f7de966a89da958638bd4dcfbf",
4
+ "weights_sha256": "aeac16f9d7e2b401b0d1cd533681be3f922bfe7271408a4aea22b42273ec2aad",
5
+ "selected_epoch": 6,
6
+ "native_checkpoint_epoch": 6,
7
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d",
8
+ "dataset": {
9
+ "repository": "fireviewer/v2.5-visible-flame-crop-monopoint",
10
+ "revision": "4f22e3fd44c77e01dade2020cc9450ced995552e"
11
+ },
12
+ "config": {
13
+ "schema": "fireviewer.model.inference.v1",
14
+ "model_kind": "flame_point",
15
+ "semantic": "flame_base_anchor",
16
+ "source_checkpoint_sha256": "df540bf5666e28ff70c60592c82ce94f911b2fef006ccadcd4359de46ec7b33d",
17
+ "selected_epoch": 6,
18
+ "weights": "model.safetensors",
19
+ "normalization": {
20
+ "mean": [
21
+ 0.485,
22
+ 0.456,
23
+ 0.406
24
+ ],
25
+ "std": [
26
+ 0.229,
27
+ 0.224,
28
+ 0.225
29
+ ]
30
+ },
31
+ "test_locked": true,
32
+ "resolution": 448,
33
+ "backbone_config": {
34
+ "architectures": [
35
+ "Dinov2Model"
36
+ ],
37
+ "attention_probs_dropout_prob": 0.0,
38
+ "drop_path_rate": 0.0,
39
+ "hidden_act": "gelu",
40
+ "hidden_dropout_prob": 0.0,
41
+ "hidden_size": 384,
42
+ "image_size": 518,
43
+ "initializer_range": 0.02,
44
+ "layer_norm_eps": 1e-06,
45
+ "layerscale_value": 1.0,
46
+ "mlp_ratio": 4,
47
+ "model_type": "dinov2",
48
+ "num_attention_heads": 6,
49
+ "num_channels": 3,
50
+ "num_hidden_layers": 12,
51
+ "patch_size": 14,
52
+ "qkv_bias": true,
53
+ "torch_dtype": "float32",
54
+ "transformers_version": "4.32.0.dev0",
55
+ "use_swiglu_ffn": false
56
+ },
57
+ "heatmap_size": 128,
58
+ "decoder": "conv384_128_gn8_gelu_up2_conv128_64_gn8_gelu_up2_conv64_1",
59
+ "point_extraction": "argmax_then_local_5x5_softmax",
60
+ "crop": "floor_ceil_tight_flame_bbox"
61
+ }
62
+ }
models/fireviewer_dinov2_small_visible_flame_monopoint_v25_fp32/studio_pack.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "vision-studio-pack/1",
3
+ "name": "FireViewer v2.5 flame_base_anchor",
4
+ "classes": [
5
+ "flame_base_anchor"
6
+ ],
7
+ "tasks": [
8
+ "POINTING"
9
+ ],
10
+ "batchSize": 100,
11
+ "model": {
12
+ "schemaVersion": 1,
13
+ "task": "pointing",
14
+ "adapter": "points",
15
+ "runtime": "litert_interpreter",
16
+ "inputWidth": 448,
17
+ "inputHeight": 448,
18
+ "inputChannels": 3,
19
+ "inputType": "FLOAT32",
20
+ "inputLayout": "NCHW",
21
+ "isRgb": true,
22
+ "resizeMode": "stretch",
23
+ "mean": 0.0,
24
+ "std": 255.0,
25
+ "channelMean": [
26
+ 123.675,
27
+ 116.28,
28
+ 103.53
29
+ ],
30
+ "channelStd": [
31
+ 58.395,
32
+ 57.120000000000005,
33
+ 57.375
34
+ ],
35
+ "threads": 2,
36
+ "labels": [
37
+ "flame_base_anchor"
38
+ ],
39
+ "threshold": 0.0,
40
+ "nmsIou": 0.6,
41
+ "maxDetections": 1,
42
+ "topK": 1,
43
+ "outputIndex": 1,
44
+ "coordinates": "normalized",
45
+ "scoreActivation": "none"
46
+ }
47
+ }
models/fireviewer_rfdetr_medium_probable_fire_v25_fp32/CITATION.cff ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "Please cite this research checkpoint and its upstream architecture."
3
+ title: "FireViewer v2.5: rfdetr-medium-probable-fire-v2.5"
4
+ authors:
5
+ - name: "FireViewer contributors"
6
+ version: "2.5"
7
+ date-released: "2026-10-06"
8
+ url: "https://huggingface.co/fireviewer/rfdetr-medium-probable-fire-v2.5"
9
+ license: "Apache-2.0"