Alex Rudaev commited on
Commit
f1bc569
Β·
verified Β·
1 Parent(s): ddeab2a

Style diagram images with centred HTML + width constraints

Browse files
Files changed (3) hide show
  1. README.md +111 -167
  2. arch_densenet.png +0 -0
  3. pipeline_training.png +2 -2
README.md CHANGED
@@ -1,167 +1,111 @@
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-320
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 images Β· 36 shards Β· ~4.7 GB")]
74
- DS -->|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
- AUG --> FWD["⚑ Model Forward Pass
80
- torch.cuda.amp.autocast Β· fp16"]
81
- FWD --> ML["multilabel_logits BΓ—14
82
- WeightedBCE + pos_weight Β· 14 classes"]
83
- FWD --> BIN["binary_logits BΓ—1
84
- BCE Β· Normal vs. Abnormal"]
85
- ML --> LOSS["Combined Loss
86
- 1.0 Γ— multilabel + 0.5 Γ— binary"]
87
- BIN --> LOSS
88
- LOSS --> BACK["Backward Β· Grad Clip 1.0
89
- Gradient Accumulation Γ—4 Β· eff. batch 128"]
90
- BACK --> OPT["AdamW Β· CosineAnnealingLR
91
- early stop patience = 15"]
92
- OPT -->|"↑ best val AUC-ROC"| BEST["πŸ’Ύ Best Checkpoint
93
- model_state Β· best_val_metrics Β· config"]
94
- BEST -->|upload_model_artifacts| HUB["πŸ€— HF Hub
95
- checkpoint Β· history.json Β· model card"]
96
- ```
97
-
98
- ## Training Metrics
99
-
100
- - Best validation macro AUC-ROC: `0.8459`
101
- - Best validation binary AUC-ROC: `0.7867`
102
- - Best validation binary F1: `0.6736`
103
- - Best checkpoint epoch: `18`
104
-
105
-
106
- ## Per-Class AUC-ROC at Best Epoch
107
-
108
- | Pathology | AUC-ROC | Visual |
109
- |----------------------|----------|---------------|
110
- | Atelectasis | `0.8334` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
111
- | Cardiomegaly | `0.9010` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
112
- | Effusion | `0.8873` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
113
- | Infiltration | `0.7133` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
114
- | Mass | `0.8756` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
115
- | Nodule | `0.8084` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
116
- | Pneumonia | `0.7397` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
117
- | Pneumothorax | `0.8705` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
118
- | Consolidation | `0.8063` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
119
- | Edema | `0.9255` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
120
- | Emphysema | `0.9107` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
121
- | Fibrosis | `0.8085` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
122
- | Pleural_Thickening | `0.8377` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
123
- | Hernia | `0.9242` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
124
-
125
- ## Training Configuration
126
-
127
- - Repository: `HlexNC/chexvision-densenet`
128
- - Dataset: [HlexNC/chest-xray-14-320](https://huggingface.co/datasets/HlexNC/chest-xray-14-320) Β· revision `44443e6ee968b3c6094b63f14a27698c40b50680`
129
- - Architecture: DenseNet-121 transfer learning with a shared feature layer and dual classification heads.
130
- - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
131
- - Batch size: `24` Γ— grad_accum `4` = **effective batch `96`**
132
- - AMP (fp16): `enabled`
133
- - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
134
- - Epochs configured: `60` Β· Early stop patience: `15`
135
-
136
- ## Intended Use
137
-
138
- This model is intended for research and educational work on automated chest X-ray pathology detection.
139
- It outputs two predictions per image:
140
- 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
141
- 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
142
-
143
- ## Limitations
144
-
145
- - Not validated for clinical use. Predictions must not substitute professional medical judgment.
146
- - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
147
- - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
148
- that differ from the NIH training distribution.
149
- - Reported AUC metrics are on the validation split, not the held-out test set.
150
-
151
- ## CheXNet Benchmark Context
152
-
153
- CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
154
- classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
155
- CheXVision-DenseNet matches this benchmark. See the
156
- [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
157
-
158
- ## Citation
159
-
160
- ```bibtex
161
- @misc{chexvision2026,
162
- title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
163
- author={BIG D(ATA) Team},
164
- year={2026},
165
- howpublished={\url{https://huggingface.co/HlexNC/chexvision-densenet}}
166
- }
167
- ```
 
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-320
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
+ <p align="center">
27
+ <img src="https://huggingface.co/HlexNC/chexvision-densenet/resolve/main/arch_densenet.png" width="88%" alt="DenseNet Architecture"/>
28
+ </p>
29
+
30
+ ## Fine-Tuning Strategy
31
+
32
+ <p align="center">
33
+ <img src="https://huggingface.co/HlexNC/chexvision-densenet/resolve/main/finetuning_densenet.png" width="62%" alt="Fine-Tuning Strategy"/>
34
+ </p>
35
+
36
+ ## Training Pipeline
37
+
38
+ <p align="center">
39
+ <img src="https://huggingface.co/HlexNC/chexvision-densenet/resolve/main/pipeline_training.png" width="42%" alt="Training Pipeline"/>
40
+ </p>
41
+
42
+ ## Training Metrics
43
+
44
+ - Best validation macro AUC-ROC: `0.8459`
45
+ - Best validation binary AUC-ROC: `0.7867`
46
+ - Best validation binary F1: `0.6736`
47
+ - Best checkpoint epoch: `18`
48
+
49
+
50
+ ## Per-Class AUC-ROC at Best Epoch
51
+
52
+ | Pathology | AUC-ROC | Visual |
53
+ |----------------------|----------|---------------|
54
+ | Atelectasis | `0.8334` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
55
+ | Cardiomegaly | `0.9010` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
56
+ | Effusion | `0.8873` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
57
+ | Infiltration | `0.7133` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
58
+ | Mass | `0.8756` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
59
+ | Nodule | `0.8084` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
60
+ | Pneumonia | `0.7397` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
61
+ | Pneumothorax | `0.8705` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
62
+ | Consolidation | `0.8063` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
63
+ | Edema | `0.9255` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
64
+ | Emphysema | `0.9107` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
65
+ | Fibrosis | `0.8085` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
66
+ | Pleural_Thickening | `0.8377` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
67
+ | Hernia | `0.9242` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
68
+
69
+ ## Training Configuration
70
+
71
+ - Repository: `HlexNC/chexvision-densenet`
72
+ - Dataset: [HlexNC/chest-xray-14-320](https://huggingface.co/datasets/HlexNC/chest-xray-14-320) Β· revision `44443e6ee968b3c6094b63f14a27698c40b50680`
73
+ - Architecture: DenseNet-121 transfer learning with a shared feature layer and dual classification heads.
74
+ - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
75
+ - Batch size: `24` Γ— grad_accum `4` = **effective batch `96`**
76
+ - AMP (fp16): `enabled`
77
+ - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
78
+ - Epochs configured: `60` Β· Early stop patience: `15`
79
+
80
+ ## Intended Use
81
+
82
+ This model is intended for research and educational work on automated chest X-ray pathology detection.
83
+ It outputs two predictions per image:
84
+ 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
85
+ 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
86
+
87
+ ## Limitations
88
+
89
+ - Not validated for clinical use. Predictions must not substitute professional medical judgment.
90
+ - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
91
+ - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
92
+ that differ from the NIH training distribution.
93
+ - Reported AUC metrics are on the validation split, not the held-out test set.
94
+
95
+ ## CheXNet Benchmark Context
96
+
97
+ CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
98
+ classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
99
+ CheXVision-DenseNet matches this benchmark. See the
100
+ [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
101
+
102
+ ## Citation
103
+
104
+ ```bibtex
105
+ @misc{chexvision2026,
106
+ title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
107
+ author={BIG D(ATA) Team},
108
+ year={2026},
109
+ howpublished={\url{https://huggingface.co/HlexNC/chexvision-densenet}}
110
+ }
111
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
arch_densenet.png CHANGED
pipeline_training.png CHANGED

Git LFS Details

  • SHA256: 83f0fb09d19d37d9253a57408f2a7b62a381f30d2974aa4537088df9b7145858
  • Pointer size: 131 Bytes
  • Size of remote file: 213 kB

Git LFS Details

  • SHA256: aa57d9e41da95b120757b8cff101be9c6747abe093db3bb00552bfa17c955aa0
  • Pointer size: 131 Bytes
  • Size of remote file: 216 kB