File size: 3,180 Bytes
69bc7cf
 
 
 
 
 
 
 
 
1541f9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69bc7cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
license: mit
metrics:
- bertscore
- bleu
- rouge
base_model:
- microsoft/phi-2
---
# Dual-View SLaVA-CXR

**Dual-View SLaVA-CXR** is a vision-language model for structured radiology report generation from frontal and lateral chest X-rays. Built on the ReΒ³ (Recognize–Reason–Report) paradigm and extending the original SLaVA-CXR model, this project integrates dual-view vision fusion and leverages CLIP, BiomedCLIP, and Phi-2 for enhanced anatomical reasoning.

---

## πŸ“ Directory Structure

```bash
β”œβ”€β”€ Data Collection and Preprocessing/
β”‚   β”œβ”€β”€ Data_collection_Mimic.ipynb
β”‚   β”œβ”€β”€ Data_preprocess.ipynb
β”‚   β”œβ”€β”€ Radgraph Based Report Cleaning.ipynb
β”‚   └── train_data_json_gen.ipynb
β”‚
β”œβ”€β”€ Evaluate/
β”‚   β”œβ”€β”€ Evaluate.ipynb
β”‚   └── Results_IU_Xray/           # Contains evaluation results on IU X-ray dataset
β”‚
β”œβ”€β”€ llava_phi/
β”‚   β”œβ”€β”€ Dual Slava train.ipynb     # Training pipeline
β”‚   └── generation.ipynb           # Inference/report generation
β”‚
β”œβ”€β”€ requirements.txt
└── README.md
```

---

## 🧠 Key Contributions

- **Dual-Encoder Fusion**: Combines CLIP and BiomedCLIP for each view with learnable weight Ξ±:

- **Cross-View Attention**: Enables anatomical reasoning across views:

- **Gated Feature Fusion**:

- **ReΒ³ Pipeline**:
  1. **Recognize**: Generate Findings from images
  2. **Reason**: Infer Impression from Findings
  3. **Report**: Output structured radiology reports

---

## πŸ“Š Evaluation Metrics

| Dataset   | BLEU | ROUGE-L | METEOR | BERT | RadGraph F1 | CheXbert F1 |
| --------- | ---- | ------- | ------ | ---- | ----------- | ----------- |
| MIMIC-CXR | βœ…   | βœ…      | βœ…     | βœ…   | βœ…          | βœ…          |
| IU X-Ray  | βœ…   | βœ…      | βœ…     | βœ…   | βœ…          | βœ…          |

_(Results in `/Evaluate/Results_IU_Xray`)_

---

## πŸ› οΈ Setup

```bash
# Clone repo
git clone https://github.com/Clintonkjkj/Dual-View-Slava-CXR.git
cd Dual-View-Slava-CXR

# Set up virtual environment
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

---

## πŸš€ Usage

### Download the model

Huggingface - https://huggingface.co/CKJ26/Dual-View-Slava-Final

### πŸ‹οΈ Train the Model

Use `llava_phi/Dual Slava train.ipynb` after preparing data using:

- `Data_collection_Mimic.ipynb`
- `Data_preprocess.ipynb`
- `Radgraph Based Report Cleaning.ipynb`
- `train_data_json_gen.ipynb`

### πŸ“„ Generate Reports

Use `llava_phi/generation.ipynb` with both frontal and lateral views, plus a prompt (e.g., "Generate a radiology report").

---

## πŸ–ΌοΈ Model Architecture

![Architecture](architecture/arch_new_Updated.jpg)

---

## πŸ“š Citation

```bibtex
@misc{dualviewslava2025,
  title={Dual View SLaVA-CXR: Structured Radiology Reporting via Multi-View Chest X-rays},
  author={Clinton KJ et al.},
  year={2025},
  note={Capstone Project}
}
```

---

## πŸ§‘β€πŸ’» Author

- **Clinton KJ** β€” [Hugging Face Profile](https://huggingface.co/CKJ26)

---

## πŸ“œ License

This repository is provided for academic research purposes only.