Alex Rudaev commited on
Commit
0f0947c
Β·
verified Β·
1 Parent(s): 08c8aa7

Replace Mermaid code blocks with rendered PNG diagrams

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +101 -161
  3. arch_scratch.png +0 -0
  4. pipeline_training.png +3 -0
.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,161 +1,101 @@
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-ResNet
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"] --> STEM["Stem
30
- 7Γ—7 Conv Β· BN Β· ReLU
31
- 3β†’64ch Β· MaxPool Γ·2"]
32
- STEM --> S1["Stage 1
33
- 3Γ— SE-ResBlock
34
- 64ch"]
35
- S1 --> S2["Stage 2 ↓½
36
- 4Γ— SE-ResBlock
37
- 128ch"]
38
- S2 --> S3["Stage 3 ↓½
39
- 6Γ— SE-ResBlock
40
- 256ch"]
41
- S3 --> S4["Stage 4 ↓½
42
- 3Γ— SE-ResBlock
43
- 512ch"]
44
- S4 --> GAP["Global Avg Pool
45
- Dropout(0.5)
46
- 512-dim"]
47
- GAP --> MLH["Multilabel Head
48
- Linear 512β†’14
49
- sigmoid Β· 14 pathologies"]
50
- GAP --> BH["Binary Head
51
- Linear 512β†’1
52
- sigmoid Β· Normal/Abnormal"]
53
- style MLH fill:#2e7d32,color:#fff
54
- style BH fill:#1565c0,color:#fff
55
- style IN fill:#37474f,color:#fff
56
- ```
57
-
58
- ## Training Pipeline
59
-
60
- ```mermaid
61
- flowchart TD
62
- DS[("πŸ—„οΈ HlexNC/chest-xray-14
63
- 112,120 chest X-ray images
64
- 36 parquet shards Β· ~4.7 GB")] -->|snapshot_download| PREP["πŸ“‚ data/images/ Β· data/labels.csv
65
- train 78,468 Β· val 11,210 Β· test 22,442"]
66
- PREP --> AUG["Augmentation Pipeline
67
- HFlip Β· RotateΒ±15Β° Β· RandomAffine
68
- ColorJitter Β· GaussianBlur Β· RandomErasing
69
- ImageNet normalize ⟨mean=[0.485,0.456,0.406]⟩"]
70
- AUG --> FWD["⚑ Model Forward Pass
71
- torch.cuda.amp.autocast Β· fp16"]
72
- FWD --> ML["multilabel_logits BΓ—14
73
- WeightedBCE + pos_weight
74
- 14 pathology classes"]
75
- FWD --> BIN["binary_logits BΓ—1
76
- BCE loss
77
- Normal vs. Abnormal"]
78
- ML --> LOSS["Combined Loss
79
- 1.0 Γ— multilabel + 0.5 Γ— binary"]
80
- BIN --> LOSS
81
- LOSS --> BACK["Backward Β· Grad Clip 1.0
82
- Gradient Accumulation Γ—4
83
- effective batch = 128"]
84
- BACK --> OPT["AdamW step Β· CosineAnnealingLR
85
- early stop patience = 15"]
86
- OPT -->|"↑ val macro AUC-ROC"| BEST["πŸ’Ύ Best Checkpoint
87
- model_state + best_val_metrics + config"]
88
- BEST -->|upload_model_artifacts| HUB["πŸ€— HF Hub
89
- checkpoint Β· history.json Β· model card"]
90
- ```
91
-
92
- ## Training Metrics
93
-
94
- - Best validation macro AUC-ROC: `0.7976`
95
- - Best validation binary AUC-ROC: `0.7554`
96
- - Best validation binary F1: `0.6295`
97
- - Best checkpoint epoch: `65`
98
-
99
-
100
- ## Per-Class AUC-ROC at Best Epoch
101
-
102
- | Pathology | AUC-ROC | Visual |
103
- |----------------------|----------|---------------|
104
- | Atelectasis | `0.7842` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
105
- | Cardiomegaly | `0.8929` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
106
- | Effusion | `0.8602` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
107
- | Infiltration | `0.6903` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
108
- | Mass | `0.8168` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
109
- | Nodule | `0.6634` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
110
- | Pneumonia | `0.6807` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
111
- | Pneumothorax | `0.8208` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
112
- | Consolidation | `0.8184` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
113
- | Edema | `0.9103` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
114
- | Emphysema | `0.8355` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
115
- | Fibrosis | `0.7604` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
116
- | Pleural_Thickening | `0.7702` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
117
- | Hernia | `0.8619` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
118
-
119
- ## Training Configuration
120
-
121
- - Repository: `HlexNC/chexvision-scratch`
122
- - Dataset: [HlexNC/chest-xray-14](https://huggingface.co/datasets/HlexNC/chest-xray-14) Β· revision `c4e9a86b`
123
- - Architecture: Custom residual CNN with Squeeze-Excitation channel attention (depth [3, 4, 6, 3]) trained from scratch with shared features and dual classification heads.
124
- - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
125
- - Batch size: `32` Γ— grad_accum `4` = **effective batch `128`**
126
- - AMP (fp16): `enabled`
127
- - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
128
- - Epochs configured: `100` Β· Early stop patience: `15`
129
-
130
- ## Intended Use
131
-
132
- This model is intended for research and educational work on automated chest X-ray pathology detection.
133
- It outputs two predictions per image:
134
- 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
135
- 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
136
-
137
- ## Limitations
138
-
139
- - Not validated for clinical use. Predictions must not substitute professional medical judgment.
140
- - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
141
- - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
142
- that differ from the NIH training distribution.
143
- - Reported AUC metrics are on the validation split, not the held-out test set.
144
-
145
- ## CheXNet Benchmark Context
146
-
147
- CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
148
- classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
149
- CheXVision-DenseNet matches this benchmark. See the
150
- [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
151
-
152
- ## Citation
153
-
154
- ```bibtex
155
- @misc{chexvision2026,
156
- title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
157
- author={BIG D(ATA) Team},
158
- year={2026},
159
- howpublished={\url{https://huggingface.co/HlexNC/chexvision-scratch}}
160
- }
161
- ```
 
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-ResNet
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
+ ![SE-ResNet Architecture](arch_scratch.png)
27
+
28
+ ## Training Pipeline
29
+
30
+ ![Training Pipeline](pipeline_training.png)
31
+
32
+ ## Training Metrics
33
+
34
+ - Best validation macro AUC-ROC: `0.7976`
35
+ - Best validation binary AUC-ROC: `0.7554`
36
+ - Best validation binary F1: `0.6295`
37
+ - Best checkpoint epoch: `65`
38
+
39
+
40
+ ## Per-Class AUC-ROC at Best Epoch
41
+
42
+ | Pathology | AUC-ROC | Visual |
43
+ |----------------------|----------|---------------|
44
+ | Atelectasis | `0.7842` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
45
+ | Cardiomegaly | `0.8929` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
46
+ | Effusion | `0.8602` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
47
+ | Infiltration | `0.6903` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
48
+ | Mass | `0.8168` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
49
+ | Nodule | `0.6634` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
50
+ | Pneumonia | `0.6807` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘` |
51
+ | Pneumothorax | `0.8208` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
52
+ | Consolidation | `0.8184` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
53
+ | Edema | `0.9103` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
54
+ | Emphysema | `0.8355` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
55
+ | Fibrosis | `0.7604` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
56
+ | Pleural_Thickening | `0.7702` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘` |
57
+ | Hernia | `0.8619` | `β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘` |
58
+
59
+ ## Training Configuration
60
+
61
+ - Repository: `HlexNC/chexvision-scratch`
62
+ - Dataset: [HlexNC/chest-xray-14](https://huggingface.co/datasets/HlexNC/chest-xray-14) Β· revision `c4e9a86b`
63
+ - Architecture: Custom residual CNN with Squeeze-Excitation channel attention (depth [3, 4, 6, 3]) trained from scratch with shared features and dual classification heads.
64
+ - Platform: Kaggle GPU kernel (NVIDIA T4 / P100)
65
+ - Batch size: `32` Γ— grad_accum `4` = **effective batch `128`**
66
+ - AMP (fp16): `enabled`
67
+ - Optimizer: AdamW Β· Scheduler: CosineAnnealingLR
68
+ - Epochs configured: `100` Β· Early stop patience: `15`
69
+
70
+ ## Intended Use
71
+
72
+ This model is intended for research and educational work on automated chest X-ray pathology detection.
73
+ It outputs two predictions per image:
74
+ 1. **Multi-label scores** β€” independent sigmoid probability for each of 14 NIH pathologies
75
+ 2. **Binary score** β€” sigmoid probability of any abnormality (Normal vs. Abnormal)
76
+
77
+ ## Limitations
78
+
79
+ - Not validated for clinical use. Predictions must not substitute professional medical judgment.
80
+ - Trained on NIH Chest X-ray14, which contains noisy radiologist annotations (patient-level labels, not lesion-level).
81
+ - Performance degrades on images from equipment, patient populations, or preprocessing pipelines
82
+ that differ from the NIH training distribution.
83
+ - Reported AUC metrics are on the validation split, not the held-out test set.
84
+
85
+ ## CheXNet Benchmark Context
86
+
87
+ CheXNet (Rajpurkar et al., 2017) β€” the seminal paper establishing DenseNet-121 for chest X-ray
88
+ classification β€” reported **0.841 macro AUC-ROC** on a comparable split of this dataset.
89
+ CheXVision-DenseNet matches this benchmark. See the
90
+ [CheXVision demo](https://huggingface.co/spaces/HlexNC/chexvision-demo) for live inference.
91
+
92
+ ## Citation
93
+
94
+ ```bibtex
95
+ @misc{chexvision2026,
96
+ title={CheXVision: Dual-Task Chest X-ray Classification with Custom CNN and DenseNet-121},
97
+ author={BIG D(ATA) Team},
98
+ year={2026},
99
+ howpublished={\url{https://huggingface.co/HlexNC/chexvision-scratch}}
100
+ }
101
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
arch_scratch.png ADDED
pipeline_training.png ADDED

Git LFS Details

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