From d00ebe06722b03c907792347704e25378818c4b0 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:39:04 +0100 Subject: [PATCH 01/14] Issue #69, #90: changed net_segmentation => net_segment in pip-installer CI script --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cd43e4c8..e417454d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -154,8 +154,8 @@ pip-installer: - python $package_importer # test niftynet command - ln -s /home/gitlab-runner/environments/niftynet/data/example_volumes ./example_volumes - - net_segmentation train -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 42 --label_size 42 --batch_size 1 --save_every_n 10 - - net_segmentation inference -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 80 --label_size 80 --batch_size 8 + - net_segment train -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 42 --label_size 42 --batch_size 1 --save_every_n 10 + - net_segment inference -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 80 --label_size 80 --batch_size 8 # deactivate virtual environment - deactivate - cd $niftynet_dir @@ -188,8 +188,8 @@ pip-installer: - python $package_importer # test niftynet command - ln -s /home/gitlab-runner/environments/niftynet/data/example_volumes ./example_volumes - - net_segmentation train -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 42 --label_size 42 --batch_size 1 --save_every_n 10 - - net_segmentation inference -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 80 --label_size 80 --batch_size 8 + - net_segment train -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 42 --label_size 42 --batch_size 1 --save_every_n 10 + - net_segment inference -c $niftynet_dir/config/default_config.ini --net_name toynet --image_size 80 --label_size 80 --batch_size 8 # deactivate virtual environment - deactivate - cd $niftynet_dir From 645837b2cfdae4831b98c5efaa0ae6766d1322a9 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:40:16 +0100 Subject: [PATCH 02/14] Issue #69, #90: changed net_segmentation => net_segment in dev branch CI script --- .gitlab-ci.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e417454d..6bd83eac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,28 +37,28 @@ testjob: # run python code with coverage wrapper - coverage erase - - coverage run -a --source . net_segmentation.py train -c config/highres3dnet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 - - coverage run -a --source . net_segmentation.py inference -c config/highres3dnet_config.ini --batch_size 8 --image_size 64 --label_size 64 --queue_length 32 + - coverage run -a --source . net_segment.py train -c config/highres3dnet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 + - coverage run -a --source . net_segment.py inference -c config/highres3dnet_config.ini --batch_size 8 --image_size 64 --label_size 64 --queue_length 32 - - coverage run -a --source . net_segmentation.py train -c config/scalenet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 - - coverage run -a --source . net_segmentation.py inference -c config/scalenet_config.ini --batch_size 16 --image_size 64 --label_size 64 --queue_length 32 + - coverage run -a --source . net_segment.py train -c config/scalenet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 + - coverage run -a --source . net_segment.py inference -c config/scalenet_config.ini --batch_size 16 --image_size 64 --label_size 64 --queue_length 32 - - coverage run -a --source . net_segmentation.py train -c config/vnet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 --activation_function relu - - coverage run -a --source . net_segmentation.py inference -c config/vnet_config.ini --batch_size 16 --image_size 64 --label_size 64 --queue_length 32 --activation_function relu + - coverage run -a --source . net_segment.py train -c config/vnet_config.ini --batch_size 1 --image_size 32 --label_size 32 --queue_length 5 --num_threads 2 --activation_function relu + - coverage run -a --source . net_segment.py inference -c config/vnet_config.ini --batch_size 16 --image_size 64 --label_size 64 --queue_length 32 --activation_function relu # need a large GPU to run - #- coverage run -a --source . net_segmentation.py train -c config/unet_config.ini --batch_size 1 --image_size 96 --label_size 96 --queue_length 5 --num_threads 2 - #- coverage run -a --source . net_segmentation.py inference -c config/unet_config.ini --batch_size 1 --image_size 96 --label_size 96 --queue_length 5 + #- coverage run -a --source . net_segment.py train -c config/unet_config.ini --batch_size 1 --image_size 96 --label_size 96 --queue_length 5 --num_threads 2 + #- coverage run -a --source . net_segment.py inference -c config/unet_config.ini --batch_size 1 --image_size 96 --label_size 96 --queue_length 5 - #- coverage run -a --source . net_segmentation.py train -c config/deepmedic_config.ini --batch_size 8 --queue_length 16 --num_threads 2 - #- coverage run -a --source . net_segmentation.py inference -c config/deepmedic_config.ini --batch_size 64 --queue_length 96 + #- coverage run -a --source . net_segment.py train -c config/deepmedic_config.ini --batch_size 8 --queue_length 16 --num_threads 2 + #- coverage run -a --source . net_segment.py inference -c config/deepmedic_config.ini --batch_size 64 --queue_length 96 - - coverage run -a --source . net_segmentation.py train -c config/default_config.ini --image_size 42 --label_size 42 --batch_size 3 --queue_length 6 - - coverage run -a --source . net_segmentation.py train -c config/default_config.ini --image_size 42 --label_size 42 --batch_size 3 --queue_length 6 --starting_iter 10 --max_iter 15 - - coverage run -a --source . net_segmentation.py inference -c config/default_config.ini --image_size 84 --label_size 84 --batch_size 7 --queue_length 14 + - coverage run -a --source . net_segment.py train -c config/default_config.ini --image_size 42 --label_size 42 --batch_size 3 --queue_length 6 + - coverage run -a --source . net_segment.py train -c config/default_config.ini --image_size 42 --label_size 42 --batch_size 3 --queue_length 6 --starting_iter 10 --max_iter 15 + - coverage run -a --source . net_segment.py inference -c config/default_config.ini --image_size 84 --label_size 84 --batch_size 7 --queue_length 14 - - coverage run -a --source . net_segmentation.py train -c config/default_multimodal_config.ini --image_size 42 --label_size 42 --batch_size 3 - - coverage run -a --source . net_segmentation.py inference -c config/default_multimodal_config.ini --image_size 84 --label_size 84 --batch_size 7 + - coverage run -a --source . net_segment.py train -c config/default_multimodal_config.ini --image_size 42 --label_size 42 --batch_size 3 + - coverage run -a --source . net_segment.py inference -c config/default_multimodal_config.ini --image_size 84 --label_size 84 --batch_size 7 - coverage run -a --source . -m tests.mean_variance_normalisation_test - coverage run -a --source . -m tests.binary_masking_test From 1cb82282ea4485ff833e2b6e44dbd377c1029ce4 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:40:55 +0100 Subject: [PATCH 03/14] Issue #69, #90: added current branch to dev branch CI script --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6bd83eac..ef1f4647 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,7 @@ testjob: - dev - dev-staging - tags + - 69-push-to-pip-repository-after-commit-to-master-off-dev-restructure-hierarchy script: # !!kill coverage in case of hanging processes - if pgrep coverage; then pkill -f coverage; fi From 3c7402fbddff5a5e6e1374890436946b5dbcd2e1 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:43:07 +0100 Subject: [PATCH 04/14] Issue #69, #90: changed net_segmentation => net_segment in demos/README.md --- demos/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/demos/README.md b/demos/README.md index 99d3ae0c..97ab827e 100644 --- a/demos/README.md +++ b/demos/README.md @@ -28,7 +28,7 @@ To train a "toynet" specified in `network/toynet.py`: cd NiftyNet/ wget -N https://www.dropbox.com/s/y7mdh4m9ptkibax/example_volumes.tar.gz tar -xzvf example_volumes.tar.gz -net_segmentation train --net_name toynet \ +net_segment train --net_name toynet \ --image_size 42 --label_size 42 --batch_size 1 ``` (GPU computing is enabled by default; to train with CPU only please use `--num_gpus 0`) @@ -36,7 +36,7 @@ net_segmentation train --net_name toynet \ After the training process, to do segmentation with a trained "toynet": ``` sh cd NiftyNet/ -net_segmentation inference --net_name toynet \ +net_segment inference --net_name toynet \ --save_seg_dir ./seg_output \ --image_size 80 --label_size 80 --batch_size 8 ``` @@ -51,11 +51,11 @@ Alternatively, to run with a customised config file: ``` sh cd NiftyNet/ # training -net_segmentation train -c /path/to/customised_config +net_segment train -c /path/to/customised_config # inference -net_segmentation inference -c /path/to/customised_config +net_segment inference -c /path/to/customised_config ``` where `/path/to/customised_config` implements all parameters listed by running: ```sh -net_segmentation -h +net_segment -h ``` From 30086d8343ef6de3abdd5dbe775beb92382db8d7 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:43:57 +0100 Subject: [PATCH 05/14] Issue #69, #90: changed net_segmentation => net_segment in niftynet/network/README.md --- niftynet/network/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/niftynet/network/README.md b/niftynet/network/README.md index 7fae1638..2ab00682 100644 --- a/niftynet/network/README.md +++ b/niftynet/network/README.md @@ -56,4 +56,4 @@ image_ size = 57, label_ size = 9, d_ factor = 3 1. Create a `niftynet/network/new_net.py` inheriting `BaseNet` from `niftynet.layer.base_net` 1. Implement `layer_op()` function using the building blocks in `niftynet/layer/` or creating new layers 1. Import `niftynet.network.new_net` to the `NetFactory` class in `niftynet/__init__.py` -1. Train the network with `python net_segmentation.py train -c /path/to/customised_config` +1. Train the network with `python net_segment.py train -c /path/to/customised_config` From 662a75aeb486d863b23e3a46a17c31d7489278cf Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:44:39 +0100 Subject: [PATCH 06/14] Issue #69, #90: changed net_segmentation => net_segment in run_application.py --- run_application.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_application.py b/run_application.py index 78c0b1f3..fde0c743 100644 --- a/run_application.py +++ b/run_application.py @@ -2,7 +2,7 @@ import warnings import time warnings.simplefilter('always', DeprecationWarning) -warnings.warn('run_application.py is deprecated and will be removed; please use net_segmentation.py instead.', DeprecationWarning, stacklevel=2) +warnings.warn('run_application.py is deprecated and will be removed; please use net_segment.py instead.', DeprecationWarning, stacklevel=2) warnings.simplefilter('ignore', DeprecationWarning) time.sleep(3) From edfa22da818248c5275f73ab0013b5c443ea9187 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:45:34 +0100 Subject: [PATCH 07/14] Issue #69, #90: changed net_segmentation => net_segment in demos/brain_parcellation/run_parcellation.sh --- demos/brain_parcellation/run_parcellation.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/brain_parcellation/run_parcellation.sh b/demos/brain_parcellation/run_parcellation.sh index 23ee1bb0..20807fc4 100755 --- a/demos/brain_parcellation/run_parcellation.sh +++ b/demos/brain_parcellation/run_parcellation.sh @@ -2,7 +2,7 @@ # please make sure you installed all dependencies of NiftyNet. # cd NiftyNet/; pip install -r requirements-gpu.txt -NIFTYNET=../../net_segmentation.py +NIFTYNET=../../net_segment.py DIR="$( cd "$(dirname "$0")" ; pwd -P )" cd "$DIR" From d6cfeda1be53bd838a720d0fdc9e36c99f890d95 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:47:49 +0100 Subject: [PATCH 08/14] Issue #69, #90, #121: changed net_segmentation => net_segment in demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb --- demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb b/demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb index cbf3123b..85738278 100644 --- a/demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb +++ b/demos/PROMISE12/PROMISE12_Demo_Notebook.ipynb @@ -52,9 +52,9 @@ "metadata": {}, "source": [ "## Training a network from the command line\n", - "The simplest way to use NiftyNet is via the commandline net_segmentation.py script. Normally, this is done on the command line with a command like this from the NiftyNet root directory:\n", + "The simplest way to use NiftyNet is via the commandline net_segment.py script. Normally, this is done on the command line with a command like this from the NiftyNet root directory:\n", "\n", - "```python net_segmentation.py train --conf demo/PROMISE12/promise12_demo_train_config.ini --image_size 32 --label_size 32 --max_iter 10```\n", + "```python net_segment.py train --conf demo/PROMISE12/promise12_demo_train_config.ini --image_size 32 --label_size 32 --max_iter 10```\n", "\n", "Notice that we use configuration file that is specific to this experiment. This file contains default settings. Also note that we can override these settings on the command line.\n", "\n", @@ -78,7 +78,7 @@ "source": [ "Now you have trained (a few iterations of) a deep learning network for medical image segmentation. If you have some time on your hands, you can finish training the network (by leaving off the max_iter argument) and try it out, by running the following command\n", "\n", - "```python net_segmentation.py inference --conf demo/PROMISE12/promise12_demo_inference_config.ini --image_size 32 --label_size 32```\n", + "```python net_segment.py inference --conf demo/PROMISE12/promise12_demo_inference_config.ini --image_size 32 --label_size 32```\n", "\n", "or the following python code in the Notebook" ] @@ -102,7 +102,7 @@ "source": [ "Otherwise, you can load up some pre-trained weights for the network:\n", "\n", - "```python net_segmentation.py inference --conf demo/PROMISE12/promise12_demo_config.ini --model_dir demo/PROMISE12/pretrained```\n", + "```python net_segment.py inference --conf demo/PROMISE12/promise12_demo_config.ini --model_dir demo/PROMISE12/pretrained```\n", "or the following python code in the Notebook" ] }, @@ -318,7 +318,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "You can use helper functions to parse commandline parameters and automatically match patient data (which is what net_segmentation.py did)." + "You can use helper functions to parse commandline parameters and automatically match patient data (which is what net_segment.py did)." ] }, { From 931fd7c3c942cae08e471b8fc9bdf77adf74c911 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:48:26 +0100 Subject: [PATCH 09/14] Issue #69, #90: moved net_segmentation.py to net_segment.py --- net_segmentation.py => net_segment.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename net_segmentation.py => net_segment.py (100%) diff --git a/net_segmentation.py b/net_segment.py similarity index 100% rename from net_segmentation.py rename to net_segment.py From 895a8e2534b48ba9db02e2f882efb610e91b02fe Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:51:23 +0100 Subject: [PATCH 10/14] Issue #69, #90: changed net_segmentation entry point to net_segment setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6a072af8..f0661852 100644 --- a/setup.py +++ b/setup.py @@ -121,7 +121,7 @@ entry_points={ 'console_scripts': [ - 'net_segmentation=niftynet:main', + 'net_segment=niftynet:main', ], }, ) From c2bc6dae815afb7ac349c2537e6dea66e8ae950b Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 09:55:04 +0100 Subject: [PATCH 11/14] Revert "Issue #69, #90: added current branch to dev branch CI script" This reverts commit c4acbccf513e6b2065718c7c1d5b42a218775acc. --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef1f4647..6bd83eac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,6 @@ testjob: - dev - dev-staging - tags - - 69-push-to-pip-repository-after-commit-to-master-off-dev-restructure-hierarchy script: # !!kill coverage in case of hanging processes - if pgrep coverage; then pkill -f coverage; fi From 443ffac093d94615318354841de00cb5245eeb52 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 10:11:37 +0100 Subject: [PATCH 12/14] Issue #69: changed WEISS URL to http://www.ucl.ac.uk/weiss in pip installer description --- pip/long_description.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pip/long_description.rst b/pip/long_description.rst index dde3f453..e6318b8e 100644 --- a/pip/long_description.rst +++ b/pip/long_description.rst @@ -66,7 +66,7 @@ Acknowledgements This project is grateful for the support from the `Wellcome Trust`_, the `Engineering and Physical Sciences Research Council (EPSRC)`_, the `National Institute for Health Research (NIHR)`_, the `Department of Health (DoH)`_, `University College London (UCL)`_, the `Science and Engineering South Consortium (SES)`_, the `STFC Rutherford-Appleton Laboratory`_, and `NVIDIA`_. .. _`TensorFlow`: https://www.tensorflow.org/ -.. _`Wellcome EPSRC Centre for Interventional and Surgical Sciences`: http://www.ucl.ac.uk/surgical-interventional-sciences +.. _`Wellcome EPSRC Centre for Interventional and Surgical Sciences`: http://www.ucl.ac.uk/weiss .. _`NiftyNet source code repository`: https://cmiclab.cs.ucl.ac.uk/CMIC/NiftyNet .. _`Centre for Medical Image Computing`: http://cmic.cs.ucl.ac.uk/ .. _`Centre for Medical Image Computing (CMIC)`: http://cmic.cs.ucl.ac.uk/ From 52607e49d5bc43708541dda1ec3b6d70ec37dd56 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 10:13:17 +0100 Subject: [PATCH 13/14] Issue #69, #125: changed 'version' var in niftynet/info.py to 'VERSION_DESCRIPTOR' as this is merely the version descriptor generated from 'git describe', and may not necessarily be the same as the actual version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f0661852..1f3f6b64 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ info_module.write('"""\n') info_module.write('\n') info_module.write('\n') -info_module.write('version = "{}"\n'.format(version_buf)) +info_module.write('VERSION_DESCRIPTOR = "{}"\n'.format(version_buf)) info_module.close() # Regex for checking PEP 440 conformity From 5a8e91a3c21e42f4e53ae8ef0ef8d5bfca5efbd5 Mon Sep 17 00:00:00 2001 From: Dzhoshkun Ismail Shakir Date: Tue, 8 Aug 2017 11:33:55 +0100 Subject: [PATCH 14/14] Issue #69: the pip-installer CI script now has the same 'only' clause as the dev testjob CI script --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6bd83eac..ce56d979 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,9 +103,9 @@ testjob: pip-installer: stage: pip_test only: - - 69-push-to-pip-repository-after-commit-to-master-off-dev - - 69-push-to-pip-repository-after-commit-to-master-off-dev-restructure-hierarchy - - 131-pip-bundle-does-not-work-with-cpu-only-tensorflow-drop-tensorflow-auto-install + - master + - dev + - dev-staging - tags script: # source utils