Skip to main content

License: GPL v3 py38 status Build Status NatNeuro Paper Docker Pulls Logo

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!

deepMReye video

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.11
conda activate deepmreye
pip install deepmreye

For GPU support (Linux only), follow the tensorflow install instructions, e.g.:

pip install "tensorflow[and-cuda]"

To run the example notebooks, install the extra dependencies they need:

pip install "deepmreye[notebooks]"

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.

Model Training & Evaluation

Colab Walkthrough

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 ".[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

DeepMReye requires Python 3.11 or later. The following python dependencies are automatically installed when installing DeepMReye (see pyproject.toml; minimum versions in parentheses):

tensorflow (2.16.1)
keras (3.0.0)
antspyx (0.6.1)
numpy (1.23.5)
pandas (1.5.0)
scipy (1.9.2)
scikit-learn (1.1.3)
plotly (5.0.0)

The tests are run on Linux with Python 3.11, 3.12 and 3.13, both with the minimum and the latest versions of the dependencies, and the example notebook is run on Linux and macOS. It is recommended to install the framework and dependencies in a virtual environment (e.g. conda or venv).

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

Metadata

Release files for deepmreye 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepmreye 0.5.0
File Size Uploaded Provenance Actions
deepmreye-0.5.0.tar.gz 15.2 MB With provenance Details for deepmreye-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deepmreye 0.5.0
File Interpreter ABI Platform Actions
deepmreye-0.5.0-py3-none-any.whl Python 3 none any Details for deepmreye-0.5.0-py3-none-any.whl

Total release size: 18.1 MB

Release files / deepmreye-0.5.0.tar.gz

Download URL deepmreye-0.5.0.tar.gz
Size 15.2 MB
Tags Source
SHA-256 checksum
How to use checksums
81fce34a3a0b159214baa54daf6080802531c712d53404c0791717c65f6db897
BLAKE2b-256 checksum
How to use checksums
182ba63c058f3cebffca706b0fa1487f058081f5b55618b10a3b701a8bca49d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / deepmreye-0.5.0-py3-none-any.whl

Download URL deepmreye-0.5.0-py3-none-any.whl
Size 2.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d61f9a8f191390276b685c9f05749e5297a3931abde5c6a0d71aa9f7a45f9100
BLAKE2b-256 checksum
How to use checksums
82f8a920402dcc187600ce980df74797a45f0fcb0417c31fb5e57e50e61bc1b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for deepmreye 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for deepmreye-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page