flaviagiammarino commited on
Commit
699e237
1 Parent(s): dc082c8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -182
README.md CHANGED
@@ -12,188 +12,49 @@ widget:
12
  ---
13
  # Model Card for PubMedCLIP
14
 
15
- PubMedCLIP is a fine-tuned version of [CLIP](https://huggingface.co/docs/transformers/model_doc/clip) for the medical domain trained on a large number of medical
16
- image–text pairs obtained from [PubMed](https://pubmed.ncbi.nlm.nih.gov/) articles.
17
 
18
- ## Model Details
19
-
20
- ### Model Description
21
  PubMedCLIP was trained on the [Radiology Objects in COntext (ROCO)](https://github.com/razorx89/roco-dataset) dataset, a large-scale multimodal medical imaging dataset.
22
  The ROCO dataset includes diverse imaging modalities (such as ultrasound, X-Ray, MRI, etc.) from various human body regions (such as head, neck, spine, etc.)
23
- captured from open-access PubMed articles. The texts used for training PubMedCLIP were taken from the short captions associated with the images in the dataset.
24
-
25
- The authors of PubMedCLIP have released three different pre-trained models at this [link](https://1drv.ms/u/s!ApXgPqe9kykTgwD4Np3-f7ODAot8?e=zLVlJ2) using
26
- ResNet-50, ResNet-50x4 and ViT32 as image encoders. This repository includes only the ViT32 variant.
27
-
28
- ### Model Sources
29
-
30
- - **Repository:** [Official GitHub Repository](https://github.com/sarahESL/PubMedCLIP)
31
- - **Paper [optional]:** {{ paper | default("[More Information Needed]", true)}}
32
- - **Demo [optional]:** {{ demo | default("[More Information Needed]", true)}}
33
-
34
- ## Uses
35
-
36
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
37
-
38
- ### Direct Use
39
-
40
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
41
-
42
- {{ direct_use | default("[More Information Needed]", true)}}
43
-
44
- ### Downstream Use [optional]
45
-
46
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
47
-
48
- {{ downstream_use | default("[More Information Needed]", true)}}
49
-
50
- ### Out-of-Scope Use
51
-
52
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
53
-
54
- {{ out_of_scope_use | default("[More Information Needed]", true)}}
55
-
56
- ## Bias, Risks, and Limitations
57
-
58
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
59
-
60
- {{ bias_risks_limitations | default("[More Information Needed]", true)}}
61
-
62
- ### Recommendations
63
-
64
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
65
-
66
- {{ bias_recommendations | default("Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.", true)}}
67
-
68
- ## How to Get Started with the Model
69
-
70
- Use the code below to get started with the model.
71
-
72
- {{ get_started_code | default("[More Information Needed]", true)}}
73
-
74
- ## Training Details
75
-
76
- ### Training Data
77
-
78
- <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
79
-
80
- {{ training_data | default("[More Information Needed]", true)}}
81
-
82
- ### Training Procedure
83
-
84
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
85
-
86
- #### Preprocessing [optional]
87
-
88
- {{ preprocessing | default("[More Information Needed]", true)}}
89
-
90
-
91
- #### Training Hyperparameters
92
-
93
- - **Training regime:** {{ training_regime | default("[More Information Needed]", true)}} <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
94
-
95
- #### Speeds, Sizes, Times [optional]
96
-
97
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
98
-
99
- {{ speeds_sizes_times | default("[More Information Needed]", true)}}
100
-
101
- ## Evaluation
102
-
103
- <!-- This section describes the evaluation protocols and provides the results. -->
104
-
105
- ### Testing Data, Factors & Metrics
106
-
107
- #### Testing Data
108
-
109
- <!-- This should link to a Data Card if possible. -->
110
-
111
- {{ testing_data | default("[More Information Needed]", true)}}
112
-
113
- #### Factors
114
-
115
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
116
-
117
- {{ testing_factors | default("[More Information Needed]", true)}}
118
-
119
- #### Metrics
120
-
121
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
122
-
123
- {{ testing_metrics | default("[More Information Needed]", true)}}
124
-
125
- ### Results
126
-
127
- {{ results | default("[More Information Needed]", true)}}
128
-
129
- #### Summary
130
-
131
- {{ results_summary | default("", true) }}
132
-
133
- ## Model Examination [optional]
134
-
135
- <!-- Relevant interpretability work for the model goes here -->
136
-
137
- {{ model_examination | default("[More Information Needed]", true)}}
138
-
139
- ## Environmental Impact
140
-
141
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
142
-
143
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
144
-
145
- - **Hardware Type:** {{ hardware | default("[More Information Needed]", true)}}
146
- - **Hours used:** {{ hours_used | default("[More Information Needed]", true)}}
147
- - **Cloud Provider:** {{ cloud_provider | default("[More Information Needed]", true)}}
148
- - **Compute Region:** {{ cloud_region | default("[More Information Needed]", true)}}
149
- - **Carbon Emitted:** {{ co2_emitted | default("[More Information Needed]", true)}}
150
-
151
- ## Technical Specifications [optional]
152
-
153
- ### Model Architecture and Objective
154
-
155
- {{ model_specs | default("[More Information Needed]", true)}}
156
-
157
- ### Compute Infrastructure
158
-
159
- {{ compute_infrastructure | default("[More Information Needed]", true)}}
160
-
161
- #### Hardware
162
-
163
- {{ hardware | default("[More Information Needed]", true)}}
164
-
165
- #### Software
166
-
167
- {{ software | default("[More Information Needed]", true)}}
168
-
169
- ## Citation [optional]
170
-
171
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
172
-
173
- **BibTeX:**
174
-
175
- {{ citation_bibtex | default("[More Information Needed]", true)}}
176
-
177
- **APA:**
178
-
179
- {{ citation_apa | default("[More Information Needed]", true)}}
180
-
181
- ## Glossary [optional]
182
-
183
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
184
-
185
- {{ glossary | default("[More Information Needed]", true)}}
186
-
187
- ## More Information [optional]
188
-
189
- {{ more_information | default("[More Information Needed]", true)}}
190
-
191
- ## Model Card Authors [optional]
192
-
193
- {{ model_card_authors | default("[More Information Needed]", true)}}
194
-
195
- ## Model Card Contact
196
-
197
- {{ model_card_contact | default("[More Information Needed]", true)}}
198
-
199
-
 
12
  ---
13
  # Model Card for PubMedCLIP
14
 
15
+ PubMedCLIP is a fine-tuned version of [CLIP](https://huggingface.co/docs/transformers/model_doc/clip) for the medical domain.
 
16
 
17
+ ## Model Description
 
 
18
  PubMedCLIP was trained on the [Radiology Objects in COntext (ROCO)](https://github.com/razorx89/roco-dataset) dataset, a large-scale multimodal medical imaging dataset.
19
  The ROCO dataset includes diverse imaging modalities (such as ultrasound, X-Ray, MRI, etc.) from various human body regions (such as head, neck, spine, etc.)
20
+ captured from open-access [PubMed](https://pubmed.ncbi.nlm.nih.gov/) articles. The authors of PubMedCLIP have released three different pre-trained models at
21
+ this [link](https://1drv.ms/u/s!ApXgPqe9kykTgwD4Np3-f7ODAot8?e=zLVlJ2) which use ResNet-50, ResNet-50x4 and ViT32 as image encoders.
22
+ This repository includes only the ViT32 variant of the PubMedCLIP model.
23
+
24
+ - **Repository:** [PubMedCLIP Official GitHub Repository](https://github.com/sarahESL/PubMedCLIP)
25
+ - **Paper:** [Does CLIP Benefit Visual Question Answering in the Medical Domain as Much as it Does in the General Domain?](https://arxiv.org/abs/2112.13906)
26
+ - **Dataset:** [Radiology Objects in COntext (ROCO)](https://github.com/razorx89/roco-dataset)
27
+
28
+ ## Use
29
+
30
+ ```python
31
+ import requests
32
+ from PIL import Image
33
+
34
+ from transformers import CLIPProcessor, CLIPModel
35
+
36
+ model = CLIPModel.from_pretrained("flaviagiammarino/pubmed-clip-vit-base-patch32")
37
+ processor = CLIPProcessor.from_pretrained("flaviagiammarino/pubmed-clip-vit-base-patch32")
38
+
39
+ url = "https://d168r5mdg5gtkq.cloudfront.net/medpix/img/full/synpic9078.jpg"
40
+ image = Image.open(requests.get(url, stream=True).raw)
41
+ text = ["Chest X-Ray", "Brain MRI", "Abdominal CT Scan"]
42
+
43
+ inputs = processor(text=text, images=image, return_tensors="pt", padding=True)
44
+ probs = model(**inputs).logits_per_image.softmax(dim=1)
45
+ ```
46
+
47
+ ## Additional Information
48
+
49
+ ### Licensing Information
50
+ The authors have released the model code and pre-trained checkpoints under the [MIT License](https://github.com/sarahESL/PubMedCLIP/blob/main/LICENSE).
51
+
52
+ ### Citation Information
53
+ ```
54
+ @article{eslami2021does,
55
+ title={Does clip benefit visual question answering in the medical domain as much as it does in the general domain?},
56
+ author={Eslami, Sedigheh and de Melo, Gerard and Meinel, Christoph},
57
+ journal={arXiv preprint arXiv:2112.13906},
58
+ year={2021}
59
+ }
60
+ ```