Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- chest-xray
|
| 4 |
+
- radiology
|
| 5 |
+
- report-generation
|
| 6 |
+
- mimic-cxr
|
| 7 |
+
- vision-encoder
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# LAPVQA — Pretrain (Captioning)
|
| 12 |
+
|
| 13 |
+
Part of the [LAPVQA collection](https://huggingface.co/collections/dmusingu/lapvqa).
|
| 14 |
+
|
| 15 |
+
## Description
|
| 16 |
+
|
| 17 |
+
A **ViT-L/14 encoder + 6-layer causal decoder** trained from scratch on [MIMIC-CXR](https://physionet.org/content/mimic-cxr)
|
| 18 |
+
to generate full radiology reports from chest X-ray images.
|
| 19 |
+
Unlike the contrastive pretrain variants, this model uses a generative objective, forcing the encoder
|
| 20 |
+
to retain fine-grained spatial information sufficient for region-level text generation.
|
| 21 |
+
The encoder weights from this model serve as the strongest feature extractor in the LAPVQA downstream tasks.
|
| 22 |
+
|
| 23 |
+
## Architecture
|
| 24 |
+
|
| 25 |
+
| Component | Detail |
|
| 26 |
+
|---|---|
|
| 27 |
+
| Vision backbone | ViT-L/14, 24-layer, 1024-dim, 16-head, patch 14, 384 px |
|
| 28 |
+
| Captioning decoder | 6-layer causal transformer, 512-dim, GPT-2 vocab (50 257) |
|
| 29 |
+
| Loss | Cross-entropy over report tokens |
|
| 30 |
+
| Training data | MIMIC-CXR (physionet.org/content/mimic-cxr) |
|
| 31 |
+
|
| 32 |
+
## Downstream Evaluation (frozen encoder)
|
| 33 |
+
|
| 34 |
+
| Dataset | Mean AUC |
|
| 35 |
+
|---|---|
|
| 36 |
+
| NIH CXR-14 (14-class, linear probe) | — |
|
| 37 |
+
| CheXpert-5 (5-class, linear probe) | — |
|
| 38 |
+
|
| 39 |
+
The `encoder_final.pt` is used as a drop-in replacement for off-the-shelf encoders in the
|
| 40 |
+
VQA, DiffVQA, and RRG downstream repos in this collection.
|
| 41 |
+
|
| 42 |
+
## Files
|
| 43 |
+
|
| 44 |
+
| File | Description |
|
| 45 |
+
|---|---|
|
| 46 |
+
| `encoder_final.pt` | Vision encoder weights (used as frozen feature extractor downstream) |
|
| 47 |
+
| `model_best.pt` | Full encoder + decoder at best validation CIDEr |
|
| 48 |
+
|
| 49 |
+
## Usage
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
import torch
|
| 53 |
+
from lapvqa.pretrain.model import CaptioningModel
|
| 54 |
+
|
| 55 |
+
ckpt = torch.load("model_best.pt", map_location="cpu")
|
| 56 |
+
model = CaptioningModel()
|
| 57 |
+
model.load_state_dict(ckpt)
|
| 58 |
+
model.eval()
|
| 59 |
+
```
|