11# ImgX-DiffSeg
22
3- ImgX-DiffSeg is a Jax-based deep learning toolkit using Flax for biomedical image segmentations .
3+ ImgX-DiffSeg is a Jax-based deep learning toolkit using Flax for biomedical image segmentation .
44
55This repository includes the implementation of the following work
66
@@ -11,14 +11,14 @@ This repository includes the implementation of the following work
1111applications.** :construction :
1212
1313- November 2023:
14- - :warning : Upgrade to JAX to 0.4.20.
15- - :warning : Removed Haiku specific modification to convolutional layers. This may impact model
14+ - :warning : Upgraded to JAX to 0.4.20.
15+ - :warning : Removed Haiku- specific modification to convolutional layers. This may impact model
1616 performance.
17- - :smiley : Added example notebooks for inference on single image without TFDS.
18- - Added integration tests for training, validation and testing.
17+ - :smiley : Added example notebooks for inference on a single image without TFDS.
18+ - Added integration tests for training, validation, and testing.
1919 - Refactored config.
2020 - Added ` patch_size ` and ` scale_factor ` to data config.
21- - Moved loss config from main config to task config.
21+ - Moved loss config from the main config to task config.
2222 - Refactored code, including defining ` imgx/task ` submodule.
2323- October 2023: :sunglasses : Migrated from [ Haiku] ( https://github.com/google-deepmind/dm-haiku ) to
2424 [ Flax] ( https://github.com/google/flax ) following Google DeepMind's recommendation.
@@ -77,7 +77,8 @@ See the [readme](imgx_datasets/README.md) for further details.
7777
7878### TPU with Docker
7979
80- The following instructions have been tested only for TPU-v3-8. The docker container uses root user.
80+ The following instructions have been tested only for TPU-v3-8. The docker container uses the root
81+ user.
8182
82831 . TPU often has limited disk space.
8384 [ RAM disk] ( https://www.linuxbabe.com/command-line/create-ramdisk-linux ) can be used to help.
@@ -111,7 +112,7 @@ The following instructions have been tested only for TPU-v3-8. The docker contai
111112 imgx bash
112113 ```
113114
114- 4 . Install the package inside container.
115+ 4 . Install the package inside the container.
115116
116117 ``` bash
117118 make pip
@@ -146,10 +147,10 @@ CUDA >= 11.8 is required. The docker container uses non-root user.
146147
147148 where
148149
149- - ` --rm ` removes the container once exit it.
150- - ` -v ` maps the current folder into container.
150+ - ` --rm ` removes the container once exits it.
151+ - ` -v ` maps the current folder into the container.
151152
152- 3 . Install the package inside container.
153+ 3 . Install the package inside the container.
153154
154155 ``` bash
155156 make pip
@@ -202,17 +203,17 @@ make rebuild_dataset
202203
203204### Training and Testing
204205
205- Example command to use two GPUs for training, validation and testing. The outputs are stored under
206+ Example command to use two GPUs for training, validation, and testing. The outputs are stored under
206207` wandb/latest-run/files/ ` , where
207208
208209- ` ckpt ` stores the model checkpoints and corresponding validation metrics.
209- - ` test_evaluation ` stores the prediction on test set and corresponding metrics.
210+ - ` test_evaluation ` stores the prediction on the test set and corresponding metrics.
210211
211212``` bash
212213# limit to two GPUs if using NVIDIA GPUs
213214export CUDA_VISIBLE_DEVICES=" 0,1"
214215
215- # select data set to use
216+ # select the data set to use
216217export DATASET_NAME=" male_pelvic_mr"
217218export DATASET_NAME=" amos_ct"
218219export DATASET_NAME=" muscle_us"
@@ -229,8 +230,8 @@ imgx_valid --log_dir wandb/latest-run/ --num_timesteps 5 --sampler DDIM
229230imgx_test --log_dir wandb/latest-run/ --num_timesteps 5 --sampler DDIM
230231```
231232
232- Optionally, for debug purposes, use flag ` debug=True ` to run the experiment with a small dataset and
233- smaller models.
233+ Optionally, for debugging purposes, use the flag ` debug=True ` to run the experiment with a small
234+ dataset and smaller models.
234235
235236``` bash
236237imgx_train data=${DATASET_NAME} task=seg debug=True
@@ -259,15 +260,15 @@ pre-commit run --all-files
259260
260261### Code Test
261262
262- Run the command below to test and get coverage report. As JAX tests requires two CPUs, ` -n 4 ` uses 4
263- threads, therefore requires 8 CPUs in total.
263+ Run the command below to test and get a coverage report. As JAX tests require two CPUs, ` -n 4 ` uses
264+ 4 threads, therefore requires 8 CPUs in total.
264265
265266``` bash
266267pytest --cov=imgx -n 4 imgx -k " not integration"
267268pytest --cov=imgx_datasets -n 4 imgx_datasets
268269```
269270
270- ` -k "not integration" ` excludes integration tests, which requires downloading muscle ultrasound and
271+ ` -k "not integration" ` excludes integration tests, which require downloading muscle ultrasound and
271272amos CT data sets.
272273
273274For integration tests, run the command below. ` -s ` enables the print of stdout. This test may take
0 commit comments