-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REF: TensorFlow 2.0 and Keras API (#43)
* change volume module * rm histogram files * change io module * change metrics and losses modules * add files to tests * update cli * use versioneer to version nobrainer * ignore version and tests * rm requirements * remove makefile * update year on license * use travis instead of circleci * update ignored files * update utils * add nobrainer.transform module * update training module * remove testing file * update metrics tests * rm test scripts * update to tf.keras models * remove unused files * make some module names nouns * use tf.keras for variational conv * use tf nightly * use tf.keras api * add initial guide * add new variational meshnet * update docs and change layer names * add nobrainer.training * add loss for meshnet_vwn * use sigmoid only for 1 class * do not use batchnorm and dropout + enh docs * remove previous meshnet vwn implementations in favor of meshnet.py * add meshnet_vwn * update tpu notebook * rename variational weight notebook * add guide notebooks * update using new vwn code * separate this notebook into multiple notebooks * remove examples * fix tversky test * enable eager execution for <2.0 compat * update readme to nobrainer-tf2! * add travis badge
- Loading branch information
Jakub Kaczmarzyk
authored
Mar 6, 2019
1 parent
0b59721
commit 393e9d2
Showing
85 changed files
with
7,537 additions
and
7,352 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
[run] | ||
branch = True | ||
source = . | ||
omit = | ||
nobrainer/_version.py | ||
*/tests* | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
raise NotImplementedError | ||
if __name__ == .__main__.: | ||
ignore_errors = True | ||
omit = | ||
*_test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nobrainer/_version.py export-subst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
/build | ||
/dist | ||
/*.egg-info | ||
.DS_Store | ||
.ipynb_checkpoints | ||
scratch.ipynb | ||
|
||
/models* | ||
.pytest_cache | ||
|
||
build | ||
.coverage | ||
dist | ||
*.egg-info | ||
*.ipynb_checkpoints | ||
/*.ipynb | ||
__pycache__ | ||
*.pyc | ||
|
||
*.gz | ||
*.h5 | ||
*.json | ||
*.log | ||
*.pkl | ||
._* | ||
|
||
slurm-*.out | ||
*.pyc | ||
*.pytest_cache | ||
*.sif | ||
*.simg | ||
*.tfrecords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
dist: xenial | ||
language: python | ||
python: | ||
- "3.6" | ||
install: | ||
- pip install --no-cache-dir --editable=".[dev]" tf-nightly | ||
script: | ||
- pytest --cov=nobrainer nobrainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,6 @@ | ||
# Nobrainer container specification. | ||
|
||
ARG TF_VERSION="1.12.0" | ||
# Use "gpu-py3" to build GPU-enabled container and "py3" for non-GPU container. | ||
ARG TF_ENV="gpu-py3" | ||
FROM tensorflow/tensorflow:${TF_VERSION}-${TF_ENV} | ||
|
||
COPY . /opt/nobrainer | ||
RUN \ | ||
# Extras do not have to be installed because the only extra is tensorflow, | ||
# which is installed in the base image. | ||
pip install --no-cache-dir -e /opt/nobrainer \ | ||
&& rm -rf ~/.cache/pip/* \ | ||
&& useradd --no-user-group --create-home --shell /bin/bash neuro | ||
|
||
USER neuro | ||
WORKDIR /home/neuro | ||
ENTRYPOINT ["/usr/bin/python"] | ||
|
||
FROM tensorflow/tensorflow:nightly-gpu-py3-jupyter | ||
COPY [".", "/opt/nobrainer"] | ||
RUN pip install --no-cache-dir click nibabel numpy pytest scipy scikit-image seaborn \ | ||
&& pip install --no-cache-dir --editable /opt/nobrainer | ||
ENTRYPOINT ["jupyter-notebook", "--ip=0.0.0.0", "--no-browser"] | ||
LABEL maintainer="Jakub Kaczmarzyk <[email protected]>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include versioneer.py | ||
include nobrainer/_version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,46 @@ | ||
# nobrainer | ||
# Nobrainer | ||
|
||
Neural networks for brain extraction and labelling from structural magnetic resonance images. | ||
[](https://travis-ci.com/kaczmarj/nobrainer) | ||
|
||
Nobrainer is a deep learning framework for 3D image processing. It implements several 3D convolutional models from recent literature, methods for loading and augmenting volumetric data than can be used with any TensorFlow or Keras model, losses and metrics for 3D data, and simple utilities for model training, evaluation, prediction, and transfer learning. | ||
|
||
## Examples | ||
Soon, Nobrainer will also provide pre-trained models for brain extraction, brain segmentation, and other tasks. | ||
|
||
Please see the [examples](examples) directory. | ||
The Nobrainer project is supported by NIH R01 EB020470 and is distributed under the Apache 2.0 license. | ||
|
||
## Guide Jupyter Notebooks [](https://colab.research.google.com/github/kaczmarj/nobrainer) | ||
|
||
## Getting started | ||
Please refer to the Jupyter notebooks in the [guide]('/guide') directory to get started with _Nobrainer_. [Try them out](https://colab.research.google.com/github/kaczmarj/nobrainer) in Google Collaboratory! | ||
|
||
### Get the container | ||
## Installing Nobrainer | ||
|
||
```shell | ||
$ docker pull kaczmarj/nobrainer | ||
# or | ||
$ singularity build nobrainer.sqsh docker://kaczmarj/nobrainer | ||
``` | ||
### Container | ||
|
||
### Train your own models | ||
We recommend using the official _Nobrainer_ Docker container, which includes all of the dependencies necessary to use the framework. | ||
|
||
Models can be trained on neuroimaging volumes on the command line or with a Python script. All of the examples can be run within the _Nobrainer_ container. Please see the [examples](examples) for more information. | ||
``` | ||
$ docker pull kaczmarj/nobrainer | ||
``` | ||
|
||
Training data pre-requisites: | ||
1. Volumes must be in a format supported by [nibabel](http://nipy.org/nibabel/). | ||
2. Feature and label data must be available (e.g., T1 and aparc+aseg). | ||
### pip | ||
|
||
Training progress can be visualized with [TensorBoard](https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard): | ||
_Nobrainer_ can also be installed with pip. Use the extra `[gpu]` to install TensorFlow with GPU support and the `[cpu]` extra to install TensorFlow without GPU support. | ||
|
||
``` | ||
$ singularity exec --clean-env --bind /path/to/models:/models nobrainer.sqsh \ | ||
tensorboard --logdir /models | ||
$ pip install --no-cache-dir nobrainer[gpu] | ||
``` | ||
|
||
### Predict using trained models | ||
## Package layout | ||
|
||
We are in the process of training robust models for brain extraction and brain labelling. Stay tuned for information on how to use these models. | ||
- `nobrainer.io`: input/output methods | ||
- `nobrainer.layers`: custom layers, which conform to the Keras API | ||
- `nobrainer.losses`: loss functions for volumetric segmentation | ||
- `nobrainer.metrics`: metrics for volumetric segmentation | ||
- `nobrainer.models`: pre-defined Keras models | ||
- `nobrainer.training`: training utilities (supports training on single and multiple GPUs) | ||
- `nobrainer.transform`: random rigid transformations for data augmentation | ||
- `nobrainer.volume`: `tf.data.Dataset` creation and data augmentation utilities | ||
|
||
### Funding | ||
## Questions or issues | ||
|
||
The nobrainer project is supported by NIH R01 EB020470. | ||
If you have questions about Nobrainer or encounter any issues using the framework, please submit a GitHub issue. If you have a feature request, we encourage you to submit a pull request. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.