|
1 | 1 | # Description
|
2 |
| -A pre-trained model for volumetric (3D) segmentation of the spleen from CT image. |
| 2 | +This example mainly shows 2 typical use cases of hybrid programming with MONAI bundle: |
| 3 | +- Apply customized python component(like: transform, network, metrics, etc.) in the `train` config. |
| 4 | +- Parse the config in your own python program, instantiate necessary components with python program and execute the training. |
3 | 5 |
|
4 |
| -# Model Overview |
5 |
| -This model is trained using the runner-up [1] awarded pipeline of the "Medical Segmentation Decathlon Challenge 2018" using the UNet architecture [2] with 32 training images and 9 validation images. |
6 |
| - |
7 |
| -## Data |
8 |
| -The training dataset is Task09_Spleen.tar from http://medicaldecathlon.com/. |
9 |
| - |
10 |
| -## Training configuration |
11 |
| -The training was performed with at least 12GB-memory GPUs. |
12 |
| - |
13 |
| -Actual Model Input: 96 x 96 x 96 |
14 |
| - |
15 |
| -## Input and output formats |
16 |
| -Input: 1 channel CT image |
17 |
| - |
18 |
| -Output: 2 channels: Label 1: spleen; Label 0: everything else |
19 |
| - |
20 |
| -## Scores |
21 |
| -This model achieves the following Dice score on the validation data (our own split from the training dataset): |
22 |
| - |
23 |
| -Mean Dice = 0.96 |
| 6 | +Please note that this example depends on the `spleen_segmentation` bundle example and show the hybrid programming via overriding the config file of it. |
24 | 7 |
|
25 | 8 | ## commands example
|
26 |
| -Execute training: |
27 |
| - |
28 |
| -``` |
29 |
| -python -m monai.bundle run training --meta_file configs/metadata.json --config_file configs/train.json --logging_file configs/logging.conf |
30 |
| -``` |
31 |
| - |
32 |
| -Override the `train` config to execute multi-GPU training: |
33 |
| - |
34 |
| -``` |
35 |
| -torchrun --standalone --nnodes=1 --nproc_per_node=2 -m monai.bundle run training --meta_file configs/metadata.json --config_file "['configs/train.json','configs/multi_gpu_train.json']" --logging_file configs/logging.conf |
36 |
| -``` |
37 |
| - |
38 |
| -Override the `train` config to execute evaluation with the trained model: |
| 9 | +Override the `train` config with customized `transforms` and execute training: |
39 | 10 |
|
40 | 11 | ```
|
41 |
| -python -m monai.bundle run evaluating --meta_file configs/metadata.json --config_file "['configs/train.json','configs/evaluate.json']" --logging_file configs/logging.conf |
| 12 | +python -m monai.bundle run training --meta_file configs/metadata.json --config_file "['configs/train.json','configs/custom_train.json']" --logging_file configs/logging.conf |
42 | 13 | ```
|
43 | 14 |
|
44 |
| -Execute inference: |
| 15 | +Parse the config in the python program and execute inference from the program: |
45 | 16 |
|
46 | 17 | ```
|
47 |
| -python -m monai.bundle run evaluating --meta_file configs/metadata.json --config_file configs/inference.json --logging_file configs/logging.conf |
| 18 | +python -m scripts.inference.run --config_file configs/inference.json |
48 | 19 | ```
|
49 |
| - |
50 |
| -Verify the metadata format: |
51 |
| - |
52 |
| -``` |
53 |
| -python -m monai.bundle verify_metadata --meta_file configs/metadata.json --filepath eval/schema.json |
54 |
| -``` |
55 |
| - |
56 |
| -Verify the data shape of network: |
57 |
| - |
58 |
| -``` |
59 |
| -python -m monai.bundle verify_net_in_out network_def --meta_file configs/metadata.json --config_file configs/inference.json |
60 |
| -``` |
61 |
| - |
62 |
| -Export checkpoint to TorchScript file: |
63 |
| - |
64 |
| -``` |
65 |
| -python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json |
66 |
| -``` |
67 |
| - |
68 |
| -# Disclaimer |
69 |
| -This is an example, not to be used for diagnostic purposes. |
70 |
| - |
71 |
| -# References |
72 |
| -[1] Xia, Yingda, et al. "3D Semi-Supervised Learning with Uncertainty-Aware Multi-View Co-Training." arXiv preprint arXiv:1811.12506 (2018). https://arxiv.org/abs/1811.12506. |
73 |
| - |
74 |
| -[2] Kerfoot E., Clough J., Oksuz I., Lee J., King A.P., Schnabel J.A. (2019) Left-Ventricle Quantification Using Residual U-Net. In: Pop M. et al. (eds) Statistical Atlases and Computational Models of the Heart. Atrial Segmentation and LV Quantification Challenges. STACOM 2018. Lecture Notes in Computer Science, vol 11395. Springer, Cham. https://doi.org/10.1007/978-3-030-12029-0_40 |
0 commit comments