Skip to content

Setting up Nobrainer: Experiences (by Oliver Hinds)

H Gazula edited this page May 18, 2023 · 1 revision

Note on my dir structure

In the following, I’m using links into my home dir from my storage dir in /om/user/$USER/. I created these links using:

mkdir /om/user/$USER/{projects,data,sw}
cd $HOME
ln -s /om/user/$USER/projects
ln -s /om/user/$USER/data
ln -s /om/user/$USER/sw

Install nobrainer for development

wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
sh Miniconda3-py39_4.9.2-Linux-x86_64.sh
conda install conda-build
git clone git@github.com:neuronets/nobrainer.git
cd nobrainer/
conda create -n nobrainer
conda activate nobrainer
conda install pip
pip install -e .
conda install -c conda-forge datalad
pip install datalad-osf

Install trained models

datalad clone https://github.com/neuronets/trained-models
cd trained-models
git-annex enableremote osf-storage
datalad get -s osf-storage .

Test README and guide examples

README

cd ~/data
mkdir example && cd example
wget -nc https://dl.dropbox.com/s/g1vn5p3grifro4d/T1w.nii.gz

Brain mask prediction

srun nobrainer predict --model=~/projects/trained-models/neuronets/brainy/0.1.0/weights/brain-extraction-unet-128iso-model.h5 T1w.nii.gz brainmask.nii.gz

NOTE: PASSED - brain mask includes part of the nose and an eye

srun nobrainer predict --model=~/projects/trained-models/neuronets/brainy/0.1.0/weights/brain-extraction-unet-128iso-model.h5 --largest-label T1w.nii.gz brainmask_largest-label.nii.gz

NOTE: PASSED - brain mask looks pretty good

srun nobrainer predict --model=~/projects/trained-models/neuronets/brainy/0.1.0/weights/brain-extraction-unet-128iso-model.h5 --rotate-and-predict T1w.nii.gz brainmask_rotate.nii.gz

NOTE: PASSED - brain mask same as the first

srun nobrainer predict --model=~/projects/trained-models/neuronets/brainy/0.1.0/weights/brain-extraction-unet-128iso-model.h5 --largest-label --rotate-and-predict T1w.nii.gz brainmask_rotate_largest.nii.gz

NOTE: PASSED - brain mask looks pretty good

Volume generation

srun nobrainer generate --model=~/projects/trained-models/neuronets/braingen/0.1.0 --output-shape=128 128 128 generated.nii.gz

NOTE: FAILED (insert error message here)

Guide

  • 01-getting_started.ipynb - PASSED

  • 02-preparing_training_data.ipynb - PASSED

  • cell 7: augment = False should be changed to augment = None
  • should the model be saved at the end so we can evaluate its performance?
  • train_binary_segmentation.ipynb - PASSED
  • cell 15: is this warning an issue?
WARNING:tensorflow:Unable to restore custom metric. Please ensure that the layer implements `get_config` and `from_config` when saving. In addition, please use the `custom_objects` arg when calling `load_model()`.
  • subsequent fit seems to be the same as the fit before save/load
  • train_generation_progressive.ipynb - PASSED
  • But I think this is unfinished. Needs a predict, or generate, or whatever.
  • Inference_with_kwyk_model.ipynb - FAILED

(Insert error snapshot here)

Thoughts

Maybe have a “Recommended workflow for common tasks” section in the README to quickly point users to the state of the art for common data analysis tasks