Commit
·
d656f6d
1
Parent(s):
8ad1b5d
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
pipeline_tag: image-to-text
|
4 |
+
---
|
5 |
+
# Model Card for Model ID
|
6 |
+
|
7 |
+
Trained on the MIMIC-CXR chest x-rays.
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
# Model Details
|
12 |
+
|
13 |
+
## Model Description
|
14 |
+
|
15 |
+
This model generates realistic radiology reports given an chest X-ray and a clinical indication (e.g. 'RLL crackles, eval for pneumonia').
|
16 |
+
|
17 |
+
- **Developed by:** Nathan Sutton
|
18 |
+
- **Model type:** BLIP
|
19 |
+
- **Language(s) (NLP):** English
|
20 |
+
- **License:** Apache 2.0
|
21 |
+
- **Finetuned from model [optional]:** Salesforce/blip-image-captioning-large
|
22 |
+
|
23 |
+
## Model Sources [optional]
|
24 |
+
|
25 |
+
- **Repository:** https://github.com/nathansutton/prerad
|
26 |
+
- **Paper [optional]:** https://medium.com/me/stats/post/b687a993cbb
|
27 |
+
- **Demo [optional]:** https://medium.com/me/stats/post/b687a993cbb
|
28 |
+
|
29 |
+
|
30 |
+
## Direct Use
|
31 |
+
|
32 |
+
Upload a chest x-ray in a JPG format along with a clinical indication (e.g. 'RLL crackles, eval for pneumonia'). It will generate a realistic looking radiology report.
|
33 |
+
|
34 |
+
## Out-of-Scope Use
|
35 |
+
|
36 |
+
Any medical application.
|
37 |
+
|
38 |
+
## How to Get Started with the Model
|
39 |
+
|
40 |
+
```
|
41 |
+
from PIL import Image
|
42 |
+
from transformers import BlipForConditionalGeneration, BlipProcessor
|
43 |
+
|
44 |
+
# read in the model
|
45 |
+
processor = BlipProcessor.from_pretrained("nathansutton/generate-cxr")
|
46 |
+
model = BlipForConditionalGeneration.from_pretrained("nathansutton/generate-cxr")
|
47 |
+
|
48 |
+
# your data
|
49 |
+
my_image = 'my-chest-x-ray.jpg'
|
50 |
+
my_indication = 'RLL crackles, eval for pneumonia'
|
51 |
+
|
52 |
+
# process the inputs
|
53 |
+
inputs = processor(
|
54 |
+
images=Image.open(my_image),
|
55 |
+
text='indication:' + my_indication,
|
56 |
+
return_tensors="pt"
|
57 |
+
)
|
58 |
+
|
59 |
+
# generate an entire radiology report
|
60 |
+
output = model.generate(**inputs,max_length=512)
|
61 |
+
report = processor.decode(output[0], skip_special_tokens=True)
|
62 |
+
|
63 |
+
```
|
64 |
+
|
65 |
+
# Training Details
|
66 |
+
|
67 |
+
## Training Data
|
68 |
+
|
69 |
+
This model was trained by cross-referencing the radiology reports in MIMIC-CXR with the images in the MIMIC-CXR-JPG. None are available here and require a data usage agreement with physionet.
|