CephTrace commited on
Commit
61e7c0e
·
verified ·
1 Parent(s): 17054bf

Delete HuggingFace-README.md

Browse files
Files changed (1) hide show
  1. HuggingFace-README.md +0 -223
HuggingFace-README.md DELETED
@@ -1,223 +0,0 @@
1
- ---
2
- license: cc-by-nc-sa-4.0
3
- language:
4
- - en
5
- tags:
6
- - medical-imaging
7
- - cephalometric
8
- - landmark-detection
9
- - orthodontics
10
- - heatmap-regression
11
- - spatial-priors
12
- - onnx
13
- library_name: onnxruntime
14
- pipeline_tag: image-segmentation
15
- datasets:
16
- - custom
17
- metrics:
18
- - mre
19
- - sdr
20
- model-index:
21
- - name: CephTrace v4
22
- results:
23
- - task:
24
- type: landmark-detection
25
- name: Cephalometric Landmark Detection
26
- dataset:
27
- type: custom
28
- name: Aggregated (ISBI 2015 + Aariz/CEPHA29 + DentalCepha)
29
- config: 25-landmark
30
- split: test
31
- metrics:
32
- - type: mean-radial-error
33
- value: 1.050
34
- name: MRE (mm)
35
- - type: sdr-2mm
36
- value: 87.8
37
- name: SDR@2mm (%)
38
- ---
39
-
40
- # CephTrace v4 — Anatomy-Guided Cephalometric Landmark Detection
41
-
42
- **1.050 mm MRE across 25 landmarks** on a 151-image held-out test set, using image-adaptive spatial priors generated by anatomical analysis of each radiograph.
43
-
44
- ## Model Description
45
-
46
- CephTrace v4 is a two-stage pipeline for automatic cephalometric landmark detection from lateral skull radiographs:
47
-
48
- - **Stage 0 (Anatomical Initialization):** A multi-phase module that detects the soft-tissue profile, partitions the image into anatomical zones, extracts bony contours, derives anchor landmarks via geometric rules, and generates 25 per-landmark Gaussian attention maps — all adapted to each patient's individual anatomy.
49
- - **Stage 1 (Heatmap Regression):** An HRNet-W32 backbone (32M params) that accepts the 28-channel input (3 RGB + 25 attention maps) and outputs 25 landmark heatmaps at 256×256 resolution.
50
-
51
- The key innovation is that the attention priors are **image-adaptive**: each patient receives maps centered at *their* estimated anatomy, not fixed population-average positions. Controlled experiments show this reduces MRE by 30.9% compared to the same architecture without priors.
52
-
53
- ## ONNX Models
54
-
55
- All models are exported as ONNX (opset 14) for cross-platform inference.
56
-
57
- | File | Stage | Purpose | Size | Input | Output |
58
- |------|-------|---------|------|-------|--------|
59
- | `v4_stage0_profile.onnx` | 0A | Soft-tissue profile segmentation | 26.8 MB | `(1,1,512,512)` float32 | `(1,1,512,512)` sigmoid mask |
60
- | `z1_cranial_base_contours.onnx` | 0C | Cranial base contour segmentation | 26.8 MB | `(1,1,256,256)` float32 | `(1,1,256,256)` logits |
61
- | `z2_midface_contours.onnx` | 0C | Midface contour segmentation (palatal + upper incisor) | 26.8 MB | `(1,1,256,256)` float32 | `(1,2,256,256)` logits |
62
- | `z3_mandible_contours.onnx` | 0C | Mandible contour segmentation (border + symphysis + lower incisor) | 26.8 MB | `(1,1,256,256)` float32 | `(1,3,256,256)` logits |
63
- | `z4_posterior_contours.onnx` | 0C | Posterior contour segmentation (mandible + cranial base) | 26.8 MB | `(1,1,256,256)` float32 | `(1,2,256,256)` logits |
64
- | `phase0e_model.onnx` | 0E | Anchor → derived landmark MLP | 455 KB | `(1,14)` float32 | `(1,36)` float32 |
65
- | `v4_stage1.onnx` | 1 | HRNet-W32 heatmap regression | 130 MB | `(1,28,512,512)` float32 | `(1,25,256,256)` float32 |
66
-
67
- **Total: 264 MB**
68
-
69
- ## Pipeline Flow
70
-
71
- ```
72
- Lateral Cephalogram (any resolution)
73
-
74
- ▼ resize to 512×512
75
- Phase 0A ──► Soft-tissue profile mask (Dice 0.80)
76
-
77
-
78
- Phase 0B ──► 5 anatomical zones + 6 soft-tissue landmarks (geometric rules)
79
-
80
- ▼ per-zone CLAHE enhancement
81
- Phase 0C ──► Bony contour masks (4 zone-specific U-Nets)
82
-
83
- ▼ Douglas-Peucker simplification
84
- Phase 0D ──► 7 anchor landmarks (0.11 mm MRE, topological rules)
85
-
86
-
87
- Phase 0E ──► 18 derived landmarks (MLP, 114K params)
88
- + 25 Gaussian attention maps (256×256, 3-tier σ)
89
-
90
- ▼ bilinear upsample to 512, concat with RGB → 28 channels
91
- Stage 1 ──► 25 heatmaps (256×256) → peak decode → 25 landmarks
92
- ```
93
-
94
- **Inference time:** ~410 ms total (Stage 0: ~40 ms, Stage 1: ~350 ms) on A100 GPU.
95
-
96
- ## Landmark Set (25 landmarks, CANONICAL_25 order)
97
-
98
- ```
99
- 0: S (Sella) 1: N (Nasion) 2: Or (Orbitale)
100
- 3: Po (Porion) 4: ANS 5: PNS
101
- 6: A (Subspinale) 7: B (Supramentale) 8: Pog (Pogonion)
102
- 9: Gn (Gnathion) 10: Me (Menton) 11: Go (Gonion)
103
- 12: Ar (Articulare) 13: Co (Condylion) 14: U1_tip
104
- 15: U1_root 16: L1_tip 17: L1_root
105
- 18: UL (Upper Lip) 19: LL (Lower Lip) 20: Pm (Pterygomaxillare)
106
- 21: Ba (Basion) 22: Pog_soft 23: Sn (Subnasale)
107
- 24: Prn (Pronasale)
108
- ```
109
-
110
- ## Performance
111
-
112
- ### Controlled Ablation (151-image held-out test set)
113
-
114
- | Configuration | Input | MRE (mm) | SDR@2mm |
115
- |---|---|---|---|
116
- | HRNet backbone (no priors) | 3-ch | 1.520 | 86.6% |
117
- | **HRNet + Phase 0E priors** | **28-ch** | **1.050** | **87.8%** |
118
- | **Improvement** | | **0.470 (30.9%)** | **+1.2%** |
119
-
120
- Same 1,201 training images, architecture, and recipe. Only variable: prior channels.
121
-
122
- ### Prior Ablation
123
-
124
- | Configuration | MRE (mm) | vs. No Priors |
125
- |---|---|---|
126
- | Random priors (shuffled channels) | 2.240 | +15.6% worse |
127
- | No priors (baseline) | 1.938 | — |
128
- | Fixed textbook priors | 1.869 | −3.6% (marginal) |
129
- | **Image-adaptive priors (Phase 0E)** | **1.043** | **−46.2%** |
130
-
131
- ### Attention Map Confidence Tiers
132
-
133
- | Tier | σ (at 256×256) | Landmarks | Mean Improvement |
134
- |---|---|---|---|
135
- | High | 5–7 | S, N, Me, ANS, Prn, Sn | −0.74 mm |
136
- | Medium | 8–13 | Go, Gn, Pog, Or, UL, LL, Pog', A | −0.44 mm |
137
- | Low | 18–22 | Po, Co, B, PNS, U1r, L1r, Ba, Pm | −0.17 mm |
138
-
139
- ### Clinical Reliability
140
-
141
- - Vertical skeletal classification (FMA): Cohen's κ = 0.78 (substantial agreement)
142
- - 20/25 landmarks improve with priors; 1 degrades (Basion, lowest confidence tier)
143
-
144
- ## Usage
145
-
146
- ```python
147
- import onnxruntime as ort
148
- import numpy as np
149
- import cv2
150
-
151
- # Load Stage 1 model
152
- sess = ort.InferenceSession("v4_stage1.onnx")
153
-
154
- # Prepare input (28 channels: 3 RGB + 25 attention maps from Stage 0)
155
- image = cv2.imread("cephalogram.jpg")
156
- image_512 = cv2.resize(image, (512, 512))
157
- rgb = image_512.astype(np.float32) / 255.0 # (512, 512, 3)
158
- rgb = np.transpose(rgb, (2, 0, 1)) # (3, 512, 512)
159
-
160
- # attention_maps shape: (25, 512, 512) from Stage 0 pipeline
161
- # (See Stage 0 inference code for generating these)
162
- input_28ch = np.concatenate([rgb, attention_maps], axis=0) # (28, 512, 512)
163
- input_tensor = input_28ch[np.newaxis] # (1, 28, 512, 512)
164
-
165
- # Run inference
166
- input_name = sess.get_inputs()[0].name
167
- heatmaps = sess.run(None, {input_name: input_tensor})[0] # (1, 25, 256, 256)
168
-
169
- # Decode landmarks from heatmap peaks
170
- landmarks = []
171
- for i in range(25):
172
- hm = heatmaps[0, i]
173
- y, x = np.unravel_index(np.argmax(hm), hm.shape)
174
- # Scale from heatmap (256) to image (512) coordinates
175
- landmarks.append((x * 2, y * 2))
176
- ```
177
-
178
- ## Training Data
179
-
180
- Aggregated from three public sources (1,502 total images):
181
-
182
- | Source | Images | Landmarks | Scanner(s) |
183
- |---|---|---|---|
184
- | [ISBI 2015](https://www-o.ntust.edu.tw/~cweiwang/ISBI2015/challenge1/) | 400 | 19 | Soredex CRANEX |
185
- | [Aariz/CEPHA29](https://doi.org/10.1038/s41597-025-05542-3) | 1,000 | 29 | 7+ device types |
186
- | DentalCepha | 102 | 19 | Mixed |
187
-
188
- Split: 1,201 train / 150 validation / 151 test (stratified by source, seed=42).
189
-
190
- ## Citation
191
-
192
- ```bibtex
193
- @article{mohapatra2025cephtrace,
194
- title={CephTrace: Anatomy-Guided Spatial Attention Priors for
195
- Sub-Millimeter Cephalometric Landmark Detection},
196
- author={Mohapatra, Sidhartha and Mohanty, Pallavi},
197
- journal={arXiv preprint arXiv:2605.03358},
198
- year={2025},
199
- url={https://arxiv.org/abs/2605.03358}
200
- }
201
- ```
202
-
203
- ## Links
204
-
205
- | Resource | URL |
206
- |---|---|
207
- | **Paper** | [arXiv:2605.03358](https://arxiv.org/abs/2605.03358) |
208
- | **Code** | [github.com/sidwiz/cephtrace-research](https://github.com/sidwiz/cephtrace-research) |
209
- | **Data & Weights** | [Zenodo DOI 10.5281/zenodo.20032162](https://doi.org/10.5281/zenodo.20032162) |
210
- | **Website** | [cephtrace.com](https://cephtrace.com) |
211
-
212
- ## License
213
-
214
- This work is licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/). Commercial use requires a separate license — contact research@cephtrace.com.
215
-
216
- Three U.S. provisional patent applications are pending (#64/037,246; #64/037,252; #64/039,042).
217
-
218
- ## Limitations
219
-
220
- - Trained on 2D lateral cephalograms only; not validated on 3D CBCT or PA cephalograms.
221
- - Phase 0A requires visible soft-tissue profile; severely overexposed or cropped images may degrade.
222
- - Basion (Ba) accuracy degrades slightly with priors due to low Phase 0E confidence (σ=22).
223
- - Cross-source generalization without priors is poor (22–37 mm MRE in LOSO experiments); Phase 0's anatomical analysis provides scanner-invariant features.