Commit ·
81e4ed5
0
Parent(s):
Duplicate from dawahealth/gatekeeper_cervix_detector
Browse filesCo-authored-by: Khanyisile Tapiwa Magagula <KhanyiTapiwa00@users.noreply.huggingface.co>
- .gitattributes +35 -0
- README.md +53 -0
- best_weights_20260504_083526.h5 +3 -0
- final_model_20260504_083526.h5 +3 -0
- final_weights_20260504_083526.weights.h5 +3 -0
- gatekeeper_annotations (1).json +0 -0
- gatekeeper_metadata.json +29 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# Gatekeeper Cervix Detector
|
| 5 |
+
|
| 6 |
+
This model serves as a **binary gatekeeper** for cervical cancer screening systems. It quickly determines whether an input image is a valid cervical image before passing it to a downstream diagnostic model (MedSigLip).
|
| 7 |
+
|
| 8 |
+
## Model Details
|
| 9 |
+
|
| 10 |
+
- **Model Name**: Gatekeeper Cervix Detector
|
| 11 |
+
- **Base Architecture**: MobileNetV3-Small
|
| 12 |
+
- **Task**: Binary classification (cervix vs not-cervix)
|
| 13 |
+
- **Input Size**: 224×224×3 (RGB)
|
| 14 |
+
- **Input Normalization**: [-1, 1] (mean = [0.5, 0.5, 0.5], std = [0.5, 0.5, 0.5])
|
| 15 |
+
- **Output**: Probability that the image contains a cervix (sigmoid output)
|
| 16 |
+
- **Threshold**: 0.70 (images below this confidence are rejected)
|
| 17 |
+
- **License**: CC BY 4.0
|
| 18 |
+
- **Repository**: [Link to this repo]
|
| 19 |
+
|
| 20 |
+
## Intended Use
|
| 21 |
+
|
| 22 |
+
This model is designed to be used as the **first stage** in a two-stage pipeline:
|
| 23 |
+
|
| 24 |
+
1. **Gatekeeper** (this model): Filters out non-cervix images (random photos, other medical images, poor quality, etc.).
|
| 25 |
+
2. **MedSigLip** (downstream model): Only runs if the gatekeeper accepts the image. It performs cancer stage classification or similarity scoring.
|
| 26 |
+
|
| 27 |
+
**Use Case**: Maternal health screening in low-resource settings where non-experts may capture images using blind sweeps.
|
| 28 |
+
|
| 29 |
+
## Performance
|
| 30 |
+
|
| 31 |
+
**Test Set Results (threshold = 0.70)**
|
| 32 |
+
|
| 33 |
+
- Accuracy: 99.94%
|
| 34 |
+
- Precision: 100.00%
|
| 35 |
+
- Recall/Sensitivity: 99.88%
|
| 36 |
+
- Specificity: 100.00%
|
| 37 |
+
- AUC: 1.0000
|
| 38 |
+
- Rejection Rate: ~52.0%
|
| 39 |
+
|
| 40 |
+
The model shows excellent generalization and very strong rejection of non-cervix images while maintaining high sensitivity on true cervix images.
|
| 41 |
+
|
| 42 |
+
**Class Distribution**
|
| 43 |
+
- Cervix: 48.0%
|
| 44 |
+
- Not-cervix: 52.0%
|
| 45 |
+
- The split is stratified across train/validation/test sets.
|
| 46 |
+
|
| 47 |
+
## How to Use
|
| 48 |
+
|
| 49 |
+
### Loading the Model
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
from transformers import AutoModel
|
| 53 |
+
model = AutoModel.from_pretrained("your-username/gatekeeper-cervix-detector")
|
best_weights_20260504_083526.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c187d2e606081f98b12c7d43f36da3887a47bd315d09af4faeb61caf836b0d0
|
| 3 |
+
size 4779640
|
final_model_20260504_083526.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61e8c24e7143ced847289dd09fdb08d83dd6c3d67fa820038d004aa03efcbdb2
|
| 3 |
+
size 4779640
|
final_weights_20260504_083526.weights.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:400a47c401327dace76ebec79fbaeab5f210ae253fb6904dfd7b11216f7628d5
|
| 3 |
+
size 4815376
|
gatekeeper_annotations (1).json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gatekeeper_metadata.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dataset_name": "Gatekeeper Binary Dataset (Preprocessed)",
|
| 3 |
+
"purpose": "Binary gatekeeper for cervix detection before MedSigLip",
|
| 4 |
+
"original_image_size": "448x448",
|
| 5 |
+
"preprocessed_image_size": "224x224",
|
| 6 |
+
"normalization": "[-1, 1] with mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]",
|
| 7 |
+
"total_samples": 11547,
|
| 8 |
+
"classes": {
|
| 9 |
+
"cervix": {
|
| 10 |
+
"label": 1,
|
| 11 |
+
"count": 5543
|
| 12 |
+
},
|
| 13 |
+
"not_cervix": {
|
| 14 |
+
"label": 0,
|
| 15 |
+
"count": 6004
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"split": {
|
| 19 |
+
"train": "70%",
|
| 20 |
+
"validation": "15%",
|
| 21 |
+
"test": "15%"
|
| 22 |
+
},
|
| 23 |
+
"stratified": true,
|
| 24 |
+
"balance_ratio": "0.923",
|
| 25 |
+
"model": "MobileNetV3-Small",
|
| 26 |
+
"threshold": 0.70,
|
| 27 |
+
"input_shape": [224, 224, 3],
|
| 28 |
+
"note": "Images have been resized to 224x224 and normalized to [-1, 1]. This file describes the version used for training the gatekeeper model."
|
| 29 |
+
}
|