-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from poldracklab/v0.1.0
V0.1.3
- Loading branch information
Showing
20 changed files
with
201 additions
and
3,338 deletions.
There are no files selected for viewing
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,4 +1,10 @@ | ||
# Nondefaced-Detector | ||
|
||
[![PyPI version](https://badge.fury.io/py/nondefaced-detector.svg)](https://badge.fury.io/py/nondefaced-detector) | ||
[![Downloads](https://pepy.tech/badge/nondefaced-detector)](https://pepy.tech/project/nondefaced-detector) | ||
[![Documentation Status](https://readthedocs.org/projects/nondefaced-detector/badge/?version=latest)](https://nondefaced-detector.readthedocs.io/en/latest/?badge=latest) | ||
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_License,_2.0-lightgrey.svg)](https://opensource.org/licenses/Apache-2.0) | ||
|
||
A framework to detect if a 3D MRI volume has been defaced. | ||
|
||
## Table of contents | ||
|
@@ -44,7 +50,7 @@ NOTE: The CPU container will be very slow for training. We highly recommend that | |
### Pip | ||
|
||
```bash | ||
$ pip install --no-cache-dir nondefaced-detector[gpu] | ||
$ pip install --no-cache-dir nondefaced-detector[cpu/gpu] | ||
``` | ||
|
||
<!-- USAGE EXAMPLES --> | ||
|
@@ -56,7 +62,7 @@ Pre-trained networks are avalaible in the *Nondefaced-detector* [models](https:/ | |
```bash | ||
$ docker run --rm -v $PWD:/data nondefaced-detector:latest-cpu \ | ||
predict \ | ||
--model-path=/opt/nondefaced-detector/nondefaced_detector/models/pretrained_weights \ | ||
--model-path=$MODEL_PATH \ | ||
/data/example1.nii.gz | ||
``` | ||
|
||
|
@@ -86,8 +92,9 @@ Steps to reproduce inference results from the paper. | |
**Step 1:** Get the preprocessed dataset. You need to have [datalad](https://handbook.datalad.org/en/latest/intro/installation.html) installed. | ||
```bash | ||
$ datalad clone https://gin.g-node.org/shashankbansal56/nondefaced-detector-reproducibility /data/nondefaced-detector-reproducibility | ||
$ cd /data/nondefaced-detector-reproducibility | ||
$ datalad clone https://gin.g-node.org/shashankbansal56/nondefaced-detector-reproducibility /opt/nondefaced-detector-reproducibility | ||
$ cd /opt/nondefaced-detector-reproducibility | ||
$ datalad get pretrained_weights/* | ||
$ datalad get test_ixi/tfrecords/* | ||
``` | ||
|
@@ -105,12 +112,20 @@ $ conda activate tf-cpu | |
```bash | ||
$ git clone https://github.com/poldracklab/nondefaced-detector.git | ||
``` | ||
**Step 4:** Run the standalone inference script. The inference script uses the pre-trained model weights under `nondefaced_detector/models/pretrained_weights` | ||
**Step 4:** Run the standalone inference script. | ||
```bash | ||
$ cd nondefaced-detector | ||
$ pip install -e . | ||
$ cd nondefaced_detector | ||
$ python inference.py < PATH_TO_TFRECORDS [/data/nondefaced-detector-reproducibility/test_ixi/tfrecords] > | ||
$ python inference.py -h | ||
usage: inference.py [-h] tfrecords_path model_path | ||
positional arguments: | ||
tfrecords_path Path to tfrecords. | ||
model_path Path to pretrained model weights. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
``` | ||
## Paper | ||
|
@@ -148,7 +163,7 @@ Shashank Bansal - [email protected] | |
<!-- ACKNOWLEDGEMENTS --> | ||
## Acknowledgements | ||
## Acknowledgements | ||
### Training Dataset | ||
The original model was trained on 980 defaced MRI scans from 36 different studies that are publicly available at [OpenNeuro.org](https://openneuro.org/) | ||
|
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,6 +1,36 @@ | ||
FROM tensorflow/tensorflow:2.4.1-jupyter | ||
|
||
RUN apt-get install -y vim | ||
RUN apt-get install software-properties-common -y && add-apt-repository ppa:git-core/ppa -y | ||
|
||
RUN apt-get update -y && apt-get upgrade -y | ||
|
||
RUN apt-get install -y vim wget | ||
|
||
ENV PATH="/root/miniconda3/bin:${PATH}" | ||
ARG PATH="/root/miniconda3/bin:${PATH}" | ||
|
||
RUN wget \ | ||
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||
&& mkdir /root/.conda \ | ||
&& bash Miniconda3-latest-Linux-x86_64.sh -b \ | ||
&& rm -f Miniconda3-latest-Linux-x86_64.sh | ||
|
||
RUN conda --version | ||
|
||
RUN conda install -c conda-forge datalad -y | ||
|
||
RUN git config --global user.email "[email protected]" | ||
RUN git config --global user.name "nondefaced-detector" | ||
|
||
RUN datalad clone https://gin.g-node.org/shashankbansal56/nondefaced-detector-reproducibility /opt/nondefaced-detector-reproducibility | ||
|
||
RUN cd /opt/nondefaced-detector-reproducibility | ||
|
||
RUN datalad get pretrained_weights/* | ||
RUN datalad get examples/* | ||
|
||
ENV MODEL_PATH='/opt/nondefaced-detector-reproducibility/pretrained_weights' | ||
ARG MODEL_PATH='/opt/nondefaced-detector-reproducibility/pretrained_weights' | ||
|
||
RUN pip3 install nobrainer \ | ||
sklearn \ | ||
|
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,6 +1,36 @@ | ||
FROM tensorflow/tensorflow:latest-gpu-jupyter | ||
|
||
RUN apt-get install -y vim | ||
RUN apt-get install software-properties-common -y && add-apt-repository ppa:git-core/ppa -y | ||
|
||
RUN apt-get update -y && apt-get upgrade -y | ||
|
||
RUN apt-get install -y vim wget | ||
|
||
ENV PATH="/root/miniconda3/bin:${PATH}" | ||
ARG PATH="/root/miniconda3/bin:${PATH}" | ||
|
||
RUN wget \ | ||
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||
&& mkdir /root/.conda \ | ||
&& bash Miniconda3-latest-Linux-x86_64.sh -b \ | ||
&& rm -f Miniconda3-latest-Linux-x86_64.sh | ||
|
||
RUN conda --version | ||
|
||
RUN conda install -c conda-forge datalad -y | ||
|
||
RUN git config --global user.email "[email protected]" | ||
RUN git config --global user.name "nondefaced-detector" | ||
|
||
RUN datalad clone https://gin.g-node.org/shashankbansal56/nondefaced-detector-reproducibility /opt/nondefaced-detector-reproducibility | ||
|
||
RUN cd /opt/nondefaced-detector-reproducibility | ||
|
||
RUN datalad get pretrained_weights/* | ||
RUN datalad get examples/* | ||
|
||
ENV MODEL_PATH='/opt/nondefaced-detector-reproducibility/pretrained_weights' | ||
ARG MODEL_PATH='/opt/nondefaced-detector-reproducibility/pretrained_weights' | ||
|
||
RUN pip3 install --upgrade tensorflow-gpu==2.3.2 | ||
RUN pip3 install nobrainer \ | ||
|
Oops, something went wrong.