Delete readme.md
Browse files
readme.md
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
# Lucario-K17/biomedclip_radiology_diagnosis
|
2 |
-
|
3 |
-
**Multi-label medical image diagnosis model** fine-tuned on chest X-rays to predict 14 common pathologies.
|
4 |
-
Built on top of [BioViL-CLIP](https://github.com/microsoft/biovil), pretrained by Microsoft.
|
5 |
-
|
6 |
-
---
|
7 |
-
|
8 |
-
## Overview
|
9 |
-
|
10 |
-
`Lucario-K17/biomedclip_radiology_diagnosis` predicts 14 key thoracic disease labels from chest X-rays.
|
11 |
-
It is fine-tuned from Microsoft’s **BioViL-CLIP**, using paired image-report data, and achieves **>90% accuracy across all labels**.
|
12 |
-
|
13 |
-
- Based on Microsoft’s pretrained **BioViL-CLIP (ViT-B/32 + PubMedBERT)**
|
14 |
-
- Supports **multi-label** predictions
|
15 |
-
- Optimized for **chest radiology**
|
16 |
-
- Evaluated on NIH ChestX-ray14 and MIMIC-CXR subsets
|
17 |
-
|
18 |
-
---
|
19 |
-
|
20 |
-
## Disease Labels Predicted (14)
|
21 |
-
|
22 |
-
```text
|
23 |
-
['Atelectasis', 'Cardiomegaly', 'Effusion', 'Infiltration', 'Mass',
|
24 |
-
'Nodule', 'Pneumonia', 'Pneumothorax', 'Consolidation', 'Edema',
|
25 |
-
'Emphysema', 'Fibrosis', 'Pleural Thickening', 'Hernia']
|
26 |
-
```
|
27 |
-
|
28 |
-
---
|
29 |
-
|
30 |
-
## Setup Instructions
|
31 |
-
|
32 |
-
```bash
|
33 |
-
pip install torch torchvision transformers huggingface_hub pillow
|
34 |
-
```
|
35 |
-
|
36 |
-
---
|
37 |
-
|
38 |
-
## Inference Example
|
39 |
-
|
40 |
-
```python
|
41 |
-
import torch
|
42 |
-
from transformers import AutoProcessor, AutoModelForImageClassification
|
43 |
-
from huggingface_hub import hf_hub_download
|
44 |
-
from PIL import Image
|
45 |
-
|
46 |
-
# Load model
|
47 |
-
model = AutoModelForImageClassification.from_pretrained("Lucario-K17/biomedclip_radiology_diagnosis")
|
48 |
-
processor = AutoProcessor.from_pretrained("Lucario-K17/biomedclip_radiology_diagnosis")
|
49 |
-
|
50 |
-
# Load and preprocess image
|
51 |
-
img = Image.open("test_image.png").convert("RGB")
|
52 |
-
inputs = processor(images=img, return_tensors="pt")
|
53 |
-
|
54 |
-
# Predict
|
55 |
-
with torch.no_grad():
|
56 |
-
logits = model(**inputs).logits
|
57 |
-
probs = torch.sigmoid(logits)
|
58 |
-
|
59 |
-
# Threshold and print predictions
|
60 |
-
labels = model.config.id2label.values()
|
61 |
-
predictions = {label: float(prob) for label, prob in zip(labels, probs[0])}
|
62 |
-
for label, score in sorted(predictions.items(), key=lambda x: x[1], reverse=True):
|
63 |
-
print(f"{label}: {score:.2%}")
|
64 |
-
```
|
65 |
-
|
66 |
-
---
|
67 |
-
|
68 |
-
## Fine-tuning Details
|
69 |
-
|
70 |
-
| Param | Value |
|
71 |
-
|--------------------|--------------------|
|
72 |
-
| Base Model | BioViL-CLIP (ViT-B/32 + PubMedBERT) |
|
73 |
-
| Epochs | 10 |
|
74 |
-
| Optimizer | AdamW |
|
75 |
-
| Learning Rate | 2e-5 |
|
76 |
-
| Batch Size | 32 |
|
77 |
-
| Loss Function | BCEWithLogitsLoss |
|
78 |
-
| Dataset Used | NIH ChestX-ray14 + MIMIC-CXR pairs |
|
79 |
-
|
80 |
-
---
|
81 |
-
|
82 |
-
## Evaluation Metrics
|
83 |
-
|
84 |
-
Based on the Microsoft BioViL-CLIP baseline and fine-tuned results:
|
85 |
-
|
86 |
-
| Metric | Value |
|
87 |
-
|------------------|-----------|
|
88 |
-
| Mean Accuracy | > 90.0% |
|
89 |
-
| Macro AUC | 0.915 |
|
90 |
-
| Macro F1 | 0.901 |
|
91 |
-
| Average Precision| 0.912 |
|
92 |
-
|
93 |
-
Each of the 14 labels scored **>90% accuracy**, verified on balanced validation sets.
|
94 |
-
|
95 |
-
---
|
96 |
-
|
97 |
-
## Citation (MIT-GA Style)
|
98 |
-
|
99 |
-
Please cite or link this model if used in your project or publication:
|
100 |
-
|
101 |
-
```bibtex
|
102 |
-
@misc{lucario2025biomedclip,
|
103 |
-
title = {BioMedCLIP Chest Radiology Diagnosis Model},
|
104 |
-
author = {Kishore Murugan},
|
105 |
-
year = {2025},
|
106 |
-
publisher = {Hugging Face},
|
107 |
-
howpublished = {\url{https://huggingface.co/Lucario-K17/biomedclip_radiology_diagnosis}},
|
108 |
-
note = {Licensed under MIT-GA; link or citation required for use}
|
109 |
-
}
|
110 |
-
```
|
111 |
-
|
112 |
-
---
|
113 |
-
|
114 |
-
## License
|
115 |
-
|
116 |
-
```
|
117 |
-
MIT-GA License
|
118 |
-
|
119 |
-
You are free to use, modify, and distribute this model for any purpose,
|
120 |
-
including commercial, provided that you give proper credit by citing the model
|
121 |
-
or linking to: https://huggingface.co/Lucario-K17/biomedclip_radiology_diagnosis
|
122 |
-
|
123 |
-
The software is provided "AS IS", without warranty of any kind.
|
124 |
-
```
|
125 |
-
|
126 |
-
---
|
127 |
-
|
128 |
-
## 🙏 Acknowledgements
|
129 |
-
|
130 |
-
- Pretrained Base: [Microsoft BioViL-CLIP](https://github.com/microsoft/biovil)
|
131 |
-
- Transformer models: Hugging Face 🤗
|
132 |
-
- Datasets:
|
133 |
-
- NIH ChestX-ray14
|
134 |
-
- MIMIC-CXR (image-report pairs)
|
135 |
-
|
136 |
-
---
|
137 |
-
|
138 |
-
## Hugging Face Model Page
|
139 |
-
|
140 |
-
👉 [Lucario-K17/biomedclip_radiology_diagnosis](https://huggingface.co/Lucario-K17/biomedclip_radiology_diagnosis)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|