tristan-deep commited on
Commit
0c7f2c0
·
1 Parent(s): 36e1539

readme update

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. README.md +44 -0
  3. fid_score.py +3 -6
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM zeahub/all:v0.0.4
2
 
3
- RUN pip install --no-cache-dir SimpleITK tyro beautifulsoup4 tabulate optuna
4
 
5
  RUN pip install --no-cache-dir --no-deps pytorch_fid
6
 
 
1
  FROM zeahub/all:v0.0.4
2
 
3
+ RUN pip install --no-cache-dir tyro optuna
4
 
5
  RUN pip install --no-cache-dir --no-deps pytorch_fid
6
 
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <div align="center">
3
+ <h1>Semantic Diffusion Posterior Sampling for Cardiac Ultrasound Dehazing</h1>
4
+ <p>
5
+ <a href="https://arxiv.org/abs/0000.0000"><img src="https://img.shields.io/badge/arXiv-0000.0000-b31b1b.svg?logo=arXiv" alt="arXiv"></a>
6
+ <a href="https://huggingface.co/collections/tristan-deep/semantic-diffusion-posterior-sampling-for-cardiac-ultrasound-68a70559a7f719c7e6bd5788"><img src="https://img.shields.io/badge/🤗%20Hugging%20Face-Model-orange" alt="Hugging Face Model"></a>
7
+ <a href="https://keras.io/"><img src="https://img.shields.io/badge/Keras-EE4C2C?logo=keras&logoColor=white" alt="Keras"></a>
8
+ </p>
9
+ <h3>
10
+ <span style="display:inline-block; margin: 0 20px;">
11
+ <a href="https://example.com/tristan-stevens">Tristan Stevens</a>
12
+ </span>
13
+ <span style="display:inline-block; margin: 0 20px;">
14
+ <a href="https://example.com/oisin-nolan">Oisín Nolan</a>
15
+ </span>
16
+ <span style="display:inline-block; margin: 0 20px;">
17
+ <a href="https://example.com/ruud-van-sloun">Ruud van Sloun</a>
18
+ </span>
19
+ </h3>
20
+ <p>Eindhoven University of Technology, the Netherlands</p>
21
+ </div>
22
+
23
+
24
+ ### Installation
25
+
26
+ The algorithm is implemented using Keras with JAX backend. Furthermore it heavily relies on the [zea ultrasound library](https://github.com/tue-bmd/zea).
27
+
28
+ Either install the following in your Python environment, or use the [Dockerfile](./Dockerfile) provided in this repository.
29
+
30
+ ```bash
31
+ pip install tyro optuna zea==0.0.4
32
+ pip install -U "jax[cuda12]"
33
+ ```
34
+
35
+ > [!NOTE]
36
+ > Although the code was primarily tested with JAX as the Keras backend, TensorFlow and PyTorch should also work.
37
+
38
+ ### Running the algorithm
39
+
40
+ Some example images are downloaded in the [./assets](./assets) folder. The models are automatically downloaded from the [Hugging Face Model Hub](https://huggingface.co/collections/tristan-deep/semantic-diffusion-posterior-sampling-for-cardiac-ultrasound-68a70559a7f719c7e6bd5788).
41
+
42
+ ```bash
43
+ python main.py --input-folder ./assets --output-folder ./temp
44
+ ```
fid_score.py CHANGED
@@ -43,17 +43,14 @@ import torchvision.transforms as TF
43
  from PIL import Image
44
  from scipy import linalg
45
  from torch.nn.functional import adaptive_avg_pool2d
 
46
 
47
  try:
48
- from tqdm import tqdm
49
  except ImportError:
50
- # If tqdm is not available, provide a mock version of it
51
- def tqdm(x):
52
- return x
53
 
54
 
55
- from pytorch_fid.inception import InceptionV3
56
-
57
  parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
58
  parser.add_argument("--batch-size", type=int, default=50, help="Batch size to use")
59
  parser.add_argument(
 
43
  from PIL import Image
44
  from scipy import linalg
45
  from torch.nn.functional import adaptive_avg_pool2d
46
+ from tqdm import tqdm
47
 
48
  try:
49
+ from pytorch_fid.inception import InceptionV3
50
  except ImportError:
51
+ raise ImportError("Please install pytorch-fid: pip install pytorch-fid")
 
 
52
 
53
 
 
 
54
  parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
55
  parser.add_argument("--batch-size", type=int, default=50, help="Batch size to use")
56
  parser.add_argument(