Alex Rudaev commited on
Commit
ff17e39
Β·
verified Β·
1 Parent(s): 5225253

Replace Mermaid code blocks with rendered PNG diagrams

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
36
+ pipeline_training.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,171 +1,105 @@
1
- ---
2
- license: mit
3
- language:
4
- - en
5
- library_name: pytorch
6
- pipeline_tag: image-classification
7
- tags:
8
- - chexvision
9
- - medical-imaging
10
- - chest-xray
11
- - radiology
12
- - pytorch
13
- - multi-label-classification
14
- datasets:
15
- - HlexNC/chest-xray-14
16
- ---
17
-
18
- # CheXVision-DenseNet
19
-
20
- > **CheXVision** β€” Deep Learning & Big Data university project.
21
- > 14-class chest X-ray pathology detection + binary normal/abnormal classification
22
- > on the NIH Chest X-ray14 dataset (112,120 images).
23
-
24
- ## Architecture
25
-
26
- ```mermaid
27
- graph LR
28
- IN["Input
29
- 3 Γ— 224 Γ— 224"] --> BB["DenseNet-121 Backbone
30
- ImageNet pretrained
31
- Dense connectivity
32
- 7.9M parameters"]
33
- BB --> GAP2["Adaptive Avg Pool
34
- 1024-dim features"]
35
- GAP2 --> FL["Feature Layer
36
- Linear 1024β†’512
37
- ReLU Β· Dropout(0.3)"]
38
- FL --> MLH["Multilabel Head
39
- Linear 512β†’14
40
- sigmoid Β· 14 pathologies"]
41
- FL --> BH["Binary Head
42
- Linear 512β†’1
43
- sigmoid Β· Normal/Abnormal"]
44
- style MLH fill:#2e7d32,color:#fff
45
- style BH fill:#1565c0,color:#fff
46
- style IN fill:#37474f,color:#fff
47
- style BB fill:#6a1b9a,color:#fff
48
- ```
49
-
50
- ## Fine-Tuning Strategy
51
-
52
- ```mermaid
53
- graph LR
54
- P1["πŸ”’ Phase 1
55
- Epochs 1–5
56
- Backbone frozen
57
- Train heads only
58
- lr = 0.001"] -->|"Epoch 6
59
- unfreeze_backbone()"| P2["πŸ”“ Phase 2
60
- Epochs 6–60
61
- End-to-end fine-tuning
62
- All layers trainable
63
- lr = 0.0001"]
64
- style P1 fill:#e65100,color:#fff
65
- style P2 fill:#6a1b9a,color:#fff
66
- ```
67
-
68
- ## Training Pipeline
69
-
70
- ```mermaid
71
- flowchart TD
72
- DS[("πŸ—„οΈ HlexNC/chest-xray-14
73
- 112,120 chest X-ray images
74
- 36 parquet shards Β· ~4.7 GB")] -->|snapshot_download| PREP["πŸ“‚ data/images/ Β· data/labels.csv
75
- train 78,468 Β· val 11,210 Β· test 22,442"]
76
- PREP --> AUG["Augmentation Pipeline
77
- HFlip Β· RotateΒ±15Β° Β· RandomAffine
78
- ColorJitter Β· GaussianBlur Β· RandomErasing
79
- ImageNet normalize ⟨mean=[0.485,0.456,0.406]⟩"]
80
- AUG --> FWD["⚑ Model Forward Pass
81
- torch.cuda.amp.autocast Β· fp16"]
82
- FWD --> ML["multilabel_logits BΓ—14
83
- WeightedBCE + pos_weight
84
- 14 pathology classes"]
85
- FWD --> BIN["binary_logits BΓ—1
86
- BCE loss
87
- Normal vs. Abnormal"]
88
- ML --> LOSS["Combined Loss
89
- 1.0 Γ— multilabel + 0.5 Γ— binary"]
90
- BIN --> LOSS
91
- LOSS --> BACK["Backward Β· Grad Clip 1.0
92
- Gradient Accumulation Γ—4
93
- effective batch = 128"]
94
- BACK --> OPT["AdamW step Β· CosineAnnealingLR
95
- early stop patience = 15"]
96
- OPT -->|"↑ val macro AUC-ROC"| BEST["πŸ’Ύ Best Checkpoint
97
- model_state + best_val_metrics + config"]
98
- BEST -->|upload_model_artifacts| HUB["πŸ€— HF Hub
99
- checkpoint Β· history.json Β· model card"]
100
- ```
101
-
102
- ## Training Metrics
103
-
104
- - Best validation macro AUC-ROC: `0.8379`
105
- - Best validation binary AUC-ROC: `0.7831`
106
- - Best validation binary F1: `0.6680`
107
- - Best checkpoint epoch: `21`
108
-
109
-
110
- ## Per-Class AUC-ROC at Best Epoch
111
-
112
- | Pathology | AUC-ROC | Visual |
113
- |----------------------|----------|---------------|
114
- | Atelectasis | `0.8178` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
115
- | Cardiomegaly | `0.8996` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
116
- | Effusion | `0.8888` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
117
- | Infiltration | `0.7083` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
118
- | Mass | `0.8910` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
119
- | Nodule | `0.7837` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
120
- | Pneumonia | `0.7181` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
121
- | Pneumothorax | `0.8731` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
122
- | Consolidation | `0.8128` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
123
- | Edema | `0.8993` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
124
- | Emphysema | `0.8907` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
125
- | Fibrosis | `0.7994` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
126
- | Pleural_Thickening | `0.8311` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
127
- | Hernia | `0.9171` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
128
-
129
- ## Training Configuration
130
-
131
- - Repository: `HlexNC/chexvision-densenet`
132
- - Dataset: [HlexNC/chest-xray-14](https://huggingface.co/datasets/HlexNC/chest-xray-14) Β· revision `c4e9a86b`
133
- - Architecture: DenseNet-121 transfer learning with a shared feature layer and dual classification heads.
134
- - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
135
- - Batch size: `32` Γ— grad_accum `4` = **effective batch `128`**
136
- - AMP (fp16): `enabled`
137
- - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
138
- - Epochs configured: `60` Β· Early stop patience: `15`
139
-
140
- ## Intended Use
141
-
142
- This model is intended for research and educational work on automated chest X-ray pathology detection.
143
- It outputs two predictions per image:
144
- 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
145
- 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
146
-
147
- ## Limitations
148
-
149
- - Not validated for clinical use. Predictions must not substitute professional medical judgment.
150
- - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
151
- - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
152
- that differ from the NIH training distribution.
153
- - Reported AUC metrics are on the validation split, not the held-out test set.
154
-
155
- ## CheXNet Benchmark Context
156
-
157
- CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
158
- classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
159
- CheXVision-DenseNet matches this benchmark. See the
160
- [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
161
-
162
- ## Citation
163
-
164
- ```bibtex
165
- @misc{chexvision2026,
166
- title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
167
- author={BIG D(ATA) Team},
168
- year={2026},
169
- howpublished={\url{https://huggingface.co/HlexNC/chexvision-densenet}}
170
- }
171
- ```
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ library_name: pytorch
6
+ pipeline_tag: image-classification
7
+ tags:
8
+ - chexvision
9
+ - medical-imaging
10
+ - chest-xray
11
+ - radiology
12
+ - pytorch
13
+ - multi-label-classification
14
+ datasets:
15
+ - HlexNC/chest-xray-14
16
+ ---
17
+
18
+ # CheXVision-DenseNet
19
+
20
+ > **CheXVision** β€” Deep Learning & Big Data university project.
21
+ > 14-class chest X-ray pathology detection + binary normal/abnormal classification
22
+ > on the NIH Chest X-ray14 dataset (112,120 images).
23
+
24
+ ## Architecture
25
+
26
+ ![DenseNet Architecture](arch_densenet.png)
27
+
28
+ ## Fine-Tuning Strategy
29
+
30
+ ![Fine-Tuning Strategy](finetuning_densenet.png)
31
+
32
+ ## Training Pipeline
33
+
34
+ ![Training Pipeline](pipeline_training.png)
35
+
36
+ ## Training Metrics
37
+
38
+ - Best validation macro AUC-ROC: `0.8379`
39
+ - Best validation binary AUC-ROC: `0.7831`
40
+ - Best validation binary F1: `0.6680`
41
+ - Best checkpoint epoch: `21`
42
+
43
+
44
+ ## Per-Class AUC-ROC at Best Epoch
45
+
46
+ | Pathology | AUC-ROC | Visual |
47
+ |----------------------|----------|---------------|
48
+ | Atelectasis | `0.8178` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
49
+ | Cardiomegaly | `0.8996` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
50
+ | Effusion | `0.8888` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
51
+ | Infiltration | `0.7083` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
52
+ | Mass | `0.8910` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
53
+ | Nodule | `0.7837` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
54
+ | Pneumonia | `0.7181` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
55
+ | Pneumothorax | `0.8731` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
56
+ | Consolidation | `0.8128` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
57
+ | Edema | `0.8993` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
58
+ | Emphysema | `0.8907` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
59
+ | Fibrosis | `0.7994` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
60
+ | Pleural_Thickening | `0.8311` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
61
+ | Hernia | `0.9171` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
62
+
63
+ ## Training Configuration
64
+
65
+ - Repository: `HlexNC/chexvision-densenet`
66
+ - Dataset: [HlexNC/chest-xray-14](https://huggingface.co/datasets/HlexNC/chest-xray-14) Β· revision `c4e9a86b`
67
+ - Architecture: DenseNet-121 transfer learning with a shared feature layer and dual classification heads.
68
+ - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
69
+ - Batch size: `32` Γ— grad_accum `4` = **effective batch `128`**
70
+ - AMP (fp16): `enabled`
71
+ - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
72
+ - Epochs configured: `60` Β· Early stop patience: `15`
73
+
74
+ ## Intended Use
75
+
76
+ This model is intended for research and educational work on automated chest X-ray pathology detection.
77
+ It outputs two predictions per image:
78
+ 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
79
+ 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
80
+
81
+ ## Limitations
82
+
83
+ - Not validated for clinical use. Predictions must not substitute professional medical judgment.
84
+ - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
85
+ - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
86
+ that differ from the NIH training distribution.
87
+ - Reported AUC metrics are on the validation split, not the held-out test set.
88
+
89
+ ## CheXNet Benchmark Context
90
+
91
+ CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
92
+ classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
93
+ CheXVision-DenseNet matches this benchmark. See the
94
+ [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
95
+
96
+ ## Citation
97
+
98
+ ```bibtex
99
+ @misc{chexvision2026,
100
+ title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
101
+ author={BIG D(ATA) Team},
102
+ year={2026},
103
+ howpublished={\url{https://huggingface.co/HlexNC/chexvision-densenet}}
104
+ }
105
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
arch_densenet.png ADDED
finetuning_densenet.png ADDED
pipeline_training.png ADDED

Git LFS Details

  • SHA256: 129e4a0ce34f3846713ee25404f07d82b8c220a507d37c6845a248d548f626a7
  • Pointer size: 131 Bytes
  • Size of remote file: 108 kB