Initial release: compressed CheXNet + surgical correction artifacts
Browse files- .gitattributes +7 -0
- README.md +215 -0
- classifier_finetuned.pt +3 -0
- compressed_model.pt +3 -0
- figures/fig1_compression.pdf +0 -0
- figures/fig1_compression.png +0 -0
- figures/fig2_sparse_layers.pdf +0 -0
- figures/fig2_sparse_layers.png +3 -0
- figures/fig3_mutual_exclusivity.pdf +3 -0
- figures/fig3_mutual_exclusivity.png +3 -0
- figures/fig4_legitimacy.pdf +0 -0
- figures/fig4_legitimacy.png +0 -0
- figures/fig5_surgery.pdf +0 -0
- figures/fig5_surgery.png +3 -0
- figures/fig6_treatment.pdf +0 -0
- figures/fig6_treatment.png +3 -0
- figures/fig7_minimal_retrain.pdf +0 -0
- figures/fig7_minimal_retrain.png +0 -0
- figures/fig8_clinical_report.pdf +3 -0
- figures/fig8_clinical_report.png +3 -0
- inference.py +110 -0
- metrics/analyze_binary_axis.json +324 -0
- metrics/apply_threshold_calibration.json +225 -0
- metrics/baseline_vs_compressed.json +41 -0
- metrics/eval_nih_weights.json +81 -0
- metrics/minimal_retrain.json +131 -0
- metrics/minimal_retrain_v2.json +49 -0
- metrics/q_conflict_legitimacy.json +225 -0
- metrics/surgery_channel_ablation.json +114 -0
- requirements.txt +6 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,10 @@ 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 |
+
figures/fig2_sparse_layers.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
figures/fig3_mutual_exclusivity.pdf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
figures/fig3_mutual_exclusivity.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
figures/fig5_surgery.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
figures/fig6_treatment.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
figures/fig8_clinical_report.pdf filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
figures/fig8_clinical_report.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- medical-imaging
|
| 5 |
+
- chest-xray
|
| 6 |
+
- chexnet
|
| 7 |
+
- densenet121
|
| 8 |
+
- model-compression
|
| 9 |
+
- mechanistic-interpretability
|
| 10 |
+
- xai
|
| 11 |
+
datasets:
|
| 12 |
+
- nih-chest-xray
|
| 13 |
+
library_name: pytorch
|
| 14 |
+
pipeline_tag: image-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Lossless Mechanistic Compression and Surgical Correction of Medical Imaging Models
|
| 18 |
+
|
| 19 |
+
Artifacts for the paper by Yeonseong Cynn (River Lab, May 2026).
|
| 20 |
+
|
| 21 |
+
## Summary
|
| 22 |
+
|
| 23 |
+
A compressed CheXNet (DenseNet121) at **51.43% parameter reduction**
|
| 24 |
+
(6,966,034 → 3,383,248) with mean AUROC preserved within sampling noise
|
| 25 |
+
on n=1045 NIH ChestX-ray14 test images (Δ +0.0004, per-pathology max
|
| 26 |
+
|Δ| = 0.0033). Output identity to numerical precision
|
| 27 |
+
(max |Δ logit| < 5×10⁻⁶).
|
| 28 |
+
|
| 29 |
+
The compressed model exposes classifier channels at a granularity that
|
| 30 |
+
makes mechanistic interventions practical:
|
| 31 |
+
|
| 32 |
+
- **Surgical correction**: 5-channel classifier weight zeroing softly
|
| 33 |
+
reduces a target false-positive probability with bounded side effects.
|
| 34 |
+
- **Mutual exclusivity insight**: 89 of 100 polarized classifier channels
|
| 35 |
+
are not architectural conflicts but bipolar discriminative axes
|
| 36 |
+
exploiting label mutual exclusivity (Jaccard < 0.1).
|
| 37 |
+
- **Cost-aware operations**: threshold calibration and minimal retraining
|
| 38 |
+
routed by a decision system per pathology.
|
| 39 |
+
- **Clinical report auto-generation**: combining channel-level evidence,
|
| 40 |
+
Grad-CAM region mapping, and mutual-exclusivity exclusion.
|
| 41 |
+
|
| 42 |
+
## Files
|
| 43 |
+
|
| 44 |
+
### Weights
|
| 45 |
+
| File | Size | Description |
|
| 46 |
+
|---|---|---|
|
| 47 |
+
| `compressed_model.pt` | 14.2 MB | Compressed CheXNet backbone + classifier (3.38M params) |
|
| 48 |
+
| `classifier_finetuned.pt` | 75 KB | Optional fine-tuned classifier head (18K params) |
|
| 49 |
+
|
| 50 |
+
### Code
|
| 51 |
+
| File | Description |
|
| 52 |
+
|---|---|
|
| 53 |
+
| `inference.py` | Minimal CLI inference (load + forward) |
|
| 54 |
+
| `requirements.txt` | Pip dependencies |
|
| 55 |
+
|
| 56 |
+
### Metrics (JSON)
|
| 57 |
+
- `metrics/baseline_vs_compressed.json` — Per-pathology AUROC (baseline vs compressed, n=1045)
|
| 58 |
+
- `metrics/eval_nih_weights.json` — All 5 torchxrayvision DenseNet121 checkpoints on NIH test
|
| 59 |
+
- `metrics/analyze_binary_axis.json` — Pathology independence + Jaccard matrix
|
| 60 |
+
- `metrics/q_conflict_legitimacy.json` — Polarized channel legitimacy classification
|
| 61 |
+
- `metrics/surgery_channel_ablation.json` — Surgical correction K-sweep
|
| 62 |
+
- `metrics/apply_threshold_calibration.json` — Per-class Youden threshold + F1/Recall
|
| 63 |
+
- `metrics/minimal_retrain.json`, `minimal_retrain_v2.json` — Classifier-head fine-tune costs
|
| 64 |
+
|
| 65 |
+
### Figures (paper)
|
| 66 |
+
- `figures/fig1_compression.{pdf,png}` — Headline numbers
|
| 67 |
+
- `figures/fig2_sparse_layers.{pdf,png}` — Per-block sparsity
|
| 68 |
+
- `figures/fig3_mutual_exclusivity.{pdf,png}` — Jaccard ↔ channel-usage mirror
|
| 69 |
+
- `figures/fig4_legitimacy.{pdf,png}` — Polarized-channel legitimacy
|
| 70 |
+
- `figures/fig5_surgery.{pdf,png}` — Surgical-correction K-sweep
|
| 71 |
+
- `figures/fig6_treatment.{pdf,png}` — Per-pathology treatment recommendations
|
| 72 |
+
- `figures/fig7_minimal_retrain.{pdf,png}` — Fine-tuning + threshold calibration
|
| 73 |
+
- `figures/fig8_clinical_report.{pdf,png}` — Clinical report sample
|
| 74 |
+
|
| 75 |
+
## Setup
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
pip install -r requirements.txt
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
## Usage
|
| 82 |
+
|
| 83 |
+
### Loading and inference
|
| 84 |
+
|
| 85 |
+
```bash
|
| 86 |
+
python inference.py path/to/xray.png
|
| 87 |
+
python inference.py path/to/xray.png --classifier classifier_finetuned.pt
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
### Loading the model in your own code
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
import torch
|
| 94 |
+
import torch.nn as nn
|
| 95 |
+
import torchxrayvision as xrv
|
| 96 |
+
|
| 97 |
+
model = xrv.models.DenseNet(weights="densenet121-res224-all").eval()
|
| 98 |
+
ckpt = torch.load("compressed_model.pt", weights_only=False)
|
| 99 |
+
for block_idx in [1, 2, 3, 4]:
|
| 100 |
+
block = getattr(model.features, f"denseblock{block_idx}")
|
| 101 |
+
block_alive = ckpt["alive_per_block"][block_idx]
|
| 102 |
+
for dl_key, n_alive in block_alive.items():
|
| 103 |
+
i = int(dl_key[2:])
|
| 104 |
+
L = getattr(block, f"denselayer{i}")
|
| 105 |
+
in_ch = L.conv1.in_channels
|
| 106 |
+
L.conv1 = nn.Conv2d(in_ch, n_alive, 1, bias=True).eval()
|
| 107 |
+
L.norm2 = nn.BatchNorm2d(n_alive, eps=L.norm2.eps).eval()
|
| 108 |
+
L.conv2 = nn.Conv2d(n_alive, 32, 3, padding=1, bias=False).eval()
|
| 109 |
+
model.load_state_dict(ckpt["state_dict"])
|
| 110 |
+
for block_idx in [1, 2, 3, 4]:
|
| 111 |
+
block = getattr(model.features, f"denseblock{block_idx}")
|
| 112 |
+
for i in range(1, {1:6, 2:12, 3:24, 4:16}[block_idx] + 1):
|
| 113 |
+
getattr(block, f"denselayer{i}").norm2 = nn.Identity()
|
| 114 |
+
|
| 115 |
+
# Optional fine-tuned classifier
|
| 116 |
+
cls_ft = nn.Linear(1024, 18)
|
| 117 |
+
cls_ft.load_state_dict(torch.load("classifier_finetuned.pt", weights_only=True))
|
| 118 |
+
model.classifier = cls_ft
|
| 119 |
+
model.eval()
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
## Verification
|
| 123 |
+
|
| 124 |
+
### NIH ChestX-ray14 official test split (1045 images)
|
| 125 |
+
|
| 126 |
+
| Configuration | Parameters | Mean AUROC | Latency (ms/image) |
|
| 127 |
+
|---|---|---|---|
|
| 128 |
+
| Baseline (`densenet121-res224-all`) | 6,966,034 | 0.7781 | 15.17 |
|
| 129 |
+
| **Compressed** | **3,383,248 (-51.43%)** | **0.7785 (+0.0004)** | **14.73 (-2.9%)** |
|
| 130 |
+
|
| 131 |
+
Per-pathology max |Δ AUROC| = 0.0033 (Emphysema +); all within sampling noise.
|
| 132 |
+
|
| 133 |
+
### Choice of baseline checkpoint
|
| 134 |
+
|
| 135 |
+
We compared all 5 `torchxrayvision` DenseNet121 checkpoints on the same
|
| 136 |
+
NIH test subset. The multi-source `all` is the strongest:
|
| 137 |
+
|
| 138 |
+
| Checkpoint | Mean AUROC |
|
| 139 |
+
|---|---|
|
| 140 |
+
| **`densenet121-res224-all`** | **0.7781** |
|
| 141 |
+
| `densenet121-res224-nih` | 0.7524 |
|
| 142 |
+
| `densenet121-res224-chex` | 0.7425 |
|
| 143 |
+
| `densenet121-res224-mimic_ch` | 0.7178 |
|
| 144 |
+
| `densenet121-res224-mimic_nb` | 0.7049 |
|
| 145 |
+
|
| 146 |
+
Higher published NIH-only DenseNet121 numbers (e.g., 0.84) come from
|
| 147 |
+
corpus-specific hyperparameter and augmentation tuning not part of the
|
| 148 |
+
open `torchxrayvision` release.
|
| 149 |
+
|
| 150 |
+
### Threshold calibration (Youden-J)
|
| 151 |
+
|
| 152 |
+
The default decision threshold 0.5 is overly conservative for this
|
| 153 |
+
multi-label model. Per-class Youden-J on a held-out validation set
|
| 154 |
+
shifts the cohort-average operating point:
|
| 155 |
+
|
| 156 |
+
| Setting | Mean F1 | Mean Recall |
|
| 157 |
+
|---|---|---|
|
| 158 |
+
| Default threshold 0.5 | 0.127 | 0.111 |
|
| 159 |
+
| Youden-J calibrated | **0.20** | **0.78** |
|
| 160 |
+
|
| 161 |
+
**Caveat**: this trades precision for recall sharply. Best-performing
|
| 162 |
+
classes (Cardiomegaly: precision 1.0 → 0.11, F1 0.57 → 0.20; Mass: F1
|
| 163 |
+
0.25 → 0.07) are degraded. F1 average is dominated by previously
|
| 164 |
+
zero-recall classes (Infiltration, Atelectasis). For deployment,
|
| 165 |
+
F1-optimal thresholds or explicit clinical precision floors are
|
| 166 |
+
preferable.
|
| 167 |
+
|
| 168 |
+
### Surgical correction (representative Cardiomegaly false positive)
|
| 169 |
+
|
| 170 |
+
| K (channels zeroed) | Target prob | TP loss | Other 13 pathology AUROC Δ |
|
| 171 |
+
|---|---|---|---|
|
| 172 |
+
| 0 (baseline) | 0.89 | — | — |
|
| 173 |
+
| 5 | 0.76 | 0 | exactly 0 |
|
| 174 |
+
| 10 | 0.67 | 4 | exactly 0 |
|
| 175 |
+
| 20 | 0.54 | 7 | exactly 0 |
|
| 176 |
+
|
| 177 |
+
At K=5 the decision (threshold 0.5) is **not flipped**; the correction
|
| 178 |
+
is a soft probability reduction, not a hard decision change. K=20
|
| 179 |
+
crosses the boundary but loses 7 true positives. Treat surgical
|
| 180 |
+
correction as a confidence-shaping tool, not a binary error eraser.
|
| 181 |
+
|
| 182 |
+
The exact-zero AUROC isolation guarantee on the other 13 pathologies
|
| 183 |
+
holds by construction (only one classifier row is modified).
|
| 184 |
+
|
| 185 |
+
## Method Disclosure
|
| 186 |
+
|
| 187 |
+
Compression method specifics are proprietary; the foundational procedure
|
| 188 |
+
is covered by Korean patent applications. The released artifacts (weights,
|
| 189 |
+
inference code, downstream analysis scripts) are sufficient for
|
| 190 |
+
reproduction of the reported results.
|
| 191 |
+
|
| 192 |
+
## Base Model
|
| 193 |
+
|
| 194 |
+
[torchxrayvision densenet121-res224-all](https://github.com/mlmed/torchxrayvision)
|
| 195 |
+
(DenseNet121 trained on NIH ChestX-ray14, CheXpert, MIMIC-CXR, PadChest).
|
| 196 |
+
|
| 197 |
+
## Citation
|
| 198 |
+
|
| 199 |
+
```bibtex
|
| 200 |
+
@misc{cynn2026chexnet,
|
| 201 |
+
title={Lossless Mechanistic Compression and Surgical Correction of Medical Imaging Models},
|
| 202 |
+
author={Cynn, Yeonseong},
|
| 203 |
+
year={2026},
|
| 204 |
+
note={Manuscript in preparation}
|
| 205 |
+
}
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
## License
|
| 209 |
+
|
| 210 |
+
MIT for the released code; the underlying compression method is
|
| 211 |
+
proprietary (see Method Disclosure above).
|
| 212 |
+
|
| 213 |
+
## Contact
|
| 214 |
+
|
| 215 |
+
For questions or commercial inquiries: whitepep@gmail.com
|
classifier_finetuned.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bb003a949793d1e60f7c939d45a2c6b14b4b1868a8838687351a6872ffaa6e8d
|
| 3 |
+
size 75430
|
compressed_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:338f9366a1db6cff074a2e2e882747a6d9a5e8b09fcf7be43880cebf38db2de2
|
| 3 |
+
size 14165486
|
figures/fig1_compression.pdf
ADDED
|
Binary file (20.1 kB). View file
|
|
|
figures/fig1_compression.png
ADDED
|
figures/fig2_sparse_layers.pdf
ADDED
|
Binary file (18.8 kB). View file
|
|
|
figures/fig2_sparse_layers.png
ADDED
|
Git LFS Details
|
figures/fig3_mutual_exclusivity.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:de9122621761c12e077999e0fcde4b98f9f38c6923b5410739f3c1d8f2a9f310
|
| 3 |
+
size 187145
|
figures/fig3_mutual_exclusivity.png
ADDED
|
Git LFS Details
|
figures/fig4_legitimacy.pdf
ADDED
|
Binary file (17.3 kB). View file
|
|
|
figures/fig4_legitimacy.png
ADDED
|
figures/fig5_surgery.pdf
ADDED
|
Binary file (19.9 kB). View file
|
|
|
figures/fig5_surgery.png
ADDED
|
Git LFS Details
|
figures/fig6_treatment.pdf
ADDED
|
Binary file (18.5 kB). View file
|
|
|
figures/fig6_treatment.png
ADDED
|
Git LFS Details
|
figures/fig7_minimal_retrain.pdf
ADDED
|
Binary file (17.8 kB). View file
|
|
|
figures/fig7_minimal_retrain.png
ADDED
|
figures/fig8_clinical_report.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a9e9e602b6756e1df45d513fd96d75910725dac7b09cbdb8d4cfedf4a061e18
|
| 3 |
+
size 314896
|
figures/fig8_clinical_report.png
ADDED
|
Git LFS Details
|
inference.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
CheXNet Compressed Model — Inference
|
| 3 |
+
|
| 4 |
+
Loads the compressed model (optionally with the fine-tuned classifier head)
|
| 5 |
+
and predicts pathology probabilities for a chest X-ray image.
|
| 6 |
+
|
| 7 |
+
Usage:
|
| 8 |
+
python inference.py <path/to/image.png>
|
| 9 |
+
python inference.py <path/to/image.png> --classifier classifier_finetuned.pt
|
| 10 |
+
"""
|
| 11 |
+
import sys
|
| 12 |
+
sys.dont_write_bytecode = True # avoid creating __pycache__ in the release dir
|
| 13 |
+
|
| 14 |
+
import argparse
|
| 15 |
+
import os
|
| 16 |
+
|
| 17 |
+
import numpy as np
|
| 18 |
+
import torch
|
| 19 |
+
import torch.nn as nn
|
| 20 |
+
import torch.nn.functional as F
|
| 21 |
+
import torchxrayvision as xrv
|
| 22 |
+
from PIL import Image
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def build_compressed_model(ckpt_path, device, classifier_ft_path=None):
|
| 26 |
+
"""Load baseline CheXNet then reshape to compressed dimensions and load weights."""
|
| 27 |
+
model = xrv.models.DenseNet(weights="densenet121-res224-all").to(device).eval()
|
| 28 |
+
ckpt = torch.load(ckpt_path, map_location=device, weights_only=False)
|
| 29 |
+
alive = ckpt["alive_per_block"]
|
| 30 |
+
for block_idx in [1, 2, 3, 4]:
|
| 31 |
+
block = getattr(model.features, f"denseblock{block_idx}")
|
| 32 |
+
block_alive = alive.get(block_idx, alive.get(f"block{block_idx}", {}))
|
| 33 |
+
for dl_key, n_alive in block_alive.items():
|
| 34 |
+
i = int(dl_key[2:]) if dl_key.startswith("dl") else int(dl_key)
|
| 35 |
+
L = getattr(block, f"denselayer{i}")
|
| 36 |
+
in_ch = L.conv1.in_channels
|
| 37 |
+
L.conv1 = nn.Conv2d(in_ch, n_alive, 1, bias=True).to(device).eval()
|
| 38 |
+
L.norm2 = nn.BatchNorm2d(n_alive, eps=L.norm2.eps).to(device).eval()
|
| 39 |
+
L.conv2 = nn.Conv2d(n_alive, 32, 3, padding=1, bias=False).to(device).eval()
|
| 40 |
+
model.load_state_dict(ckpt["state_dict"])
|
| 41 |
+
# intermediate batch norms are folded; replace with identity
|
| 42 |
+
for block_idx in [1, 2, 3, 4]:
|
| 43 |
+
block = getattr(model.features, f"denseblock{block_idx}")
|
| 44 |
+
n_layers = {1: 6, 2: 12, 3: 24, 4: 16}[block_idx]
|
| 45 |
+
for i in range(1, n_layers + 1):
|
| 46 |
+
getattr(block, f"denselayer{i}").norm2 = nn.Identity()
|
| 47 |
+
|
| 48 |
+
if classifier_ft_path and os.path.exists(classifier_ft_path):
|
| 49 |
+
cls_ft = nn.Linear(1024, 18).to(device)
|
| 50 |
+
cls_ft.load_state_dict(torch.load(classifier_ft_path,
|
| 51 |
+
map_location=device, weights_only=True))
|
| 52 |
+
model.classifier = cls_ft
|
| 53 |
+
|
| 54 |
+
model.eval()
|
| 55 |
+
return model
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def preprocess(img_np):
|
| 59 |
+
"""xrv normalization: scale to [-1024, 1024] and resize to 224x224."""
|
| 60 |
+
arr = img_np.astype(np.float32)
|
| 61 |
+
arr = (arr - arr.min()) / max(arr.max() - arr.min(), 1) * 2048 - 1024
|
| 62 |
+
pil = Image.fromarray(arr, mode="F").resize((224, 224), Image.BILINEAR)
|
| 63 |
+
return np.array(pil)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def predict(model, image_path, device, top_n=5):
|
| 67 |
+
img = Image.open(image_path)
|
| 68 |
+
if img.mode != "L":
|
| 69 |
+
img = img.convert("L")
|
| 70 |
+
img_proc = preprocess(np.array(img))
|
| 71 |
+
t = torch.tensor(img_proc, dtype=torch.float32).unsqueeze(0).unsqueeze(0).to(device)
|
| 72 |
+
with torch.no_grad():
|
| 73 |
+
feat = model.features(t)
|
| 74 |
+
feat = F.relu(feat, inplace=False)
|
| 75 |
+
pooled = F.adaptive_avg_pool2d(feat, (1, 1)).flatten(1)
|
| 76 |
+
logits = model.classifier(pooled)[0]
|
| 77 |
+
probs = torch.sigmoid(logits).cpu().numpy()
|
| 78 |
+
pathologies = list(model.pathologies)
|
| 79 |
+
return sorted(zip(pathologies, probs.tolist()), key=lambda x: -x[1])[:top_n]
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def main():
|
| 83 |
+
parser = argparse.ArgumentParser(description="CheXNet compressed model inference")
|
| 84 |
+
parser.add_argument("image_path", help="Path to chest X-ray image (PNG)")
|
| 85 |
+
parser.add_argument("--ckpt", default="compressed_model.pt",
|
| 86 |
+
help="Compressed model checkpoint")
|
| 87 |
+
parser.add_argument("--classifier", default="classifier_finetuned.pt",
|
| 88 |
+
help="Optional fine-tuned classifier head")
|
| 89 |
+
parser.add_argument("--top", type=int, default=5, help="Number of predictions to show")
|
| 90 |
+
args = parser.parse_args()
|
| 91 |
+
|
| 92 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 93 |
+
ckpt_path = args.ckpt if os.path.isabs(args.ckpt) else os.path.join(here, args.ckpt)
|
| 94 |
+
cls_path = args.classifier if os.path.isabs(args.classifier) else os.path.join(here, args.classifier)
|
| 95 |
+
|
| 96 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 97 |
+
print(f"Device: {device}")
|
| 98 |
+
|
| 99 |
+
model = build_compressed_model(ckpt_path, device, cls_path)
|
| 100 |
+
n_params = sum(p.numel() for p in model.parameters())
|
| 101 |
+
print(f"Model parameters: {n_params:,}")
|
| 102 |
+
|
| 103 |
+
ranked = predict(model, args.image_path, device, top_n=args.top)
|
| 104 |
+
print(f"\nTop-{args.top} predictions for {args.image_path}:")
|
| 105 |
+
for pathology, prob in ranked:
|
| 106 |
+
print(f" {pathology:<28} {prob:.4f}")
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
if __name__ == "__main__":
|
| 110 |
+
main()
|
metrics/analyze_binary_axis.json
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"pathology_independence_score": {
|
| 3 |
+
"Atelectasis": 0.9553384421051226,
|
| 4 |
+
"Consolidation": 0.9511092287725019,
|
| 5 |
+
"Infiltration": 0.9473420384158613,
|
| 6 |
+
"Pneumothorax": 0.9851201592772656,
|
| 7 |
+
"Edema": 0.9658843078521789,
|
| 8 |
+
"Emphysema": 0.9924951267056531,
|
| 9 |
+
"Fibrosis": 0.9632083381606142,
|
| 10 |
+
"Effusion": 0.9271281593875844,
|
| 11 |
+
"Pneumonia": 0.984717957807288,
|
| 12 |
+
"Pleural_Thickening": 0.9555283714532556,
|
| 13 |
+
"Cardiomegaly": 0.9483568960925801,
|
| 14 |
+
"Nodule": 0.9583928226418525,
|
| 15 |
+
"Mass": 0.9565895170805814,
|
| 16 |
+
"Hernia": 0.9917770617018739
|
| 17 |
+
},
|
| 18 |
+
"jaccard_matrix": {
|
| 19 |
+
"Atelectasis__Consolidation": 0.0963855421686747,
|
| 20 |
+
"Atelectasis__Infiltration": 0.13194444444444445,
|
| 21 |
+
"Atelectasis__Pneumothorax": 0.012658227848101266,
|
| 22 |
+
"Atelectasis__Edema": 0.0,
|
| 23 |
+
"Atelectasis__Emphysema": 0.0,
|
| 24 |
+
"Atelectasis__Fibrosis": 0.010869565217391304,
|
| 25 |
+
"Atelectasis__Effusion": 0.17424242424242425,
|
| 26 |
+
"Atelectasis__Pneumonia": 0.02857142857142857,
|
| 27 |
+
"Atelectasis__Pleural_Thickening": 0.04819277108433735,
|
| 28 |
+
"Atelectasis__Cardiomegaly": 0.03773584905660377,
|
| 29 |
+
"Atelectasis__Nodule": 0.0,
|
| 30 |
+
"Atelectasis__Mass": 0.04,
|
| 31 |
+
"Atelectasis__Hernia": 0.0,
|
| 32 |
+
"Consolidation__Atelectasis": 0.0963855421686747,
|
| 33 |
+
"Consolidation__Infiltration": 0.05172413793103448,
|
| 34 |
+
"Consolidation__Pneumothorax": 0.02631578947368421,
|
| 35 |
+
"Consolidation__Edema": 0.06451612903225806,
|
| 36 |
+
"Consolidation__Emphysema": 0.0,
|
| 37 |
+
"Consolidation__Fibrosis": 0.0196078431372549,
|
| 38 |
+
"Consolidation__Effusion": 0.09615384615384616,
|
| 39 |
+
"Consolidation__Pneumonia": 0.0,
|
| 40 |
+
"Consolidation__Pleural_Thickening": 0.06976744186046512,
|
| 41 |
+
"Consolidation__Cardiomegaly": 0.029850746268656716,
|
| 42 |
+
"Consolidation__Nodule": 0.09302325581395349,
|
| 43 |
+
"Consolidation__Mass": 0.08823529411764706,
|
| 44 |
+
"Consolidation__Hernia": 0.0,
|
| 45 |
+
"Infiltration__Atelectasis": 0.13194444444444445,
|
| 46 |
+
"Infiltration__Consolidation": 0.05172413793103448,
|
| 47 |
+
"Infiltration__Pneumothorax": 0.01834862385321101,
|
| 48 |
+
"Infiltration__Edema": 0.039603960396039604,
|
| 49 |
+
"Infiltration__Emphysema": 0.0,
|
| 50 |
+
"Infiltration__Fibrosis": 0.06896551724137931,
|
| 51 |
+
"Infiltration__Effusion": 0.1625,
|
| 52 |
+
"Infiltration__Pneumonia": 0.03,
|
| 53 |
+
"Infiltration__Pleural_Thickening": 0.02608695652173913,
|
| 54 |
+
"Infiltration__Cardiomegaly": 0.09302325581395349,
|
| 55 |
+
"Infiltration__Nodule": 0.05309734513274336,
|
| 56 |
+
"Infiltration__Mass": 0.009259259259259259,
|
| 57 |
+
"Infiltration__Hernia": 0.0,
|
| 58 |
+
"Pneumothorax__Atelectasis": 0.012658227848101266,
|
| 59 |
+
"Pneumothorax__Consolidation": 0.02631578947368421,
|
| 60 |
+
"Pneumothorax__Infiltration": 0.01834862385321101,
|
| 61 |
+
"Pneumothorax__Edema": 0.0,
|
| 62 |
+
"Pneumothorax__Emphysema": 0.05,
|
| 63 |
+
"Pneumothorax__Fibrosis": 0.0,
|
| 64 |
+
"Pneumothorax__Effusion": 0.0,
|
| 65 |
+
"Pneumothorax__Pneumonia": 0.0,
|
| 66 |
+
"Pneumothorax__Pleural_Thickening": 0.0,
|
| 67 |
+
"Pneumothorax__Cardiomegaly": 0.017543859649122806,
|
| 68 |
+
"Pneumothorax__Nodule": 0.02857142857142857,
|
| 69 |
+
"Pneumothorax__Mass": 0.04,
|
| 70 |
+
"Pneumothorax__Hernia": 0.0,
|
| 71 |
+
"Edema__Atelectasis": 0.0,
|
| 72 |
+
"Edema__Consolidation": 0.06451612903225806,
|
| 73 |
+
"Edema__Infiltration": 0.039603960396039604,
|
| 74 |
+
"Edema__Pneumothorax": 0.0,
|
| 75 |
+
"Edema__Emphysema": 0.0,
|
| 76 |
+
"Edema__Fibrosis": 0.029411764705882353,
|
| 77 |
+
"Edema__Effusion": 0.043010752688172046,
|
| 78 |
+
"Edema__Pneumonia": 0.07692307692307693,
|
| 79 |
+
"Edema__Pleural_Thickening": 0.0,
|
| 80 |
+
"Edema__Cardiomegaly": 0.15555555555555556,
|
| 81 |
+
"Edema__Nodule": 0.034482758620689655,
|
| 82 |
+
"Edema__Mass": 0.0,
|
| 83 |
+
"Edema__Hernia": 0.0,
|
| 84 |
+
"Emphysema__Atelectasis": 0.0,
|
| 85 |
+
"Emphysema__Consolidation": 0.0,
|
| 86 |
+
"Emphysema__Infiltration": 0.0,
|
| 87 |
+
"Emphysema__Pneumothorax": 0.05,
|
| 88 |
+
"Emphysema__Edema": 0.0,
|
| 89 |
+
"Emphysema__Fibrosis": 0.0,
|
| 90 |
+
"Emphysema__Effusion": 0.010526315789473684,
|
| 91 |
+
"Emphysema__Pneumonia": 0.0,
|
| 92 |
+
"Emphysema__Pleural_Thickening": 0.037037037037037035,
|
| 93 |
+
"Emphysema__Cardiomegaly": 0.0,
|
| 94 |
+
"Emphysema__Nodule": 0.0,
|
| 95 |
+
"Emphysema__Mass": 0.0,
|
| 96 |
+
"Emphysema__Hernia": 0.0,
|
| 97 |
+
"Fibrosis__Atelectasis": 0.010869565217391304,
|
| 98 |
+
"Fibrosis__Consolidation": 0.0196078431372549,
|
| 99 |
+
"Fibrosis__Infiltration": 0.06896551724137931,
|
| 100 |
+
"Fibrosis__Pneumothorax": 0.0,
|
| 101 |
+
"Fibrosis__Edema": 0.029411764705882353,
|
| 102 |
+
"Fibrosis__Emphysema": 0.0,
|
| 103 |
+
"Fibrosis__Effusion": 0.06422018348623854,
|
| 104 |
+
"Fibrosis__Pneumonia": 0.0,
|
| 105 |
+
"Fibrosis__Pleural_Thickening": 0.11627906976744186,
|
| 106 |
+
"Fibrosis__Cardiomegaly": 0.028985507246376812,
|
| 107 |
+
"Fibrosis__Nodule": 0.11363636363636363,
|
| 108 |
+
"Fibrosis__Mass": 0.02631578947368421,
|
| 109 |
+
"Fibrosis__Hernia": 0.0,
|
| 110 |
+
"Effusion__Atelectasis": 0.17424242424242425,
|
| 111 |
+
"Effusion__Consolidation": 0.09615384615384616,
|
| 112 |
+
"Effusion__Infiltration": 0.1625,
|
| 113 |
+
"Effusion__Pneumothorax": 0.0,
|
| 114 |
+
"Effusion__Edema": 0.043010752688172046,
|
| 115 |
+
"Effusion__Emphysema": 0.010526315789473684,
|
| 116 |
+
"Effusion__Fibrosis": 0.06422018348623854,
|
| 117 |
+
"Effusion__Pneumonia": 0.021505376344086023,
|
| 118 |
+
"Effusion__Pleural_Thickening": 0.0784313725490196,
|
| 119 |
+
"Effusion__Cardiomegaly": 0.17699115044247787,
|
| 120 |
+
"Effusion__Nodule": 0.05714285714285714,
|
| 121 |
+
"Effusion__Mass": 0.052083333333333336,
|
| 122 |
+
"Effusion__Hernia": 0.010526315789473684,
|
| 123 |
+
"Pneumonia__Atelectasis": 0.02857142857142857,
|
| 124 |
+
"Pneumonia__Consolidation": 0.0,
|
| 125 |
+
"Pneumonia__Infiltration": 0.03,
|
| 126 |
+
"Pneumonia__Pneumothorax": 0.0,
|
| 127 |
+
"Pneumonia__Edema": 0.07692307692307693,
|
| 128 |
+
"Pneumonia__Emphysema": 0.0,
|
| 129 |
+
"Pneumonia__Fibrosis": 0.0,
|
| 130 |
+
"Pneumonia__Effusion": 0.021505376344086023,
|
| 131 |
+
"Pneumonia__Pleural_Thickening": 0.0,
|
| 132 |
+
"Pneumonia__Cardiomegaly": 0.041666666666666664,
|
| 133 |
+
"Pneumonia__Nodule": 0.0,
|
| 134 |
+
"Pneumonia__Mass": 0.0,
|
| 135 |
+
"Pneumonia__Hernia": 0.0,
|
| 136 |
+
"Pleural_Thickening__Atelectasis": 0.04819277108433735,
|
| 137 |
+
"Pleural_Thickening__Consolidation": 0.06976744186046512,
|
| 138 |
+
"Pleural_Thickening__Infiltration": 0.02608695652173913,
|
| 139 |
+
"Pleural_Thickening__Pneumothorax": 0.0,
|
| 140 |
+
"Pleural_Thickening__Edema": 0.0,
|
| 141 |
+
"Pleural_Thickening__Emphysema": 0.037037037037037035,
|
| 142 |
+
"Pleural_Thickening__Fibrosis": 0.11627906976744186,
|
| 143 |
+
"Pleural_Thickening__Effusion": 0.0784313725490196,
|
| 144 |
+
"Pleural_Thickening__Pneumonia": 0.0,
|
| 145 |
+
"Pleural_Thickening__Cardiomegaly": 0.015625,
|
| 146 |
+
"Pleural_Thickening__Nodule": 0.04878048780487805,
|
| 147 |
+
"Pleural_Thickening__Mass": 0.13793103448275862,
|
| 148 |
+
"Pleural_Thickening__Hernia": 0.0,
|
| 149 |
+
"Cardiomegaly__Atelectasis": 0.03773584905660377,
|
| 150 |
+
"Cardiomegaly__Consolidation": 0.029850746268656716,
|
| 151 |
+
"Cardiomegaly__Infiltration": 0.09302325581395349,
|
| 152 |
+
"Cardiomegaly__Pneumothorax": 0.017543859649122806,
|
| 153 |
+
"Cardiomegaly__Edema": 0.15555555555555556,
|
| 154 |
+
"Cardiomegaly__Emphysema": 0.0,
|
| 155 |
+
"Cardiomegaly__Fibrosis": 0.028985507246376812,
|
| 156 |
+
"Cardiomegaly__Effusion": 0.17699115044247787,
|
| 157 |
+
"Cardiomegaly__Pneumonia": 0.041666666666666664,
|
| 158 |
+
"Cardiomegaly__Pleural_Thickening": 0.015625,
|
| 159 |
+
"Cardiomegaly__Nodule": 0.015384615384615385,
|
| 160 |
+
"Cardiomegaly__Mass": 0.01818181818181818,
|
| 161 |
+
"Cardiomegaly__Hernia": 0.04081632653061224,
|
| 162 |
+
"Nodule__Atelectasis": 0.0,
|
| 163 |
+
"Nodule__Consolidation": 0.09302325581395349,
|
| 164 |
+
"Nodule__Infiltration": 0.05309734513274336,
|
| 165 |
+
"Nodule__Pneumothorax": 0.02857142857142857,
|
| 166 |
+
"Nodule__Edema": 0.034482758620689655,
|
| 167 |
+
"Nodule__Emphysema": 0.0,
|
| 168 |
+
"Nodule__Fibrosis": 0.11363636363636363,
|
| 169 |
+
"Nodule__Effusion": 0.05714285714285714,
|
| 170 |
+
"Nodule__Pneumonia": 0.0,
|
| 171 |
+
"Nodule__Pleural_Thickening": 0.04878048780487805,
|
| 172 |
+
"Nodule__Cardiomegaly": 0.015384615384615385,
|
| 173 |
+
"Nodule__Mass": 0.0967741935483871,
|
| 174 |
+
"Nodule__Hernia": 0.0,
|
| 175 |
+
"Mass__Atelectasis": 0.04,
|
| 176 |
+
"Mass__Consolidation": 0.08823529411764706,
|
| 177 |
+
"Mass__Infiltration": 0.009259259259259259,
|
| 178 |
+
"Mass__Pneumothorax": 0.04,
|
| 179 |
+
"Mass__Edema": 0.0,
|
| 180 |
+
"Mass__Emphysema": 0.0,
|
| 181 |
+
"Mass__Fibrosis": 0.02631578947368421,
|
| 182 |
+
"Mass__Effusion": 0.052083333333333336,
|
| 183 |
+
"Mass__Pneumonia": 0.0,
|
| 184 |
+
"Mass__Pleural_Thickening": 0.13793103448275862,
|
| 185 |
+
"Mass__Cardiomegaly": 0.01818181818181818,
|
| 186 |
+
"Mass__Nodule": 0.0967741935483871,
|
| 187 |
+
"Mass__Hernia": 0.05555555555555555,
|
| 188 |
+
"Hernia__Atelectasis": 0.0,
|
| 189 |
+
"Hernia__Consolidation": 0.0,
|
| 190 |
+
"Hernia__Infiltration": 0.0,
|
| 191 |
+
"Hernia__Pneumothorax": 0.0,
|
| 192 |
+
"Hernia__Edema": 0.0,
|
| 193 |
+
"Hernia__Emphysema": 0.0,
|
| 194 |
+
"Hernia__Fibrosis": 0.0,
|
| 195 |
+
"Hernia__Effusion": 0.010526315789473684,
|
| 196 |
+
"Hernia__Pneumonia": 0.0,
|
| 197 |
+
"Hernia__Pleural_Thickening": 0.0,
|
| 198 |
+
"Hernia__Cardiomegaly": 0.04081632653061224,
|
| 199 |
+
"Hernia__Nodule": 0.0,
|
| 200 |
+
"Hernia__Mass": 0.05555555555555555
|
| 201 |
+
},
|
| 202 |
+
"binary_axis_top_pairs": [
|
| 203 |
+
{
|
| 204 |
+
"p1": "Pneumothorax",
|
| 205 |
+
"p2": "Fibrosis",
|
| 206 |
+
"n_ch_axis": 7,
|
| 207 |
+
"jaccard": 0.0
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"p1": "Effusion",
|
| 211 |
+
"p2": "Hernia",
|
| 212 |
+
"n_ch_axis": 7,
|
| 213 |
+
"jaccard": 0.010526315789473684
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"p1": "Consolidation",
|
| 217 |
+
"p2": "Hernia",
|
| 218 |
+
"n_ch_axis": 6,
|
| 219 |
+
"jaccard": 0.0
|
| 220 |
+
},
|
| 221 |
+
{
|
| 222 |
+
"p1": "Pneumothorax",
|
| 223 |
+
"p2": "Edema",
|
| 224 |
+
"n_ch_axis": 6,
|
| 225 |
+
"jaccard": 0.0
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"p1": "Pleural_Thickening",
|
| 229 |
+
"p2": "Mass",
|
| 230 |
+
"n_ch_axis": 6,
|
| 231 |
+
"jaccard": 0.13793103448275862
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"p1": "Emphysema",
|
| 235 |
+
"p2": "Pleural_Thickening",
|
| 236 |
+
"n_ch_axis": 5,
|
| 237 |
+
"jaccard": 0.037037037037037035
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"p1": "Emphysema",
|
| 241 |
+
"p2": "Hernia",
|
| 242 |
+
"n_ch_axis": 5,
|
| 243 |
+
"jaccard": 0.0
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"p1": "Fibrosis",
|
| 247 |
+
"p2": "Effusion",
|
| 248 |
+
"n_ch_axis": 5,
|
| 249 |
+
"jaccard": 0.06422018348623854
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"p1": "Fibrosis",
|
| 253 |
+
"p2": "Hernia",
|
| 254 |
+
"n_ch_axis": 5,
|
| 255 |
+
"jaccard": 0.0
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"p1": "Pneumothorax",
|
| 259 |
+
"p2": "Mass",
|
| 260 |
+
"n_ch_axis": 4,
|
| 261 |
+
"jaccard": 0.04
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"p1": "Pneumothorax",
|
| 265 |
+
"p2": "Hernia",
|
| 266 |
+
"n_ch_axis": 4,
|
| 267 |
+
"jaccard": 0.0
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"p1": "Emphysema",
|
| 271 |
+
"p2": "Cardiomegaly",
|
| 272 |
+
"n_ch_axis": 4,
|
| 273 |
+
"jaccard": 0.0
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"p1": "Pneumonia",
|
| 277 |
+
"p2": "Hernia",
|
| 278 |
+
"n_ch_axis": 4,
|
| 279 |
+
"jaccard": 0.0
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"p1": "Pleural_Thickening",
|
| 283 |
+
"p2": "Hernia",
|
| 284 |
+
"n_ch_axis": 4,
|
| 285 |
+
"jaccard": 0.0
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"p1": "Mass",
|
| 289 |
+
"p2": "Hernia",
|
| 290 |
+
"n_ch_axis": 4,
|
| 291 |
+
"jaccard": 0.05555555555555555
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"p1": "Mass",
|
| 295 |
+
"p2": "Fracture",
|
| 296 |
+
"n_ch_axis": 4,
|
| 297 |
+
"jaccard": 0.0
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"p1": "Hernia",
|
| 301 |
+
"p2": "Enlarged Cardiomediastinum",
|
| 302 |
+
"n_ch_axis": 4,
|
| 303 |
+
"jaccard": 0.0
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"p1": "Pneumothorax",
|
| 307 |
+
"p2": "Emphysema",
|
| 308 |
+
"n_ch_axis": 3,
|
| 309 |
+
"jaccard": 0.05
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"p1": "Pneumothorax",
|
| 313 |
+
"p2": "Effusion",
|
| 314 |
+
"n_ch_axis": 3,
|
| 315 |
+
"jaccard": 0.0
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"p1": "Edema",
|
| 319 |
+
"p2": "Lung Lesion",
|
| 320 |
+
"n_ch_axis": 3,
|
| 321 |
+
"jaccard": 0.0
|
| 322 |
+
}
|
| 323 |
+
]
|
| 324 |
+
}
|
metrics/apply_threshold_calibration.json
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"thresholds": {
|
| 3 |
+
"Atelectasis": 0.1641383171081543,
|
| 4 |
+
"Consolidation": 0.057644788175821304,
|
| 5 |
+
"Infiltration": 0.12889404594898224,
|
| 6 |
+
"Pneumothorax": 0.010074671357870102,
|
| 7 |
+
"Edema": 0.006034631747752428,
|
| 8 |
+
"Emphysema": 0.009953165426850319,
|
| 9 |
+
"Fibrosis": 0.04691587761044502,
|
| 10 |
+
"Effusion": 0.1522664874792099,
|
| 11 |
+
"Pneumonia": 0.01452414970844984,
|
| 12 |
+
"Pleural_Thickening": 0.027503035962581635,
|
| 13 |
+
"Cardiomegaly": 0.08342594653367996,
|
| 14 |
+
"Nodule": 0.04766174405813217,
|
| 15 |
+
"Mass": 0.05993369594216347,
|
| 16 |
+
"Hernia": 0.17927372455596924,
|
| 17 |
+
"Lung Lesion": 0.5,
|
| 18 |
+
"Fracture": 0.5,
|
| 19 |
+
"Lung Opacity": 0.5,
|
| 20 |
+
"Enlarged Cardiomediastinum": 0.5
|
| 21 |
+
},
|
| 22 |
+
"results": [
|
| 23 |
+
{
|
| 24 |
+
"pathology": "Atelectasis",
|
| 25 |
+
"auroc": 0.802732379979571,
|
| 26 |
+
"threshold_old": 0.5,
|
| 27 |
+
"threshold_new": 0.1641383171081543,
|
| 28 |
+
"old": {
|
| 29 |
+
"f1": 0.0851063829787234,
|
| 30 |
+
"precision": 0.6666666666666666,
|
| 31 |
+
"recall": 0.045454545454545456
|
| 32 |
+
},
|
| 33 |
+
"new": {
|
| 34 |
+
"f1": 0.4027777777777778,
|
| 35 |
+
"precision": 0.29,
|
| 36 |
+
"recall": 0.6590909090909091
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"pathology": "Consolidation",
|
| 41 |
+
"auroc": 0.7374537227478404,
|
| 42 |
+
"threshold_old": 0.5,
|
| 43 |
+
"threshold_new": 0.057644788175821304,
|
| 44 |
+
"old": {
|
| 45 |
+
"f1": 0.0,
|
| 46 |
+
"precision": 0.0,
|
| 47 |
+
"recall": 0.0
|
| 48 |
+
},
|
| 49 |
+
"new": {
|
| 50 |
+
"f1": 0.2122905027932961,
|
| 51 |
+
"precision": 0.12418300653594772,
|
| 52 |
+
"recall": 0.7307692307692307
|
| 53 |
+
}
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"pathology": "Infiltration",
|
| 57 |
+
"auroc": 0.6667513550135501,
|
| 58 |
+
"threshold_old": 0.5,
|
| 59 |
+
"threshold_new": 0.12889404594898224,
|
| 60 |
+
"old": {
|
| 61 |
+
"f1": 0.0,
|
| 62 |
+
"precision": 0.0,
|
| 63 |
+
"recall": 0.0
|
| 64 |
+
},
|
| 65 |
+
"new": {
|
| 66 |
+
"f1": 0.34146341463414637,
|
| 67 |
+
"precision": 0.21875,
|
| 68 |
+
"recall": 0.7777777777777778
|
| 69 |
+
}
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"pathology": "Pneumothorax",
|
| 73 |
+
"auroc": 0.8123076923076924,
|
| 74 |
+
"threshold_old": 0.5,
|
| 75 |
+
"threshold_new": 0.010074671357870102,
|
| 76 |
+
"old": {
|
| 77 |
+
"f1": 0.0,
|
| 78 |
+
"precision": 0.0,
|
| 79 |
+
"recall": 0.0
|
| 80 |
+
},
|
| 81 |
+
"new": {
|
| 82 |
+
"f1": 0.07655502392344497,
|
| 83 |
+
"precision": 0.04020100502512563,
|
| 84 |
+
"recall": 0.8
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"pathology": "Emphysema",
|
| 89 |
+
"auroc": 0.7564521992002907,
|
| 90 |
+
"threshold_old": 0.5,
|
| 91 |
+
"threshold_new": 0.009953165426850319,
|
| 92 |
+
"old": {
|
| 93 |
+
"f1": 0.0,
|
| 94 |
+
"precision": 0.0,
|
| 95 |
+
"recall": 0.0
|
| 96 |
+
},
|
| 97 |
+
"new": {
|
| 98 |
+
"f1": 0.0967741935483871,
|
| 99 |
+
"precision": 0.05454545454545454,
|
| 100 |
+
"recall": 0.42857142857142855
|
| 101 |
+
}
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"pathology": "Fibrosis",
|
| 105 |
+
"auroc": 0.7666804807293826,
|
| 106 |
+
"threshold_old": 0.5,
|
| 107 |
+
"threshold_new": 0.04691587761044502,
|
| 108 |
+
"old": {
|
| 109 |
+
"f1": 0.0,
|
| 110 |
+
"precision": 0.0,
|
| 111 |
+
"recall": 0.0
|
| 112 |
+
},
|
| 113 |
+
"new": {
|
| 114 |
+
"f1": 0.1590909090909091,
|
| 115 |
+
"precision": 0.08917197452229299,
|
| 116 |
+
"recall": 0.7368421052631579
|
| 117 |
+
}
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"pathology": "Effusion",
|
| 121 |
+
"auroc": 0.7276698577934753,
|
| 122 |
+
"threshold_old": 0.5,
|
| 123 |
+
"threshold_new": 0.1522664874792099,
|
| 124 |
+
"old": {
|
| 125 |
+
"f1": 0.04878048780487805,
|
| 126 |
+
"precision": 0.08333333333333333,
|
| 127 |
+
"recall": 0.034482758620689655
|
| 128 |
+
},
|
| 129 |
+
"new": {
|
| 130 |
+
"f1": 0.208955223880597,
|
| 131 |
+
"precision": 0.13333333333333333,
|
| 132 |
+
"recall": 0.4827586206896552
|
| 133 |
+
}
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"pathology": "Pneumonia",
|
| 137 |
+
"auroc": 0.6679357021996615,
|
| 138 |
+
"threshold_old": 0.5,
|
| 139 |
+
"threshold_new": 0.01452414970844984,
|
| 140 |
+
"old": {
|
| 141 |
+
"f1": 0.0,
|
| 142 |
+
"precision": 0.0,
|
| 143 |
+
"recall": 0.0
|
| 144 |
+
},
|
| 145 |
+
"new": {
|
| 146 |
+
"f1": 0.056338028169014086,
|
| 147 |
+
"precision": 0.029411764705882353,
|
| 148 |
+
"recall": 0.6666666666666666
|
| 149 |
+
}
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"pathology": "Pleural_Thickening",
|
| 153 |
+
"auroc": 0.7466666666666666,
|
| 154 |
+
"threshold_old": 0.5,
|
| 155 |
+
"threshold_new": 0.027503035962581635,
|
| 156 |
+
"old": {
|
| 157 |
+
"f1": 0.0,
|
| 158 |
+
"precision": 0.0,
|
| 159 |
+
"recall": 0.0
|
| 160 |
+
},
|
| 161 |
+
"new": {
|
| 162 |
+
"f1": 0.07272727272727272,
|
| 163 |
+
"precision": 0.0380952380952381,
|
| 164 |
+
"recall": 0.8
|
| 165 |
+
}
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"pathology": "Cardiomegaly",
|
| 169 |
+
"auroc": 0.9929113924050632,
|
| 170 |
+
"threshold_old": 0.5,
|
| 171 |
+
"threshold_new": 0.08342594653367996,
|
| 172 |
+
"old": {
|
| 173 |
+
"f1": 0.5714285714285714,
|
| 174 |
+
"precision": 1.0,
|
| 175 |
+
"recall": 0.4
|
| 176 |
+
},
|
| 177 |
+
"new": {
|
| 178 |
+
"f1": 0.2,
|
| 179 |
+
"precision": 0.1111111111111111,
|
| 180 |
+
"recall": 1.0
|
| 181 |
+
}
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"pathology": "Nodule",
|
| 185 |
+
"auroc": 0.5803413120567376,
|
| 186 |
+
"threshold_old": 0.5,
|
| 187 |
+
"threshold_new": 0.04766174405813217,
|
| 188 |
+
"old": {
|
| 189 |
+
"f1": 0.06896551724137931,
|
| 190 |
+
"precision": 0.2,
|
| 191 |
+
"recall": 0.041666666666666664
|
| 192 |
+
},
|
| 193 |
+
"new": {
|
| 194 |
+
"f1": 0.12807881773399016,
|
| 195 |
+
"precision": 0.07262569832402235,
|
| 196 |
+
"recall": 0.5416666666666666
|
| 197 |
+
}
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"pathology": "Mass",
|
| 201 |
+
"auroc": 0.6666666666666666,
|
| 202 |
+
"threshold_old": 0.5,
|
| 203 |
+
"threshold_new": 0.05993369594216347,
|
| 204 |
+
"old": {
|
| 205 |
+
"f1": 0.25,
|
| 206 |
+
"precision": 0.2857142857142857,
|
| 207 |
+
"recall": 0.2222222222222222
|
| 208 |
+
},
|
| 209 |
+
"new": {
|
| 210 |
+
"f1": 0.06666666666666667,
|
| 211 |
+
"precision": 0.03482587064676617,
|
| 212 |
+
"recall": 0.7777777777777778
|
| 213 |
+
}
|
| 214 |
+
}
|
| 215 |
+
],
|
| 216 |
+
"summary": {
|
| 217 |
+
"avg_f1_old": 0.08535674662112935,
|
| 218 |
+
"avg_f1_new": 0.16847648591212516,
|
| 219 |
+
"avg_precision_old": 0.1863095238095238,
|
| 220 |
+
"avg_precision_new": 0.10302120473709786,
|
| 221 |
+
"avg_recall_old": 0.06198551608034367,
|
| 222 |
+
"avg_recall_new": 0.7001600986061058,
|
| 223 |
+
"avg_auroc": 0.7437141189805497
|
| 224 |
+
}
|
| 225 |
+
}
|
metrics/baseline_vs_compressed.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_test_samples": 1045,
|
| 3 |
+
"baseline_params": 6966034,
|
| 4 |
+
"compressed_params": 3383248,
|
| 5 |
+
"baseline_mean_auroc": 0.7780991651116806,
|
| 6 |
+
"compressed_mean_auroc": 0.7785241795949782,
|
| 7 |
+
"compression_pct": 51.432220973943,
|
| 8 |
+
"auroc_delta": 0.00042501448329756997,
|
| 9 |
+
"baseline_per_pathology": {
|
| 10 |
+
"Atelectasis": 0.7485004019541155,
|
| 11 |
+
"Consolidation": 0.7956338208331557,
|
| 12 |
+
"Infiltration": 0.6606524512484053,
|
| 13 |
+
"Pneumothorax": 0.7888101324657216,
|
| 14 |
+
"Edema": 0.8795579219102936,
|
| 15 |
+
"Emphysema": 0.6372302827380952,
|
| 16 |
+
"Fibrosis": 0.7325585818624467,
|
| 17 |
+
"Effusion": 0.8229508196721311,
|
| 18 |
+
"Pneumonia": 0.7992900935785737,
|
| 19 |
+
"Pleural_Thickening": 0.747797656888566,
|
| 20 |
+
"Cardiomegaly": 0.953643429202667,
|
| 21 |
+
"Nodule": 0.649755204245618,
|
| 22 |
+
"Mass": 0.7155582396014192,
|
| 23 |
+
"Hernia": 0.9614492753623188
|
| 24 |
+
},
|
| 25 |
+
"compressed_per_pathology": {
|
| 26 |
+
"Atelectasis": 0.7500051532578896,
|
| 27 |
+
"Consolidation": 0.7960815247516311,
|
| 28 |
+
"Infiltration": 0.6610364758259782,
|
| 29 |
+
"Pneumothorax": 0.7908242311565574,
|
| 30 |
+
"Edema": 0.8793965795417877,
|
| 31 |
+
"Emphysema": 0.640531994047619,
|
| 32 |
+
"Fibrosis": 0.731246195982958,
|
| 33 |
+
"Effusion": 0.8236401849516604,
|
| 34 |
+
"Pneumonia": 0.7971119716037431,
|
| 35 |
+
"Pleural_Thickening": 0.7488193624557261,
|
| 36 |
+
"Cardiomegaly": 0.953643429202667,
|
| 37 |
+
"Nodule": 0.6492693500766156,
|
| 38 |
+
"Mass": 0.7143504189627841,
|
| 39 |
+
"Hernia": 0.9633816425120774
|
| 40 |
+
}
|
| 41 |
+
}
|
metrics/eval_nih_weights.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"densenet121-res224-all": {
|
| 3 |
+
"mean_auroc": 0.7780991651116805,
|
| 4 |
+
"per_pathology": {
|
| 5 |
+
"Atelectasis": 0.7485004019541155,
|
| 6 |
+
"Consolidation": 0.7956338208331557,
|
| 7 |
+
"Infiltration": 0.6606524512484053,
|
| 8 |
+
"Pneumothorax": 0.7888101324657215,
|
| 9 |
+
"Edema": 0.8795579219102936,
|
| 10 |
+
"Emphysema": 0.6372302827380952,
|
| 11 |
+
"Fibrosis": 0.7325585818624467,
|
| 12 |
+
"Effusion": 0.8229508196721311,
|
| 13 |
+
"Pneumonia": 0.7992900935785736,
|
| 14 |
+
"Pleural_Thickening": 0.747797656888566,
|
| 15 |
+
"Cardiomegaly": 0.953643429202667,
|
| 16 |
+
"Nodule": 0.649755204245618,
|
| 17 |
+
"Mass": 0.7155582396014193,
|
| 18 |
+
"Hernia": 0.9614492753623187
|
| 19 |
+
},
|
| 20 |
+
"ms_per_image": 14.936776366530424
|
| 21 |
+
},
|
| 22 |
+
"densenet121-res224-nih": {
|
| 23 |
+
"mean_auroc": 0.7524074761557032,
|
| 24 |
+
"per_pathology": {
|
| 25 |
+
"Atelectasis": 0.7468822789767693,
|
| 26 |
+
"Consolidation": 0.7790687758495716,
|
| 27 |
+
"Infiltration": 0.6114647608633392,
|
| 28 |
+
"Pneumothorax": 0.7621814238128438,
|
| 29 |
+
"Edema": 0.8793965795417877,
|
| 30 |
+
"Emphysema": 0.684477306547619,
|
| 31 |
+
"Fibrosis": 0.7376559646987219,
|
| 32 |
+
"Effusion": 0.8017822614543927,
|
| 33 |
+
"Pneumonia": 0.7049048080025814,
|
| 34 |
+
"Pleural_Thickening": 0.7584915084915085,
|
| 35 |
+
"Cardiomegaly": 0.9384542549414132,
|
| 36 |
+
"Nodule": 0.6059348955413536,
|
| 37 |
+
"Mass": 0.6944591228202612,
|
| 38 |
+
"Hernia": 0.8285507246376812
|
| 39 |
+
},
|
| 40 |
+
"ms_per_image": 15.50239398719021
|
| 41 |
+
},
|
| 42 |
+
"densenet121-res224-chex": {
|
| 43 |
+
"mean_auroc": 0.7424883832759307,
|
| 44 |
+
"per_pathology": {
|
| 45 |
+
"Atelectasis": 0.6807247541895987,
|
| 46 |
+
"Consolidation": 0.7673431970323626,
|
| 47 |
+
"Pneumothorax": 0.560965218064916,
|
| 48 |
+
"Edema": 0.8693933526944175,
|
| 49 |
+
"Effusion": 0.756754939050021,
|
| 50 |
+
"Pneumonia": 0.7333817360438851,
|
| 51 |
+
"Cardiomegaly": 0.8288554858563142
|
| 52 |
+
},
|
| 53 |
+
"ms_per_image": 15.325347088170394
|
| 54 |
+
},
|
| 55 |
+
"densenet121-res224-mimic_nb": {
|
| 56 |
+
"mean_auroc": 0.7049031491784382,
|
| 57 |
+
"per_pathology": {
|
| 58 |
+
"Atelectasis": 0.6763238719518478,
|
| 59 |
+
"Consolidation": 0.6948364814735855,
|
| 60 |
+
"Pneumothorax": 0.632446355256023,
|
| 61 |
+
"Edema": 0.8654404646660212,
|
| 62 |
+
"Effusion": 0.7896258932324506,
|
| 63 |
+
"Pneumonia": 0.46644078735075833,
|
| 64 |
+
"Cardiomegaly": 0.8092081903183809
|
| 65 |
+
},
|
| 66 |
+
"ms_per_image": 14.785645909286572
|
| 67 |
+
},
|
| 68 |
+
"densenet121-res224-mimic_ch": {
|
| 69 |
+
"mean_auroc": 0.717831448296221,
|
| 70 |
+
"per_pathology": {
|
| 71 |
+
"Atelectasis": 0.6628635623441139,
|
| 72 |
+
"Consolidation": 0.7029591097087793,
|
| 73 |
+
"Pneumothorax": 0.7114803625377644,
|
| 74 |
+
"Edema": 0.8822200709906421,
|
| 75 |
+
"Effusion": 0.7809079445145019,
|
| 76 |
+
"Pneumonia": 0.505243626976444,
|
| 77 |
+
"Cardiomegaly": 0.779145461001302
|
| 78 |
+
},
|
| 79 |
+
"ms_per_image": 14.503348729256809
|
| 80 |
+
}
|
| 81 |
+
}
|
metrics/minimal_retrain.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_train": 3544,
|
| 3 |
+
"n_test": 1045,
|
| 4 |
+
"trainable_params": 18450,
|
| 5 |
+
"n_epochs": 30,
|
| 6 |
+
"time_forward_train": 53.12885046005249,
|
| 7 |
+
"time_forward_test": 15.548182725906372,
|
| 8 |
+
"time_classifier_train": 1.5586333274841309,
|
| 9 |
+
"time_total": 70.235666513443,
|
| 10 |
+
"best_auroc": 0.7958435729902419,
|
| 11 |
+
"per_pathology": {
|
| 12 |
+
"Atelectasis": {
|
| 13 |
+
"auroc_orig": 0.7500051532578896,
|
| 14 |
+
"auroc_new": 0.7385855337744522,
|
| 15 |
+
"f1_orig": 0.07339449541284404,
|
| 16 |
+
"f1_new": 0.01904761904761905,
|
| 17 |
+
"recall_orig": 0.038834951456310676,
|
| 18 |
+
"recall_new": 0.009708737864077669
|
| 19 |
+
},
|
| 20 |
+
"Consolidation": {
|
| 21 |
+
"auroc_orig": 0.7960815247516311,
|
| 22 |
+
"auroc_new": 0.8197458747281797,
|
| 23 |
+
"f1_orig": 0.041666666666666664,
|
| 24 |
+
"f1_new": 0.0,
|
| 25 |
+
"recall_orig": 0.02127659574468085,
|
| 26 |
+
"recall_new": 0.0
|
| 27 |
+
},
|
| 28 |
+
"Infiltration": {
|
| 29 |
+
"auroc_orig": 0.6610364758259782,
|
| 30 |
+
"auroc_new": 0.6723424197453721,
|
| 31 |
+
"f1_orig": 0.011049723756906077,
|
| 32 |
+
"f1_new": 0.07368421052631578,
|
| 33 |
+
"recall_orig": 0.005649717514124294,
|
| 34 |
+
"recall_new": 0.03954802259887006
|
| 35 |
+
},
|
| 36 |
+
"Pneumothorax": {
|
| 37 |
+
"auroc_orig": 0.7908242311565574,
|
| 38 |
+
"auroc_new": 0.8066465256797584,
|
| 39 |
+
"f1_orig": 0.0,
|
| 40 |
+
"f1_new": 0.0,
|
| 41 |
+
"recall_orig": 0.0,
|
| 42 |
+
"recall_new": 0.0
|
| 43 |
+
},
|
| 44 |
+
"Edema": {
|
| 45 |
+
"auroc_orig": 0.8793965795417877,
|
| 46 |
+
"auroc_new": 0.8959341723136496,
|
| 47 |
+
"f1_orig": 0.0,
|
| 48 |
+
"f1_new": 0.0,
|
| 49 |
+
"recall_orig": 0.0,
|
| 50 |
+
"recall_new": 0.0
|
| 51 |
+
},
|
| 52 |
+
"Emphysema": {
|
| 53 |
+
"auroc_orig": 0.640531994047619,
|
| 54 |
+
"auroc_new": 0.6788969494047619,
|
| 55 |
+
"f1_orig": 0.0,
|
| 56 |
+
"f1_new": 0.0,
|
| 57 |
+
"recall_orig": 0.0,
|
| 58 |
+
"recall_new": 0.0
|
| 59 |
+
},
|
| 60 |
+
"Fibrosis": {
|
| 61 |
+
"auroc_orig": 0.731246195982958,
|
| 62 |
+
"auroc_new": 0.7930614729153986,
|
| 63 |
+
"f1_orig": 0.0,
|
| 64 |
+
"f1_new": 0.0,
|
| 65 |
+
"recall_orig": 0.0,
|
| 66 |
+
"recall_new": 0.0
|
| 67 |
+
},
|
| 68 |
+
"Effusion": {
|
| 69 |
+
"auroc_orig": 0.8236401849516604,
|
| 70 |
+
"auroc_new": 0.8451113913408995,
|
| 71 |
+
"f1_orig": 0.30526315789473685,
|
| 72 |
+
"f1_new": 0.23952095808383234,
|
| 73 |
+
"recall_orig": 0.2230769230769231,
|
| 74 |
+
"recall_new": 0.15384615384615385
|
| 75 |
+
},
|
| 76 |
+
"Pneumonia": {
|
| 77 |
+
"auroc_orig": 0.7971119716037431,
|
| 78 |
+
"auroc_new": 0.803162310422717,
|
| 79 |
+
"f1_orig": 0.0,
|
| 80 |
+
"f1_new": 0.0,
|
| 81 |
+
"recall_orig": 0.0,
|
| 82 |
+
"recall_new": 0.0
|
| 83 |
+
},
|
| 84 |
+
"Pleural_Thickening": {
|
| 85 |
+
"auroc_orig": 0.7488193624557261,
|
| 86 |
+
"auroc_new": 0.7974298428843882,
|
| 87 |
+
"f1_orig": 0.0,
|
| 88 |
+
"f1_new": 0.0,
|
| 89 |
+
"recall_orig": 0.0,
|
| 90 |
+
"recall_new": 0.0
|
| 91 |
+
},
|
| 92 |
+
"Cardiomegaly": {
|
| 93 |
+
"auroc_orig": 0.953643429202667,
|
| 94 |
+
"auroc_new": 0.9630331005641694,
|
| 95 |
+
"f1_orig": 0.4578313253012048,
|
| 96 |
+
"f1_new": 0.49411764705882355,
|
| 97 |
+
"recall_orig": 0.37254901960784315,
|
| 98 |
+
"recall_new": 0.4117647058823529
|
| 99 |
+
},
|
| 100 |
+
"Nodule": {
|
| 101 |
+
"auroc_orig": 0.6492693500766156,
|
| 102 |
+
"auroc_new": 0.6475128003886833,
|
| 103 |
+
"f1_orig": 0.03389830508474576,
|
| 104 |
+
"f1_new": 0.0,
|
| 105 |
+
"recall_orig": 0.018518518518518517,
|
| 106 |
+
"recall_new": 0.0
|
| 107 |
+
},
|
| 108 |
+
"Mass": {
|
| 109 |
+
"auroc_orig": 0.7143504189627841,
|
| 110 |
+
"auroc_new": 0.7253717822903298,
|
| 111 |
+
"f1_orig": 0.09302325581395349,
|
| 112 |
+
"f1_new": 0.0,
|
| 113 |
+
"recall_orig": 0.07692307692307693,
|
| 114 |
+
"recall_new": 0.0
|
| 115 |
+
},
|
| 116 |
+
"Hernia": {
|
| 117 |
+
"auroc_orig": 0.9633816425120774,
|
| 118 |
+
"auroc_new": 0.9549758454106281,
|
| 119 |
+
"f1_orig": 0.7619047619047619,
|
| 120 |
+
"f1_new": 0.5333333333333333,
|
| 121 |
+
"recall_orig": 0.8,
|
| 122 |
+
"recall_new": 0.4
|
| 123 |
+
}
|
| 124 |
+
},
|
| 125 |
+
"mean_auroc_orig": 0.7785241795949782,
|
| 126 |
+
"mean_auroc_new": 0.7958435729902419,
|
| 127 |
+
"mean_f1_orig": 0.12700226370255854,
|
| 128 |
+
"mean_f1_new": 0.09712169771785173,
|
| 129 |
+
"mean_recall_orig": 0.11120205734581982,
|
| 130 |
+
"mean_recall_new": 0.0724905442993896
|
| 131 |
+
}
|
metrics/minimal_retrain_v2.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"params_A": 18450,
|
| 3 |
+
"time_A": 7.310358047485352,
|
| 4 |
+
"params_B": 108309,
|
| 5 |
+
"time_B": 7.797998666763306,
|
| 6 |
+
"time_cache": 77.44846630096436,
|
| 7 |
+
"baseline_auroc": 0.7785241795949782,
|
| 8 |
+
"baseline_f1_05": 0.12700226370255854,
|
| 9 |
+
"A_thresholds": {
|
| 10 |
+
"Atelectasis": 0.07627483457326889,
|
| 11 |
+
"Consolidation": 0.013669912703335285,
|
| 12 |
+
"Infiltration": 0.1382860392332077,
|
| 13 |
+
"Pneumothorax": 0.013389605097472668,
|
| 14 |
+
"Edema": 0.006400782149285078,
|
| 15 |
+
"Emphysema": 0.01267245877534151,
|
| 16 |
+
"Fibrosis": 0.040671397000551224,
|
| 17 |
+
"Effusion": 0.18531498312950134,
|
| 18 |
+
"Pneumonia": 0.003466638969257474,
|
| 19 |
+
"Pleural_Thickening": 0.012083956971764565,
|
| 20 |
+
"Cardiomegaly": 0.00949457474052906,
|
| 21 |
+
"Nodule": 0.02881845273077488,
|
| 22 |
+
"Mass": 0.05119994655251503,
|
| 23 |
+
"Hernia": 0.5,
|
| 24 |
+
"Lung Lesion": 0.5,
|
| 25 |
+
"Fracture": 0.5,
|
| 26 |
+
"Lung Opacity": 0.5,
|
| 27 |
+
"Enlarged Cardiomediastinum": 0.5
|
| 28 |
+
},
|
| 29 |
+
"B_thresholds": {
|
| 30 |
+
"Atelectasis": 0.06119315326213837,
|
| 31 |
+
"Consolidation": 0.01689857803285122,
|
| 32 |
+
"Infiltration": 0.13535840809345245,
|
| 33 |
+
"Pneumothorax": 0.007273209281265736,
|
| 34 |
+
"Edema": 0.005829972214996815,
|
| 35 |
+
"Emphysema": 0.007729589007794857,
|
| 36 |
+
"Fibrosis": 0.0443153940141201,
|
| 37 |
+
"Effusion": 0.21586214005947113,
|
| 38 |
+
"Pneumonia": 0.00483460770919919,
|
| 39 |
+
"Pleural_Thickening": 0.013916002586483955,
|
| 40 |
+
"Cardiomegaly": 0.00925687700510025,
|
| 41 |
+
"Nodule": 0.027042903006076813,
|
| 42 |
+
"Mass": 0.07016012817621231,
|
| 43 |
+
"Hernia": 0.5,
|
| 44 |
+
"Lung Lesion": 0.5,
|
| 45 |
+
"Fracture": 0.5,
|
| 46 |
+
"Lung Opacity": 0.5,
|
| 47 |
+
"Enlarged Cardiomediastinum": 0.5
|
| 48 |
+
}
|
| 49 |
+
}
|
metrics/q_conflict_legitimacy.json
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"polarized_ch_total": 100,
|
| 3 |
+
"legitimacy_counts": {
|
| 4 |
+
"perfect": 48,
|
| 5 |
+
"legitimate": 41,
|
| 6 |
+
"mixed": 11,
|
| 7 |
+
"conflict": 0
|
| 8 |
+
},
|
| 9 |
+
"real_conflict_ch_count": 0,
|
| 10 |
+
"real_conflict_examples": [],
|
| 11 |
+
"top_pair_legitimacy": [
|
| 12 |
+
{
|
| 13 |
+
"pair": [
|
| 14 |
+
"Fibrosis",
|
| 15 |
+
"Pneumothorax"
|
| 16 |
+
],
|
| 17 |
+
"n_ch_polarized": 7,
|
| 18 |
+
"jaccard": 0.0,
|
| 19 |
+
"both_positive": 0
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"pair": [
|
| 23 |
+
"Effusion",
|
| 24 |
+
"Hernia"
|
| 25 |
+
],
|
| 26 |
+
"n_ch_polarized": 7,
|
| 27 |
+
"jaccard": 0.010526315789473684,
|
| 28 |
+
"both_positive": 1
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"pair": [
|
| 32 |
+
"Edema",
|
| 33 |
+
"Pneumothorax"
|
| 34 |
+
],
|
| 35 |
+
"n_ch_polarized": 6,
|
| 36 |
+
"jaccard": 0.0,
|
| 37 |
+
"both_positive": 0
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"pair": [
|
| 41 |
+
"Mass",
|
| 42 |
+
"Pleural_Thickening"
|
| 43 |
+
],
|
| 44 |
+
"n_ch_polarized": 6,
|
| 45 |
+
"jaccard": 0.13793103448275862,
|
| 46 |
+
"both_positive": 4
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"pair": [
|
| 50 |
+
"Consolidation",
|
| 51 |
+
"Hernia"
|
| 52 |
+
],
|
| 53 |
+
"n_ch_polarized": 6,
|
| 54 |
+
"jaccard": 0.0,
|
| 55 |
+
"both_positive": 0
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"pair": [
|
| 59 |
+
"Fibrosis",
|
| 60 |
+
"Hernia"
|
| 61 |
+
],
|
| 62 |
+
"n_ch_polarized": 5,
|
| 63 |
+
"jaccard": 0.0,
|
| 64 |
+
"both_positive": 0
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"pair": [
|
| 68 |
+
"Effusion",
|
| 69 |
+
"Fibrosis"
|
| 70 |
+
],
|
| 71 |
+
"n_ch_polarized": 5,
|
| 72 |
+
"jaccard": 0.06422018348623854,
|
| 73 |
+
"both_positive": 7
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"pair": [
|
| 77 |
+
"Emphysema",
|
| 78 |
+
"Pleural_Thickening"
|
| 79 |
+
],
|
| 80 |
+
"n_ch_polarized": 5,
|
| 81 |
+
"jaccard": 0.037037037037037035,
|
| 82 |
+
"both_positive": 1
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"pair": [
|
| 86 |
+
"Emphysema",
|
| 87 |
+
"Hernia"
|
| 88 |
+
],
|
| 89 |
+
"n_ch_polarized": 5,
|
| 90 |
+
"jaccard": 0.0,
|
| 91 |
+
"both_positive": 0
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"pair": [
|
| 95 |
+
"Hernia",
|
| 96 |
+
"Pneumonia"
|
| 97 |
+
],
|
| 98 |
+
"n_ch_polarized": 4,
|
| 99 |
+
"jaccard": 0.0,
|
| 100 |
+
"both_positive": 0
|
| 101 |
+
},
|
| 102 |
+
{
|
| 103 |
+
"pair": [
|
| 104 |
+
"Enlarged Cardiomediastinum",
|
| 105 |
+
"Hernia"
|
| 106 |
+
],
|
| 107 |
+
"n_ch_polarized": 4,
|
| 108 |
+
"jaccard": 0.0,
|
| 109 |
+
"both_positive": 0
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"pair": [
|
| 113 |
+
"Hernia",
|
| 114 |
+
"Pneumothorax"
|
| 115 |
+
],
|
| 116 |
+
"n_ch_polarized": 4,
|
| 117 |
+
"jaccard": 0.0,
|
| 118 |
+
"both_positive": 0
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"pair": [
|
| 122 |
+
"Hernia",
|
| 123 |
+
"Mass"
|
| 124 |
+
],
|
| 125 |
+
"n_ch_polarized": 4,
|
| 126 |
+
"jaccard": 0.05555555555555555,
|
| 127 |
+
"both_positive": 1
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"pair": [
|
| 131 |
+
"Fracture",
|
| 132 |
+
"Mass"
|
| 133 |
+
],
|
| 134 |
+
"n_ch_polarized": 4,
|
| 135 |
+
"jaccard": 0.0,
|
| 136 |
+
"both_positive": 0
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"pair": [
|
| 140 |
+
"Mass",
|
| 141 |
+
"Pneumothorax"
|
| 142 |
+
],
|
| 143 |
+
"n_ch_polarized": 4,
|
| 144 |
+
"jaccard": 0.04,
|
| 145 |
+
"both_positive": 1
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"pair": [
|
| 149 |
+
"Cardiomegaly",
|
| 150 |
+
"Emphysema"
|
| 151 |
+
],
|
| 152 |
+
"n_ch_polarized": 4,
|
| 153 |
+
"jaccard": 0.0,
|
| 154 |
+
"both_positive": 0
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"pair": [
|
| 158 |
+
"Hernia",
|
| 159 |
+
"Pleural_Thickening"
|
| 160 |
+
],
|
| 161 |
+
"n_ch_polarized": 4,
|
| 162 |
+
"jaccard": 0.0,
|
| 163 |
+
"both_positive": 0
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"pair": [
|
| 167 |
+
"Lung Opacity",
|
| 168 |
+
"Pleural_Thickening"
|
| 169 |
+
],
|
| 170 |
+
"n_ch_polarized": 3,
|
| 171 |
+
"jaccard": 0.0,
|
| 172 |
+
"both_positive": 0
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"pair": [
|
| 176 |
+
"Nodule",
|
| 177 |
+
"Pleural_Thickening"
|
| 178 |
+
],
|
| 179 |
+
"n_ch_polarized": 3,
|
| 180 |
+
"jaccard": 0.04878048780487805,
|
| 181 |
+
"both_positive": 2
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"pair": [
|
| 185 |
+
"Cardiomegaly",
|
| 186 |
+
"Hernia"
|
| 187 |
+
],
|
| 188 |
+
"n_ch_polarized": 3,
|
| 189 |
+
"jaccard": 0.04081632653061224,
|
| 190 |
+
"both_positive": 2
|
| 191 |
+
}
|
| 192 |
+
],
|
| 193 |
+
"pathology_jaccard_matrix": {
|
| 194 |
+
"Effusion__Cardiomegaly": 0.17699115044247787,
|
| 195 |
+
"Atelectasis__Effusion": 0.17424242424242425,
|
| 196 |
+
"Infiltration__Effusion": 0.1625,
|
| 197 |
+
"Edema__Cardiomegaly": 0.15555555555555556,
|
| 198 |
+
"Pleural_Thickening__Mass": 0.13793103448275862,
|
| 199 |
+
"Atelectasis__Infiltration": 0.13194444444444445,
|
| 200 |
+
"Fibrosis__Pleural_Thickening": 0.11627906976744186,
|
| 201 |
+
"Fibrosis__Nodule": 0.11363636363636363,
|
| 202 |
+
"Nodule__Mass": 0.0967741935483871,
|
| 203 |
+
"Atelectasis__Consolidation": 0.0963855421686747,
|
| 204 |
+
"Consolidation__Effusion": 0.09615384615384616,
|
| 205 |
+
"Consolidation__Nodule": 0.09302325581395349,
|
| 206 |
+
"Infiltration__Cardiomegaly": 0.09302325581395349,
|
| 207 |
+
"Consolidation__Mass": 0.08823529411764706,
|
| 208 |
+
"Effusion__Pleural_Thickening": 0.0784313725490196,
|
| 209 |
+
"Edema__Pneumonia": 0.07692307692307693,
|
| 210 |
+
"Consolidation__Pleural_Thickening": 0.06976744186046512,
|
| 211 |
+
"Infiltration__Fibrosis": 0.06896551724137931,
|
| 212 |
+
"Consolidation__Edema": 0.06451612903225806,
|
| 213 |
+
"Fibrosis__Effusion": 0.06422018348623854,
|
| 214 |
+
"Effusion__Nodule": 0.05714285714285714,
|
| 215 |
+
"Mass__Hernia": 0.05555555555555555,
|
| 216 |
+
"Infiltration__Nodule": 0.05309734513274336,
|
| 217 |
+
"Effusion__Mass": 0.052083333333333336,
|
| 218 |
+
"Consolidation__Infiltration": 0.05172413793103448,
|
| 219 |
+
"Pneumothorax__Emphysema": 0.05,
|
| 220 |
+
"Pleural_Thickening__Nodule": 0.04878048780487805,
|
| 221 |
+
"Atelectasis__Pleural_Thickening": 0.04819277108433735,
|
| 222 |
+
"Edema__Effusion": 0.043010752688172046,
|
| 223 |
+
"Pneumonia__Cardiomegaly": 0.041666666666666664
|
| 224 |
+
}
|
| 225 |
+
}
|
metrics/surgery_channel_ablation.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"baseline": {
|
| 3 |
+
"fp_prob": 0.8913499116897583,
|
| 4 |
+
"tp_prob_avg": 0.4156641662120819,
|
| 5 |
+
"auroc": 0.9236941786283891
|
| 6 |
+
},
|
| 7 |
+
"K=1": {
|
| 8 |
+
"fp_prob": 0.8929352760314941,
|
| 9 |
+
"tp_prob_avg": 0.4644327461719513,
|
| 10 |
+
"auroc": 0.9286782296650717,
|
| 11 |
+
"tp_drop_count": 0,
|
| 12 |
+
"ablated_ch": [
|
| 13 |
+
1002
|
| 14 |
+
]
|
| 15 |
+
},
|
| 16 |
+
"K=3": {
|
| 17 |
+
"fp_prob": 0.8070836663246155,
|
| 18 |
+
"tp_prob_avg": 0.40393105149269104,
|
| 19 |
+
"auroc": 0.9243919457735248,
|
| 20 |
+
"tp_drop_count": 0,
|
| 21 |
+
"ablated_ch": [
|
| 22 |
+
1002,
|
| 23 |
+
654,
|
| 24 |
+
961
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
"K=5": {
|
| 28 |
+
"fp_prob": 0.7640870213508606,
|
| 29 |
+
"tp_prob_avg": 0.40278032422065735,
|
| 30 |
+
"auroc": 0.9220992822966507,
|
| 31 |
+
"tp_drop_count": 0,
|
| 32 |
+
"ablated_ch": [
|
| 33 |
+
1002,
|
| 34 |
+
654,
|
| 35 |
+
961,
|
| 36 |
+
1012,
|
| 37 |
+
665
|
| 38 |
+
]
|
| 39 |
+
},
|
| 40 |
+
"K=10": {
|
| 41 |
+
"fp_prob": 0.6739818453788757,
|
| 42 |
+
"tp_prob_avg": 0.41819897294044495,
|
| 43 |
+
"auroc": 0.927731259968102,
|
| 44 |
+
"tp_drop_count": 4,
|
| 45 |
+
"ablated_ch": [
|
| 46 |
+
1002,
|
| 47 |
+
654,
|
| 48 |
+
961,
|
| 49 |
+
1012,
|
| 50 |
+
665,
|
| 51 |
+
964,
|
| 52 |
+
1005,
|
| 53 |
+
657,
|
| 54 |
+
644,
|
| 55 |
+
973
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
"K=20": {
|
| 59 |
+
"fp_prob": 0.5440241098403931,
|
| 60 |
+
"tp_prob_avg": 0.43110406398773193,
|
| 61 |
+
"auroc": 0.9224980063795853,
|
| 62 |
+
"tp_drop_count": 7,
|
| 63 |
+
"ablated_ch": [
|
| 64 |
+
1002,
|
| 65 |
+
654,
|
| 66 |
+
961,
|
| 67 |
+
1012,
|
| 68 |
+
665,
|
| 69 |
+
964,
|
| 70 |
+
1005,
|
| 71 |
+
657,
|
| 72 |
+
644,
|
| 73 |
+
973,
|
| 74 |
+
978,
|
| 75 |
+
1003,
|
| 76 |
+
980,
|
| 77 |
+
1021,
|
| 78 |
+
110,
|
| 79 |
+
983,
|
| 80 |
+
899,
|
| 81 |
+
1000,
|
| 82 |
+
757,
|
| 83 |
+
590
|
| 84 |
+
]
|
| 85 |
+
},
|
| 86 |
+
"K=30": {
|
| 87 |
+
"fp_prob": 0.5440241098403931,
|
| 88 |
+
"tp_prob_avg": 0.43110406398773193,
|
| 89 |
+
"auroc": 0.9224980063795853,
|
| 90 |
+
"tp_drop_count": 7,
|
| 91 |
+
"ablated_ch": [
|
| 92 |
+
1002,
|
| 93 |
+
654,
|
| 94 |
+
961,
|
| 95 |
+
1012,
|
| 96 |
+
665,
|
| 97 |
+
964,
|
| 98 |
+
1005,
|
| 99 |
+
657,
|
| 100 |
+
644,
|
| 101 |
+
973,
|
| 102 |
+
978,
|
| 103 |
+
1003,
|
| 104 |
+
980,
|
| 105 |
+
1021,
|
| 106 |
+
110,
|
| 107 |
+
983,
|
| 108 |
+
899,
|
| 109 |
+
1000,
|
| 110 |
+
757,
|
| 111 |
+
590
|
| 112 |
+
]
|
| 113 |
+
}
|
| 114 |
+
}
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch>=2.0
|
| 2 |
+
torchvision
|
| 3 |
+
torchxrayvision>=1.0
|
| 4 |
+
pillow
|
| 5 |
+
numpy
|
| 6 |
+
scikit-learn
|