Update README.md
Browse files
README.md
CHANGED
|
@@ -10,198 +10,193 @@ base_model:
|
|
| 10 |
pipeline_tag: image-classification
|
| 11 |
tags:
|
| 12 |
- medical
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
-
# Model Card for Model ID
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
This
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
### Model Description
|
| 23 |
-
|
| 24 |
-
<!-- Provide a longer summary of what this model is. -->
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
- **Developed by:** [More Information Needed]
|
| 29 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 30 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 31 |
-
- **Model type:** [More Information Needed]
|
| 32 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 33 |
-
- **License:** [More Information Needed]
|
| 34 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 35 |
-
|
| 36 |
-
### Model Sources [optional]
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
- **
|
| 41 |
-
- **
|
| 42 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
## Uses
|
| 45 |
|
| 46 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
| 47 |
-
|
| 48 |
### Direct Use
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
### Downstream Use [optional]
|
| 55 |
-
|
| 56 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
| 57 |
-
|
| 58 |
-
[More Information Needed]
|
| 59 |
|
| 60 |
### Out-of-Scope Use
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
[More Information Needed]
|
| 65 |
|
| 66 |
## Bias, Risks, and Limitations
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
### Recommendations
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
-
|
| 75 |
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
## Training Details
|
| 85 |
|
| 86 |
### Training Data
|
| 87 |
|
| 88 |
-
|
|
|
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
|
| 92 |
### Training Procedure
|
| 93 |
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
| 99 |
|
|
|
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
#### Speeds, Sizes, Times [optional]
|
| 106 |
-
|
| 107 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 108 |
-
|
| 109 |
-
[More Information Needed]
|
| 110 |
|
| 111 |
## Evaluation
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
### Testing Data, Factors & Metrics
|
| 116 |
-
|
| 117 |
-
#### Testing Data
|
| 118 |
|
| 119 |
-
|
| 120 |
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
####
|
| 130 |
|
| 131 |
-
|
|
|
|
| 132 |
|
| 133 |
-
|
| 134 |
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
#### Summary
|
| 140 |
|
|
|
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 146 |
-
|
| 147 |
-
[More Information Needed]
|
| 148 |
-
|
| 149 |
-
## Environmental Impact
|
| 150 |
-
|
| 151 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 152 |
-
|
| 153 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 154 |
-
|
| 155 |
-
- **Hardware Type:** [More Information Needed]
|
| 156 |
-
- **Hours used:** [More Information Needed]
|
| 157 |
-
- **Cloud Provider:** [More Information Needed]
|
| 158 |
-
- **Compute Region:** [More Information Needed]
|
| 159 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 160 |
|
| 161 |
-
## Technical Specifications
|
| 162 |
|
| 163 |
-
### Model Architecture
|
| 164 |
|
| 165 |
-
|
|
|
|
| 166 |
|
| 167 |
### Compute Infrastructure
|
| 168 |
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
#### Hardware
|
| 172 |
-
|
| 173 |
-
[More Information Needed]
|
| 174 |
-
|
| 175 |
-
#### Software
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
## Citation [optional]
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
**BibTeX:**
|
| 184 |
-
|
| 185 |
-
[More Information Needed]
|
| 186 |
-
|
| 187 |
-
**APA:**
|
| 188 |
-
|
| 189 |
-
[More Information Needed]
|
| 190 |
-
|
| 191 |
-
## Glossary [optional]
|
| 192 |
-
|
| 193 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## More Information [optional]
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
| 200 |
-
|
| 201 |
-
## Model Card Authors [optional]
|
| 202 |
|
| 203 |
-
|
| 204 |
|
| 205 |
-
|
| 206 |
|
| 207 |
-
|
|
|
|
| 10 |
pipeline_tag: image-classification
|
| 11 |
tags:
|
| 12 |
- medical
|
| 13 |
+
- cervical-cancer
|
| 14 |
+
- histopathology
|
| 15 |
+
- undersampling
|
| 16 |
---
|
|
|
|
| 17 |
|
| 18 |
+
# Model Card: EfficientNet-B7 for Cervical Cancer Image Classification
|
| 19 |
|
| 20 |
+
This model fine-tunes **EfficientNet-B7** for the task of binary cervical cancer image classification (Negative vs. Positive). It was trained using undersampling to handle class imbalance.
|
| 21 |
|
| 22 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
## Model Details
|
| 25 |
|
| 26 |
+
- **Developed by:** Beijuka / Pathogen Lab
|
| 27 |
+
- **Funded by:** STI
|
| 28 |
+
- **Model type:** Convolutional Neural Network (CNN)
|
| 29 |
+
- **Input type:** Histopathology images (600x600, RGB)
|
| 30 |
+
- **Output type:** Binary classification (Negative, Positive)
|
| 31 |
+
- **License:** MIT
|
| 32 |
+
- **Finetuned from:** `google/efficientnet-b7`
|
| 33 |
+
|
| 34 |
+
<!-- ### Model Sources
|
| 35 |
+
- **Repository:** [Your HF Repo URL]
|
| 36 |
+
- **Paper [optional]:** [If you want to link e.g., EfficientNet or related research]
|
| 37 |
+
- **Demo [optional]:** [Streamlit/Gradio app if you plan one]
|
| 38 |
+
-->
|
| 39 |
+
---
|
| 40 |
|
| 41 |
## Uses
|
| 42 |
|
|
|
|
|
|
|
| 43 |
### Direct Use
|
| 44 |
+
- classification of cervical cancer images into Negative vs Positive cases.
|
| 45 |
|
| 46 |
+
### Downstream Use
|
| 47 |
+
- Could be integrated into diagnostic support pipelines.
|
| 48 |
+
- Adapted for related medical imaging classification tasks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
### Out-of-Scope Use
|
| 51 |
+
- **Not** a replacement for professional medical diagnosis.
|
| 52 |
+
- Should not be deployed clinically without regulatory approval.
|
| 53 |
+
- Not suitable for non-cervical images.
|
| 54 |
|
| 55 |
+
---
|
|
|
|
|
|
|
| 56 |
|
| 57 |
## Bias, Risks, and Limitations
|
| 58 |
|
| 59 |
+
- The dataset was undersampled → may affect generalizability.
|
| 60 |
+
- Model performance varies by threshold (see below).
|
| 61 |
+
- Limited dataset size (19 test images) means results may not generalize.
|
| 62 |
+
- Potential domain shift if applied to different staining/preparation protocols.
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
+
- Validate on larger, more diverse datasets.
|
| 66 |
+
- Carefully calibrate decision threshold depending on application (screening vs confirmatory).
|
| 67 |
+
- Use alongside clinical expertise, not as a standalone tool.
|
| 68 |
|
| 69 |
+
---
|
| 70 |
|
| 71 |
+
## How to Get Started
|
| 72 |
|
| 73 |
+
```python
|
| 74 |
+
from huggingface_hub import hf_hub_download
|
| 75 |
+
from tensorflow import keras
|
| 76 |
|
| 77 |
+
model_path = hf_hub_download(
|
| 78 |
+
"Beijuka/cancer-efficientnetb7-undersampling",
|
| 79 |
+
"cancer_efficientnetB7_undersampling.keras"
|
| 80 |
+
)
|
| 81 |
+
model = keras.models.load_model(model_path)
|
| 82 |
+
````
|
| 83 |
|
| 84 |
+
---
|
| 85 |
|
| 86 |
## Training Details
|
| 87 |
|
| 88 |
### Training Data
|
| 89 |
|
| 90 |
+
* Histopathology images of cervical cancer (size 600x600, RGB).
|
| 91 |
+
* Class imbalance addressed via **undersampling**:
|
| 92 |
|
| 93 |
+
* Positive: 84 images
|
| 94 |
+
* Negative: 100 images
|
| 95 |
+
* Preprocessing: Normalization + resizing.
|
| 96 |
|
| 97 |
### Training Procedure
|
| 98 |
|
| 99 |
+
* Optimizer: Adam
|
| 100 |
+
* Loss: Binary Crossentropy
|
| 101 |
+
* Batch size: 8
|
| 102 |
+
* Learning rate: 1e-3 (initial), 1e-5 (fine-tuning)
|
| 103 |
+
* Epochs: 50 (initial), 20 (fine-tuning)
|
| 104 |
+
* EarlyStopping and ModelCheckpoint callbacks used.
|
| 105 |
|
| 106 |
+
### Data Splits
|
| 107 |
|
| 108 |
+
* **Training:** 128 images (70 Negative, 29 Positive Post-stained, 29 Positive Pre-stained)
|
| 109 |
+
* **Validation:** 37 images (20 Negative, 8 Positive Post-stained, 9 Positive Pre-stained)
|
| 110 |
+
* **Test:** 19 images (10 Negative, 5 Positive Post-stained, 4 Positive Pre-stained)
|
| 111 |
|
| 112 |
+
### Hardware
|
| 113 |
|
| 114 |
+
* GPU: Tesla T4 (14GB)
|
| 115 |
+
* CUDA Version: 12.4
|
| 116 |
+
* Software: TensorFlow/Keras
|
| 117 |
|
| 118 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
## Evaluation
|
| 121 |
|
| 122 |
+
### Testing Data
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
+
* Independent test set: 19 images (10 Negative, 9 Positive)
|
| 125 |
|
| 126 |
+
### Metrics at Threshold 0.5
|
| 127 |
|
| 128 |
+
* **Accuracy:** 0.7368
|
| 129 |
+
* **Precision (Positive):** 0.8333
|
| 130 |
+
* **Recall (Positive):** 0.5556
|
| 131 |
+
* **F1-Score (Positive):** 0.6667
|
| 132 |
|
| 133 |
+
#### Confusion Matrix
|
| 134 |
|
| 135 |
+
```
|
| 136 |
+
[[9, 1],
|
| 137 |
+
[4, 5]]
|
| 138 |
+
```
|
| 139 |
|
| 140 |
+
#### Sensitivity / Specificity
|
| 141 |
|
| 142 |
+
* Negative: Sensitivity 0.90, Specificity 0.56
|
| 143 |
+
* Positive: Sensitivity 0.56, Specificity 0.90
|
| 144 |
|
| 145 |
+
### Threshold Analysis
|
| 146 |
|
| 147 |
+
* Best balance observed near 0.45–0.50
|
| 148 |
+
* Lower thresholds → higher recall, more false positives
|
| 149 |
+
* Higher thresholds (>0.65) → model collapses to predicting only one class
|
| 150 |
|
| 151 |
+
| Threshold | Accuracy | Precision | Recall | F1 |
|
| 152 |
+
| --------- | -------- | --------- | ------ | ------ |
|
| 153 |
+
| 0.00 | 0.4737 | 0.4737 | 1.0000 | 0.6429 |
|
| 154 |
+
| 0.05 | 0.4737 | 0.4737 | 1.0000 | 0.6429 |
|
| 155 |
+
| 0.10 | 0.5263 | 0.5000 | 1.0000 | 0.6667 |
|
| 156 |
+
| 0.15 | 0.5263 | 0.5000 | 0.8889 | 0.6400 |
|
| 157 |
+
| 0.20 | 0.6316 | 0.5714 | 0.8889 | 0.6957 |
|
| 158 |
+
| 0.25 | 0.6316 | 0.5833 | 0.7778 | 0.6667 |
|
| 159 |
+
| 0.30 | 0.6316 | 0.6250 | 0.5556 | 0.5882 |
|
| 160 |
+
| 0.35 | 0.6316 | 0.6250 | 0.5556 | 0.5882 |
|
| 161 |
+
| 0.40 | 0.6842 | 0.7143 | 0.5556 | 0.6250 |
|
| 162 |
+
| 0.45 | 0.7368 | 0.8333 | 0.5556 | 0.6667 |
|
| 163 |
+
| 0.50 | 0.7368 | 0.8333 | 0.5556 | 0.6667 |
|
| 164 |
+
| 0.55 | 0.6842 | 0.8000 | 0.4444 | 0.5714 |
|
| 165 |
+
| 0.60 | 0.6842 | 1.0000 | 0.3333 | 0.5000 |
|
| 166 |
+
| 0.65 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 167 |
+
| 0.70 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 168 |
+
| 0.75 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 169 |
+
| 0.80 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 170 |
+
| 0.85 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 171 |
+
| 0.90 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 172 |
+
| 0.95 | 0.5263 | 0.0000 | 0.0000 | 0.0000 |
|
| 173 |
|
|
|
|
| 174 |
|
| 175 |
+
### Comparison of performance on Pre vs Post-stained images
|
| 176 |
|
| 177 |
+
| Comparison | Accuracy | F1-Score |
|
| 178 |
+
| ------------------------------ | -------- | -------- |
|
| 179 |
+
| Pre-stained Prediction | 0.6087 | 0.2703 |
|
| 180 |
+
| Post-stained Prediction | 0.7474 | 0.3441 |
|
| 181 |
|
| 182 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
+
## Technical Specifications
|
| 185 |
|
| 186 |
+
### Model Architecture
|
| 187 |
|
| 188 |
+
* EfficientNet-B7 backbone
|
| 189 |
+
* Final Dense layer with sigmoid activation for binary classification
|
| 190 |
|
| 191 |
### Compute Infrastructure
|
| 192 |
|
| 193 |
+
* **Hardware:** Tesla T4 GPU
|
| 194 |
+
* **Software:** TensorFlow/Keras
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
+
## Environmental Impact
|
| 199 |
|
| 200 |
+
* **Hardware Type:** Tesla T4
|
| 201 |
|
| 202 |
+
---
|