bubbaonbubba commited on
Commit
31be935
·
verified ·
1 Parent(s): b55eca7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +59 -10
README.md CHANGED
@@ -1,21 +1,70 @@
1
- # pockethb-base (EXPERIMENTAL — not a measurement tool)
 
 
 
 
 
 
 
2
 
3
- base hemoglobin regressor from [pocketHb](https://github.com/jayanthvee/pocketHb). resnet18 finetuned on the [nature sci data 2024](https://www.nature.com/articles/s41597-024-03895-9) fingernail+hb dataset (n=250 subjects). subject-disjoint 70/15/15 split, seed 42.
4
 
5
- ## test metrics (patient-level, n=37 subjects)
6
 
7
- - MAE: 1.582 g/dL
8
- - RMSE: ~2.32 g/dL
9
- - **R² ≈ +0.01**
10
 
11
- **the being essentially zero is the headline finding.** this model is not meaningfully estimating hemoglobin. it has primarily learned to regress predictions toward the population mean (~12.55 g/dL). the MAE improvement over the dumb predict-the-mean baseline (1.77 g/dL) is marginal and mostly attributable to train/test mean drift, not learned image features.
12
 
13
- this is consistent with what every small-n open-source replication of the [Mannino et al. PNAS 2025 paper](https://doi.org/10.1073/pnas.2424677122) hits: the paper used 9,061 subjects with paired CBC labels (and 1.4M+ real-world uses). this dataset has 250 subjects with one photo each. there is not enough data here to recover the photo→Hb signal well at the population level.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  ## intended use
16
 
17
- **only as an input to a per-user personalization layer.** the open-source contribution of [pocketHb](https://github.com/jayanthvee/pocketHb) is the personalization layer that calibrates this noisy base model to a users known baseline hemoglobin value (from a real CBC). without that calibration, this base regressor should not be used.
18
 
19
  ## not a medical device
20
 
21
- research replication only. **do not use to estimate anyones actual hemoglobin.** not FDA cleared, not validated clinically, not a doctor. if you need a hemoglobin reading, get a blood test.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - regression
5
+ - medical-imaging
6
+ - fingernail
7
+ - hemoglobin
8
+ ---
9
 
10
+ # pockethb-base
11
 
12
+ base hemoglobin regressor from the [pocketHb](https://github.com/jayanthvee/pocketHb) project. **not a measurement tool. read this whole card before using.**
13
 
14
+ ## what this is
 
 
15
 
16
+ a global, population-level Hb regressor on fingernail photos. methodology follows Rudokaite et al., BNAIC 2025 (Tilburg/Sanquin smartphone-Hb paper):
17
 
18
+ - frozen convnext_tiny.fb_in22k_ft_in1k via imm (no fine-tuning)
19
+ - Shades-of-Gray (p=6) illumination correction → 224x224 resize → ImageNet normalize
20
+ - per-patient aggregation: mean + std of crop embeddings (1536-d patient vector)
21
+ - standardize → PLS + SVR(RBF) → isotonic calibration → weighted blend
22
+ - trained on Nature Sci Data 2024 fingernail+Hb dataset (n=250 subjects, single CBC each)
23
+
24
+ trained on **nail crops only**. the public Nature 2024 release ships 600x800 images, but 606 of 750 skin bboxes were labelled in a taller source frame and now sit below the bottom edge of the released images. only 83 patients would survive a nail+skin fusion — we ran nail-only on the full 250 instead.
25
+
26
+ ## metrics (5-fold stratified CV, n=250)
27
+
28
+ - **MAE: 2.09 g/dL**
29
+ - **RMSE: 2.74 g/dL**
30
+ - **R²: -0.05**
31
+
32
+ R² ≈ 0 means this global model is essentially predicting near the dataset mean. it barely beats the predict-mean floor (MAE ~2.14 g/dL) on this dataset. **this is the documented ceiling of population-level Hb modeling at sub-1000-subject scale**, not a bug:
33
+
34
+ - The Rudokaite/BNAIC paper itself, with the same methodology on n=159, got MAE 0.6 mmol/L — that sounds clinical until you notice their predict-mean floor was ~0.63 mmol/L. similar R² ≈ 0 story, smaller absolute number because their donor population had Hb std 0.79 mmol/L vs our 2.67 g/dL.
35
+ - Mannino et al. (PNAS 2025) only got clinical-near accuracy with n=9,061 subjects PLUS per-user personalization. their global model alone is not clinically useful either; they patented and locked the personalization layer (US 12268498).
36
 
37
  ## intended use
38
 
39
+ **only as an input to a per-user calibration / personalization layer.** the open-source contribution of [pocketHb](https://github.com/jayanthvee/pocketHb) is exactly that personalization layer. without it, this base regressor is research artifact only.
40
 
41
  ## not a medical device
42
 
43
+ research replication only. **must not be used to estimate anyone\'s actual hemoglobin in any clinical, diagnostic, or treatment context.** not FDA cleared. not validated clinically. not a doctor. if you need a hemoglobin reading, get a blood test.
44
+
45
+ ## how to use
46
+
47
+ `python
48
+ import pickle
49
+ from huggingface_hub import hf_hub_download
50
+
51
+ # download bundle
52
+ bundle_path = hf_hub_download(repo_id='bubbaonbubba/pockethb-base', filename='pockethb_base.pkl')
53
+ with open(bundle_path, 'rb') as f:
54
+ bundle = pickle.load(f)
55
+
56
+ # bundle contains: backbone_name, image_size, imagenet_mean/std,
57
+ # shades_of_gray_p, modalities, aggregation, blender, n_train_patients, seed
58
+ `
59
+
60
+ see the [pocketHb repo](https://github.com/jayanthvee/pocketHb) for the full inference pipeline including image preprocessing and embedding extraction.
61
+
62
+ ## citation context
63
+
64
+ - Mannino et al., PNAS 2025. doi:10.1073/pnas.2424677122
65
+ - Rudokaite et al., BNAIC 2025 (Tilburg/Sanquin)
66
+ - Nature Sci Data 2024 dataset: doi:10.1038/s41597-024-03895-9
67
+
68
+ ## license
69
+
70
+ MIT.