raman07 commited on
Commit
d48a2fc
1 Parent(s): 742ddc4

model card created

Browse files
Files changed (1) hide show
  1. README.md +115 -0
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: diffusers
3
+ pipeline_tag: text-to-image
4
+ language:
5
+ - en
6
+ ---
7
+
8
+ ## Model Details
9
+
10
+ ### Model Description
11
+
12
+ This model is fine-tuned from [stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5) on 110,000 image-text pairs from the MIMIC dataset using the Bias tuning PEFT method. Under this fine-tuning strategy, fine-tune only the bias weights in the U-Net while keeping everything else frozen.
13
+
14
+ - **Developed by:** [Raman Dutt](https://twitter.com/RamanDutt4)
15
+ - **Shared by:** [Raman Dutt](https://twitter.com/RamanDutt4)
16
+ - **Model type:** [Stable Diffusion fine-tuned using Parameter-Efficient Fine-Tuning]
17
+ - **Finetuned from model:** [stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5)
18
+
19
+ ### Model Sources
20
+
21
+
22
+ - **Paper:** [Parameter-Efficient Fine-Tuning for Medical Image Analysis: The Missed Opportunity](https://arxiv.org/abs/2305.08252)
23
+ - **Demo:** [MIMIC-SD-PEFT-Demo](https://huggingface.co/spaces/raman07/MIMIC-SD-Demo-Memory-Optimized?logs=container)
24
+
25
+ ## Direct Use
26
+
27
+ This model can be directly used to generate realistic medical images from text prompts.
28
+
29
+
30
+ ## How to Get Started with the Model
31
+
32
+ ```python
33
+ import os
34
+ from safetensors.torch import load_file
35
+ from diffusers.pipelines import StableDiffusionPipeline
36
+
37
+ pipe = StableDiffusionPipeline.from_pretrained(sd_folder_path, revision="fp16")
38
+ exp_path = os.path.join('unet', 'diffusion_pytorch_model.safetensors')
39
+ state_dict = load_file(exp_path)
40
+
41
+ # Load the adapted U-Net
42
+ pipe.unet.load_state_dict(state_dict, strict=False)
43
+ pipe.to('cuda:0')
44
+
45
+ # Generate images with text prompts
46
+
47
+ TEXT_PROMPT = "No acute cardiopulmonary abnormality."
48
+ GUIDANCE_SCALE = 4
49
+ INFERENCE_STEPS = 75
50
+
51
+ result_image = pipe(
52
+ prompt=TEXT_PROMPT,
53
+ height=224,
54
+ width=224,
55
+ guidance_scale=GUIDANCE_SCALE,
56
+ num_inference_steps=INFERENCE_STEPS,
57
+ )
58
+
59
+ result_pil_image = result_image["images"][0]
60
+ ```
61
+
62
+
63
+ ## Training Details
64
+
65
+ ### Training Data
66
+
67
+ This model has been fine-tuned on 110K image-text pairs from the MIMIC dataset.
68
+
69
+ ### Training Procedure
70
+
71
+ The training procedure has been described in detail in Section 4.3 of this [paper](https://arxiv.org/abs/2305.08252).
72
+
73
+ #### Metrics
74
+
75
+ This model has been evaluated using the Fréchet inception distance (FID) Score on MIMIC dataset.
76
+
77
+ ### Results
78
+
79
+ | Fine-Tuning Strategy | FID Score |
80
+ |------------------------|-----------|
81
+ | Full FT | 58.74 |
82
+ | Attention | 52.41 |
83
+ | Bias | 20.81 |
84
+ | Norm | 29.84 |
85
+ | Bias+Norm+Attention | 35.93 |
86
+ | LoRA | 439.65 |
87
+ | SV-Diff | 23.59 |
88
+ | DiffFit | 42.50 |
89
+
90
+
91
+ ## Environmental Impact
92
+
93
+ Using Parameter-Efficient Fine-Tuning potentially causes **lesser** harm to the environment since we fine-tune a significantly lesser number of parameters in a model. This results in much lesser computing and hardware requirements.
94
+
95
+ ## Citation
96
+
97
+
98
+ **BibTeX:**
99
+
100
+ @article{dutt2023parameter,
101
+ title={Parameter-Efficient Fine-Tuning for Medical Image Analysis: The Missed Opportunity},
102
+ author={Dutt, Raman and Ericsson, Linus and Sanchez, Pedro and Tsaftaris, Sotirios A and Hospedales, Timothy},
103
+ journal={arXiv preprint arXiv:2305.08252},
104
+ year={2023}
105
+ }
106
+
107
+ **APA:**
108
+ Dutt, R., Ericsson, L., Sanchez, P., Tsaftaris, S. A., & Hospedales, T. (2023). Parameter-Efficient Fine-Tuning for Medical Image Analysis: The Missed Opportunity. arXiv preprint arXiv:2305.08252.
109
+
110
+ ## Model Card Authors
111
+
112
+ Raman Dutt
113
+ [Twitter](https://twitter.com/RamanDutt4)
114
+ [LinkedIn](https://www.linkedin.com/in/raman-dutt/)
115
+ [Email](mailto:s2198939@ed.ac.uk)