You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add 2.5D FID Score computation for volumetric CT image generation.
### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [ ] Avoid including large-size files in the PR.
- [ ] Clean up long text outputs from code cells in the notebook.
- [ ] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [ ] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`
---------
Signed-off-by: dongyang0122 <don.yang.mech@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: generation/maisi/README.md
+54-2Lines changed: 54 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -247,13 +247,65 @@ torchrun \
247
247
```
248
248
Please also check [maisi_train_controlnet_tutorial.ipynb](./maisi_train_controlnet_tutorial.ipynb) for more details about data preparation and training parameters.
249
249
250
-
### 4. License
250
+
### 4. FID Score Computation
251
+
252
+
We provide the `compute_fid_2-5d_ct.py` script that calculates the Frechet Inception Distance (FID) between two 3D medical datasets (e.g., **real** vs. **synthetic** images). It uses a **2.5D** feature-extraction approach across three orthogonal planes (XY, YZ, ZX) and leverages **distributed GPU processing** (via PyTorch’s `torch.distributed` and NCCL) for efficient, large-scale computations.
253
+
254
+
#### Key Features
255
+
256
+
-**Distributed Processing**
257
+
Scales to multiple GPUs and larger datasets by splitting the workload across devices.
258
+
259
+
-**2.5D Feature Extraction**
260
+
Uses a slice-based technique, applying a 2D model across all slices in each dimension.
261
+
262
+
-**Flexible Preprocessing**
263
+
Supports optional center-cropping, padding, and resampling to target shapes or voxel spacings.
264
+
265
+
#### Usage Example
266
+
267
+
Suppose your **real** dataset root is `path/to/real_images`, and you have a `real_filelist.txt` that lists filenames line by line, such as:
268
+
```
269
+
case001.nii.gz
270
+
case002.nii.gz
271
+
case003.nii.gz
272
+
```
273
+
You also have a **synthetic** dataset in `path/to/synth_images` with a corresponding `synth_filelist.txt`. You can run the script as follows:
2. Load each `.nii.gz` file from your specified `real_filelist` and `synth_filelist`.
297
+
3. Apply 2.5D feature extraction across the XY, YZ, and ZX planes.
298
+
4. Compute FID to compare **real** vs. **synthetic** feature distributions.
299
+
300
+
For more details, see the in-code docstring in [`compute_fid_2-5d_ct.py`](./scripts/compute_fid_2-5d_ct.py) or consult our documentation for a deeper dive into function arguments and the underlying implementation.
301
+
302
+
### 5. License
251
303
252
304
The code is released under Apache 2.0 License.
253
305
254
306
The model weight is released under [NSCLv1 License](./LICENSE.weights).
255
307
256
-
### 5. Questions and Bugs
308
+
### 6. Questions and Bugs
257
309
258
310
- For questions relating to the use of MONAI, please use our [Discussions tab](https://github.com/Project-MONAI/MONAI/discussions) on the main repository of MONAI.
259
311
- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues).
0 commit comments