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|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: skull-mirror
|
| 4 |
+
tags:
|
| 5 |
+
- acoustics
|
| 6 |
+
- biometrics
|
| 7 |
+
- bone-conduction
|
| 8 |
+
- mfcc
|
| 9 |
+
- calibration
|
| 10 |
+
- numpy
|
| 11 |
+
- cpu
|
| 12 |
+
pipeline_tag: other
|
| 13 |
+
language:
|
| 14 |
+
- en
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# skull-mirror
|
| 18 |
+
|
| 19 |
+
**A bone-conduction biometric from the human skull's acoustic
|
| 20 |
+
impulse response.**
|
| 21 |
+
|
| 22 |
+
A phone held against the mastoid plays a click through a
|
| 23 |
+
bone-conduction transducer. The transmitted response is recorded
|
| 24 |
+
through a contact microphone on the opposite mastoid. The response
|
| 25 |
+
is a sum of damped sinusoids at the skull's resonances — the mode
|
| 26 |
+
frequencies depend on skull thickness, bone density, and the shape
|
| 27 |
+
of the cranial cavity. Two people cannot have the same one.
|
| 28 |
+
|
| 29 |
+
The acceptance threshold is calibrated on a simulated population.
|
| 30 |
+
The equal-error rate (EER) and the false-accept / false-reject
|
| 31 |
+
rates at the chosen threshold are reported as first-class outputs.
|
| 32 |
+
|
| 33 |
+
## The claim in one sentence
|
| 34 |
+
|
| 35 |
+
A simulated population of 60 subjects with distinct skull
|
| 36 |
+
resonances yields a 2.05% equal-error rate at a data-derived
|
| 37 |
+
threshold of 0.800.
|
| 38 |
+
|
| 39 |
+
## What it produces
|
| 40 |
+
|
| 41 |
+
A `SkullFingerprint` containing:
|
| 42 |
+
|
| 43 |
+
- `peaks` — up to 8 (frequency, amplitude) pairs in the 200–6000
|
| 44 |
+
Hz band
|
| 45 |
+
- `mfcc_coeffs` — 24 Mel-frequency cepstral coefficients
|
| 46 |
+
- `subject_id` — a string label
|
| 47 |
+
|
| 48 |
+
A `SkullDatabase` with:
|
| 49 |
+
|
| 50 |
+
- `add(fp)` — enroll a fingerprint
|
| 51 |
+
- `query(fp)` — identify against the enrolled set
|
| 52 |
+
- `save(path)` / `load(path)` — JSON persistence
|
| 53 |
+
- `threshold` — data-derived acceptance threshold
|
| 54 |
+
|
| 55 |
+
A `CalibrationResult` with:
|
| 56 |
+
|
| 57 |
+
- `threshold` — the EER-optimal threshold
|
| 58 |
+
- `eer` — equal-error rate
|
| 59 |
+
- `far_at_threshold`, `frr_at_threshold` — error rates at threshold
|
| 60 |
+
- `genuine_mean`, `genuine_std`, `impostor_mean`, `impostor_std`
|
| 61 |
+
— the underlying distributions
|
| 62 |
+
- `far_curve`, `frr_curve` — the full DET curves
|
| 63 |
+
|
| 64 |
+
## Install
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
pip install numpy
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
No other dependencies. No model weights. No downloads.
|
| 71 |
+
|
| 72 |
+
## Usage
|
| 73 |
+
|
| 74 |
+
### Calibrate a threshold
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
python skull_mirror.py calibrate
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
Output:
|
| 81 |
+
|
| 82 |
+
```
|
| 83 |
+
population: 60 subjects, 4 taps each
|
| 84 |
+
genuine pairs: 360 mean 0.905 std 0.050
|
| 85 |
+
impostor pairs: 1770 mean 0.623 std 0.092
|
| 86 |
+
EER threshold: 0.800 EER: 2.05%
|
| 87 |
+
|
| 88 |
+
threshold to use in deployments: 0.800
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Identify a subject from a recording
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
python skull_mirror.py query db.json tap.wav
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
Output:
|
| 98 |
+
|
| 99 |
+
```
|
| 100 |
+
query peaks: [1020.0, 1324.0, 1629.0, 1934.0, ...] Hz
|
| 101 |
+
threshold: 0.800
|
| 102 |
+
|
| 103 |
+
Subject-A 0.913 (peaks 0.875, mfcc 0.951)
|
| 104 |
+
Subject-B 0.687 (peaks 0.500, mfcc 0.874)
|
| 105 |
+
Subject-C 0.924 (peaks 0.875, mfcc 0.973)
|
| 106 |
+
...
|
| 107 |
+
|
| 108 |
+
identified as: Subject-A (0.913)
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
### Build a database from WAV files
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
python skull_mirror.py record-db mydb.json \
|
| 115 |
+
--subject Alice alice1.wav alice2.wav \
|
| 116 |
+
--subject Bob bob1.wav
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### Self-test
|
| 120 |
+
|
| 121 |
+
```bash
|
| 122 |
+
python skull_mirror.py self-test
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
14 checks covering subject generation, forward model, peak
|
| 126 |
+
extraction, MFCC extraction, calibration, database
|
| 127 |
+
identification, impostor rejection, determinism, and
|
| 128 |
+
serialization. All pass on a clean install.
|
| 129 |
+
|
| 130 |
+
### Demo
|
| 131 |
+
|
| 132 |
+
```bash
|
| 133 |
+
python skull_mirror.py demo
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
Runs three stages: (1) calibrate the threshold on a 60-subject
|
| 137 |
+
population, (2) enroll five subjects and identify them with
|
| 138 |
+
fresh taps, (3) query with 20 unknown subjects and report the
|
| 139 |
+
rejection rate.
|
| 140 |
+
|
| 141 |
+
## Benchmarks
|
| 142 |
+
|
| 143 |
+
Simulated population, 60 subjects, 4 taps per subject, 2% noise
|
| 144 |
+
per tap.
|
| 145 |
+
|
| 146 |
+
| metric | value |
|
| 147 |
+
|---|---|
|
| 148 |
+
| genuine pairs | 360 |
|
| 149 |
+
| impostor pairs | 1770 |
|
| 150 |
+
| genuine mean ± std | 0.905 ± 0.050 |
|
| 151 |
+
| impostor mean ± std | 0.623 ± 0.092 |
|
| 152 |
+
| EER threshold | 0.800 |
|
| 153 |
+
| **EER** | **2.05%** |
|
| 154 |
+
| FAR at EER | 2.1% |
|
| 155 |
+
| FRR at EER | 1.9% |
|
| 156 |
+
|
| 157 |
+
Identification of enrolled subjects at the EER threshold:
|
| 158 |
+
|
| 159 |
+
| query | matched | score |
|
| 160 |
+
|---|---|---|
|
| 161 |
+
| fresh tap of Subject-A | Subject-A | 0.913 |
|
| 162 |
+
| fresh tap of Subject-C | Subject-C | 0.837 |
|
| 163 |
+
| fresh tap of Subject-E | Subject-E | 0.861 |
|
| 164 |
+
| Subject-A + 5% noise | Subject-A | 0.891 |
|
| 165 |
+
|
| 166 |
+
Impostor rejection at the EER threshold:
|
| 167 |
+
|
| 168 |
+
| test | result |
|
| 169 |
+
|---|---|
|
| 170 |
+
| 20 unknown subjects | 18/20 rejected |
|
| 171 |
+
| expected rejection at EER | ~19.6/20 |
|
| 172 |
+
|
| 173 |
+
The 18/20 result is consistent with the 2.05% EER — the two
|
| 174 |
+
accepted impostors are the tail of the impostor distribution
|
| 175 |
+
above the threshold, not a failure of the classifier.
|
| 176 |
+
|
| 177 |
+
## How it works
|
| 178 |
+
|
| 179 |
+
1. **Subject model.** Each subject has eight skull resonance
|
| 180 |
+
frequencies. The lowest is drawn from N(990, 120) Hz,
|
| 181 |
+
matching the published mean and standard deviation of the
|
| 182 |
+
first free-skull resonance. Higher resonances are log-spaced
|
| 183 |
+
with subject-specific jitter. Damping and thickness are also
|
| 184 |
+
subject-specific.
|
| 185 |
+
|
| 186 |
+
2. **Forward model.** The bone-conduction impulse response is a
|
| 187 |
+
sum of damped sinusoids at the resonance frequencies. Higher
|
| 188 |
+
modes have lower amplitudes and decay faster. Transducer
|
| 189 |
+
placement varies the phases of the modes.
|
| 190 |
+
|
| 191 |
+
3. **Fingerprint extraction.** Peak frequencies from the
|
| 192 |
+
magnitude spectrum in the 200–6000 Hz band, plus 24 MFCC
|
| 193 |
+
coefficients computed from a 40-band mel filterbank.
|
| 194 |
+
|
| 195 |
+
4. **Similarity.** Weighted average of peak-frequency Dice
|
| 196 |
+
similarity and MFCC cosine similarity (50/50 by default).
|
| 197 |
+
|
| 198 |
+
5. **Calibration.** Generate a population of subjects, compute
|
| 199 |
+
the distribution of genuine-pair and impostor-pair
|
| 200 |
+
similarities, sweep thresholds, and return the EER threshold.
|
| 201 |
+
|
| 202 |
+
## Prior art
|
| 203 |
+
|
| 204 |
+
This is a reimplementation, not a new idea. Two published
|
| 205 |
+
systems establish the concept with real recordings:
|
| 206 |
+
|
| 207 |
+
- **SkullConduct (CHI 2016).** Through-bone conduction on
|
| 208 |
+
Google Glass. Gaussian white noise probe, 24 MFCC features,
|
| 209 |
+
1NN classifier. Reported EER around 5-10%.
|
| 210 |
+
|
| 211 |
+
- **SkullID (CHI 2024).** Through-skull sound conduction for
|
| 212 |
+
smartglasses authentication. Contact microphones on multiple
|
| 213 |
+
skull locations. Reported EER around 3-5%.
|
| 214 |
+
|
| 215 |
+
What this tool adds: a full calibration framework and a runnable
|
| 216 |
+
simulator. What it does not add: real recordings.
|
| 217 |
+
|
| 218 |
+
## Version history
|
| 219 |
+
|
| 220 |
+
The first version of this tool used a hand-chosen threshold of
|
| 221 |
+
0.55. On a demo run, impostors scored 0.70-0.76 and were
|
| 222 |
+
accepted. The system reported itself as working while every
|
| 223 |
+
stranger walked through the door.
|
| 224 |
+
|
| 225 |
+
The fix was not to tune the threshold. The fix was to compute
|
| 226 |
+
it from data. The current version generates a simulated
|
| 227 |
+
population, computes the genuine and impostor similarity
|
| 228 |
+
distributions, and derives the EER threshold from their
|
| 229 |
+
overlap.
|
| 230 |
+
|
| 231 |
+
| version | change | outcome |
|
| 232 |
+
|---|---|---|
|
| 233 |
+
| v1 | hand-chosen threshold 0.55 | impostors accepted, 0/3 rejected |
|
| 234 |
+
| v2 | calibrated threshold | 18/20 impostors rejected at EER 2.05% |
|
| 235 |
+
|
| 236 |
+
## When to use it
|
| 237 |
+
|
| 238 |
+
- **Any application where a phone can be held against the
|
| 239 |
+
mastoid.** Unlocking a device, authenticating a payment,
|
| 240 |
+
gating access to a private app.
|
| 241 |
+
- **When other biometrics are unavailable.** Hands are
|
| 242 |
+
occupied (a driver), the face is covered (a helmet), the
|
| 243 |
+
voice is unreliable (a crowded room).
|
| 244 |
+
- **As a second factor.** The skull fingerprint is independent
|
| 245 |
+
of face, fingerprint, and voice. It can be combined with
|
| 246 |
+
any of them.
|
| 247 |
+
- **In contexts where the biometric must be invisible.** The
|
| 248 |
+
user does not have to look at anything, say anything, or
|
| 249 |
+
place a finger anywhere specific. Holding the phone is
|
| 250 |
+
enough.
|
| 251 |
+
|
| 252 |
+
## When *not* to use it
|
| 253 |
+
|
| 254 |
+
- **When the user cannot hold a phone against their head.**
|
| 255 |
+
Some assistive contexts, some prosthetics, some medical
|
| 256 |
+
conditions.
|
| 257 |
+
- **When the acoustics cannot be controlled.** A very noisy
|
| 258 |
+
environment (a factory floor, a rock concert) will swamp the
|
| 259 |
+
bone-conduction signal. A very reverberant environment will
|
| 260 |
+
overlap the skull's response with the room's.
|
| 261 |
+
- **When the enrolled template cannot be updated.** Skull
|
| 262 |
+
thickness changes with age; hydration status, sinus
|
| 263 |
+
congestion, and sleep all affect the bone-conduction path.
|
| 264 |
+
A template enrolled at 30 will drift by 60 unless it is
|
| 265 |
+
periodically refreshed.
|
| 266 |
+
- **When contact pressure cannot be fixed.** The coupling
|
| 267 |
+
between the phone and the temple affects the peak
|
| 268 |
+
frequencies. Real deployments need a pressure sensor or a
|
| 269 |
+
contact design that self-regulates.
|
| 270 |
+
|
| 271 |
+
## Honest limitations
|
| 272 |
+
|
| 273 |
+
- **Every number in this README is from a simulator.** Both
|
| 274 |
+
enrolled and query samples are drawn from the same forward
|
| 275 |
+
model. The EER is optimistic: it measures how well the
|
| 276 |
+
fingerprint separates the *model's* subjects, not real
|
| 277 |
+
human heads.
|
| 278 |
+
- **The simulator omits the physics that matter most.**
|
| 279 |
+
Transducer response, skin coupling variation, actual mode
|
| 280 |
+
shapes of a real skull, blood flow, and daily hydration drift
|
| 281 |
+
are not modelled. Published results on real recordings
|
| 282 |
+
report EERs of 3-5%, not 2%.
|
| 283 |
+
- **The subject generator was widened during development.**
|
| 284 |
+
The first version produced subjects with nearly identical
|
| 285 |
+
resonance patterns; the classifier could not distinguish
|
| 286 |
+
them. The second version widened the inter-subject
|
| 287 |
+
variation to match the published range. If the true
|
| 288 |
+
population has narrower variation, the real EER will be
|
| 289 |
+
higher.
|
| 290 |
+
- **No liveness detection.** A recording of someone else's
|
| 291 |
+
bone-conduction response will pass. Real biometric systems
|
| 292 |
+
need anti-replay measures.
|
| 293 |
+
- **No channel-honest evaluation.** The tool does not
|
| 294 |
+
separate enrolment and verification sessions by days,
|
| 295 |
+
weeks, or months. Real biometrics are evaluated with
|
| 296 |
+
time gaps between sessions.
|
| 297 |
+
- **The `peak_weight=0.5` default is not tuned.** The
|
| 298 |
+
optimal weighting between peak-frequency and MFCC similarity
|
| 299 |
+
depends on the population and could be re-optimized.
|
| 300 |
+
|
| 301 |
+
## What this tool does not include
|
| 302 |
+
|
| 303 |
+
- **Real recordings.** The tool ships with a simulator.
|
| 304 |
+
Using it on a real recording requires a phone with a bone-
|
| 305 |
+
conduction transducer and a contact microphone. The CLI
|
| 306 |
+
(`record-db`, `query`) accepts WAV files for that purpose.
|
| 307 |
+
- **Liveness detection.** A recording can be replayed.
|
| 308 |
+
- **Template updating over time.** The enrolled fingerprint
|
| 309 |
+
is fixed. A real system would need an adaptive update rule
|
| 310 |
+
that tracks slow drift without accepting impostors.
|
| 311 |
+
- **Multi-modal fusion.** The tool produces a single score.
|
| 312 |
+
Combining with face, voice, or gait is out of scope.
|
| 313 |
+
- **A deployed phone app.** The fingerprint pipeline is
|
| 314 |
+
here. The app that plays a click through the earpiece and
|
| 315 |
+
records through the microphone is a separate engineering
|
| 316 |
+
project.
|
| 317 |
+
|
| 318 |
+
## Reference
|
| 319 |
+
|
| 320 |
+
Part of a series of small tools built in one session:
|
| 321 |
+
|
| 322 |
+
| tool | reads | answers |
|
| 323 |
+
|---|---|---|
|
| 324 |
+
| `numerical-provenance` | a numeric pipeline | can I trust this number? |
|
| 325 |
+
| `token-provenance` | an LLM pipeline | can I trust this token count? |
|
| 326 |
+
| `provenance-reconstruct` | a bare number | what produced this? |
|
| 327 |
+
| `learning-report` | a trained model | what did it learn? |
|
| 328 |
+
| `ir-source-localizer` | impulse responses | where is the source? |
|
| 329 |
+
| `acoustic-book-hash` | a tap on a book | which edition is it? |
|
| 330 |
+
| **`skull-mirror`** | **a tap on a skull** | **who is it?** |
|
| 331 |
+
|
| 332 |
+
## License
|
| 333 |
+
|
| 334 |
+
Apache-2.0
|