Commit 9cf469e5 authored by Wenqi Li's avatar Wenqi Li

autocontxt_mr_ct_entry

parent dea1e792
......@@ -12,3 +12,9 @@ local_id = autocontext_mr_ct
url = https://www.dropbox.com/s/xx5ahj4m12bf67h/autocontext_mr_ct_initial_maps.tar.gz?dl=1
action = expand
destination = models
[code]
local_id = autocontext_mr_ct
url = https://www.dropbox.com/s/746d45nkk41enjz/autocontext_mr_ct_model_zoo_config.tar.gz?dl=1
action = expand
destination = extensions
# Training regression network with autocontext
## Downloading model zoo files
The training data and initial maps can be downloaded with the command
```bash
net_download autocontext_mr_ct_model_zoo
```
(Replace `net_download` with `python net_download.py` if you cloned the NiftyNet repository.)
## Initial training
Command line parameters: ``--starting_iter 1 --max_iter 500``
```bash
python net_run.py train \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--starting_iter 0 --max_iter 500
```
## Generating contexts
Command line parameters: ``--spatial_window_size 240,240,1 --batch_size 4``
modify the inference batch size and window size for efficiency purpose.
``~/niftynet/models/autocontext_mr_ct/autocontext_output``.
```bash
python net_run.py inference \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--inference_iter 500 --spatial_window_size 240,240,1 --batch_size 4 --dataset_split_file nofile
```
## Continue training by sampling according to the error maps:
Command line parameters ``--starting_iter -1``
indicate training the model from the most recently saved checkpoint (at iteration 500).
```bash
python net_run.py train \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--starting_iter -1 --max_iter 1000
```
## Combine them together
Alternating in between error map generation and training with new sampling weights:
(from git cloned source code)
```bash
python net_download.py autocontext_mr_ct_model_zoo
python net_run.py train \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--starting_iter 0 --max_iter 500
for max_iter in `seq 1000 1000 5000`
do
python net_run.py inference \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--inference_iter -1 --spatial_window_size 240,240,1 --batch_size 4 --dataset_split_file nofile
python net_run.py train \
-a niftynet.contrib.regression_weighted_sampler.isample_regression.ISampleRegression \
-c ~/niftynet/extensions/autocontext_mr_ct/net_autocontext.ini \
--starting_iter -1 --max_iter $max_iter
done
```
This script runs training for 5000 iterations,
and new training contexts are generated at every 1000 iterations.
To see the training/validation curves using tensorboard:
```bash
tensorboard --logdir ~/niftynet/models/autocontext_mr_ct/logs
```
## Generating regression output
Finally regression maps could be found at ``~/niftynet/models/autocontext_mr_ct/autocontext_output/``.
[config]
version = 1.0
[code]
local_id = autocontext_mr_ct
url = https://www.dropbox.com/s/746d45nkk41enjz/autocontext_mr_ct_model_zoo_config.tar.gz?dl=1
action = expand
destination = extensions
......@@ -9,3 +9,4 @@ This page lists NiftyNet networks pre-trained for specific tasks. Information ab
| [highres3dnet_brain_parcellation_model_zoo](./highres3dnet_brain_parcellation_model_zoo.md) | Brain parcellation from T1 MR images |
| [anisotropic_nets_brats_challenge_model_zoo](./anisotropic_nets_brats_challenge_model_zoo.md) | Brain tumor segmentation with anisotropic nets |
| [mr_ct_regression_model_zoo](./mr_ct_regression_model_zoo.md) | Estimating CT from MR using an adaptive sampling strategy |
| [autocontext_mr_ct_model_zoo](./autocontext_mr_ct_model_zoo.md) | Estimating CT from MR using an autocontext model |
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment