MR-based eye tracker without eye tracking
Project description
DeepMReye: magnetic resonance-based eye tracking using deep neural networks
This Jupyter Notebook provides a step-by-step walkthrough of the code. It includes eyeball coregistration, voxel extraction, model training and test as well as basic performance measures. Alternatively, here is a Colab Notebook that runs in the browser. DeepMReye also includes a user-friendly streamlit app (installation option 4): Drag and drop your fMRI data into the interface and download your gaze coordinates shortly after.
This Data Repository includes exemplary data for model training and test, source data of all paper figures as well as pre-trained model weights.
If you have questions, please check out our Frequently Asked Questions page. If you cannot find the answer to your question there, reach out to us!
Installation
Option 1: Pip install
Pip installation
Install DeepMReye with a CPU/GPU version of TensorFlow using the following command.
pip install deepmreye
Anaconda / Miniconda installation
To encapsulate DeepMReye in a virtual environment install with the following commands:
conda create --name deepmreye python=3.9
conda activate deepmreye
pip install deepmreye
For GPU support, follow tensorflow install instruction, e.g.:
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
If installation of ANTsPy fails try to manually install it via:
git clone https://github.com/ANTsX/ANTsPy
cd ANTsPy
pip install CMake
python3 setup.py install
Option 2: Colab
We provide a Colab Notebook showcasing model training and evaluation on a GPU provided by Google Colab. To use your own data, preprocess your data locally and upload only the extracted eyeball voxels. This saves space and avoids data privacy issues. See the Jupyter Notebook for the preprocessing and eyeball-extraction code.
Option 3: Docker
Pull the image from docker hub.
docker pull deepmreye/deepmreye
Use deepMReye in a docker container via jupyterlab:
mkdir -p $PWD/notebooks
docker run -it --rm \
--publish 8888:8888 \
--volume $PWD/notebooks:/home/neuro/notebooks \
deepmreye/deepmreye:latest \
jupyter-lab --no-browser --ip 0.0.0.0
Option 4: Streamlit app
If you would like decode gaze coordinates in your data using a pretrained model, the easiest way is using our streamlit app.
Running the following commands will open a browser window that allows you to upload your data (.nii or .nii.gz) and then download the corresponding gaze coordinates shortly after. Please read our FAQ page before using the pretrained models.
git clone https://github.com/DeepMReye/DeepMReye.git
cd DeepMReye
pip install .
pip install streamlit
streamlit run streamlit/streamlit.py
Data formats
The fMRI data should be organized in 4D NIFTI files (.nii), containing the realigned 3D images acquired over time. The pipeline then extracts the eyeball voxels automatically and saves them as Python Pickle files, which serve as model input. For model training, you additionally need training labels, a numpy array containing 10 gaze coordinates per functional volume. These gaze coordinates can either be camera-based eye-tracking labels or the coordinates of a fixation target, and many file formats can be easily read (e.g. .npy, .npz, .mat, .csv etc.).
Hardware requirements
The GPU version of DeepMReye requires a NVIDIA GPU.
Software requirements
The following python dependencies are being automatically installed when installing DeepMReye (specified in setup.cfg):
tensorflow-gpu (2.2.0)
numpy (1.19.1)
pandas (1.0.5)
matplotlib (3.2.2)
scipy (1.5.0)
ipython (7.13.0)
plotly (4.14.3)
Version in parentheses indicate the ones used for testing the framework. Its extensively tested on Linux 16.04 but should run on all OS (Windows, Mac, Linux) supporting a Python version >3.8 and pip. It is recommended to install the framework and dependencies in a virtual environment (e.g. conda).
BIDS app
If you would like to run a pretrained version of DeepMReye on datasets that follow the Brain Imaging Data Structure (BIDS) format, check out bidsMReye: a wrapper for DeepMReye for BIDS datasets (incl. fMRIprep outputs) developed by Remi Gau.
Correspondence
If you have questions, comments or inquiries, please reach out to us: markus.frey1[at]gmail.com & m.nau[at]vu.nl
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepmreye-0.3.tar.gz.
File metadata
- Download URL: deepmreye-0.3.tar.gz
- Upload date:
- Size: 14.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8a9a8f0ce031af2fd780e80ed79bbfd7592355844f19478728f365d629e44bb
|
|
| MD5 |
5d1f1db293289a499a788f797ae9eb1d
|
|
| BLAKE2b-256 |
691ff7c879018aa45fd6a1c36e02f129dd0fc506a5bc153464ce975e9a601a55
|
File details
Details for the file deepmreye-0.3-py3-none-any.whl.
File metadata
- Download URL: deepmreye-0.3-py3-none-any.whl
- Upload date:
- Size: 2.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25ce644566cd5a28b39006a0669cb52d3950d89976264634dcb20fe7c2191338
|
|
| MD5 |
5ae56d1737993481b0c7362ad77284cd
|
|
| BLAKE2b-256 |
cf926092b4967939539dee12207e882d92bbd737d4e16e68e6afc935c611c349
|