Open source retina model architectures and training setups
Project description
OpenRetina 
Open-source repository containing neural network models of the retina. The models in this repository are inspired by and contain adapted code of sinzlab/neuralpredictors. Accompanying preprint: openretina: Collaborative Retina Modelling Across Datasets and Species.
Installation
openretina supports installation via pip.
# (Recommended) using a package manager like uv
uv pip install openretina
# Or directly via pip if you prefer
pip install openretina
If you want to train your own models, run Jupyter notebooks, contribute to the project, or modify the source code of openretina, we recommend to install from source.
Consider using uv, a fast and flexible project and package manager. If you are not familiar with uv, check out their simple quickstart guide.
git clone git@github.com:open-retina/open-retina.git
cd open-retina
# Sync with uv
uv sync --extra dev
# Alternatively, install in editable mode via pip.
pip install -e .[dev]
Test openretina by downloading a model and running a forward pass:
import torch
from openretina.models import *
model = load_core_readout_from_remote("hoefling_2024_low_res", "cpu")
responses = model.forward(torch.rand(model.stimulus_shape(time_steps=50)))
Contributing
Before raising a PR please run:
# Fix formatting of python files
make fix-formatting
# Run type checks and unit tests
make test-all
Design decisions and structure
With this repository we provide already pre-trained retina models that can be used for inference and intepretability out of the box, and dataloaders together with model architectures to train new models. For training new models, we rely on pytorch lightning in combination with hydra to manage the configurations for training and dataloading.
The openretina package is structured as follows:
- modules: pytorch modules that define layers and losses
- models: pytorch lightning models that define models that can be trained and evaluated (i.e. models from specific papers)
- data_io: dataloaders to manage access of data to be used for training
- insilico: Methods perform insilico experiments with above models
- stimulus_optimization: optimize inputs for neurons of above models according to interpretable objectives (e.g. most exciting inputs)
- future options: gradient analysis, data analysis
- utils: Utility functions that are used across above submodules
Related papers and data sources
- hoefling_2024: Originally published by Höfling et al. (2024), eLife
- Paper: A chromatic feature detector in the retina signals visual context changes.
- Dataset originally deposited at: https://gin.g-node.org/eulerlab/rgc-natstim
- karamanlis_2024: Originally published by Karamanlis et al. (2024), Nature
- Paper: Nonlinear receptive fields evoke redundant retinal coding of natural scenes
- Dataset: Karamanlis D, Gollisch T (2023) Dataset - Marmoset and mouse retinal ganglion cell responses to natural stimuli and supporting data. G-Node. https://doi.org/10.12751/g-node.ejk8kx
- maheswaranathan_2023: Originally published by Maheswaranathan et al. (2023), Neuron
- Paper: Interpreting the retinal neural code for natural scenes: From computations to neurons
- Dataset: Maheswaranathan, N., McIntosh, L., Tanaka, H., Grant, S., Kastner, D., Melander, J., Nayebi, A., Brezovec, L., Wang, J. Ganguli, S. Baccus, S. (2023). Interpreting the retinal neural code for natural scenes: from computations to neurons. Stanford Digital Repository. Available at https://purl.stanford.edu/rk663dm5577
- goldin_2022: Originally published by Goldin et al. (2022), Nature Communications
- Paper: Context-dependent selectivity to natural images in the retina
- Dataset originally deposited at: https://zenodo.org/records/6868362
- sridhar_2025: Originally published by Sridhar et al. (2025), biorxiv
- Paper: Modeling spatial contrast sensitivity in responses of primate retinal ganglion cells to natural movies
- Dataset: Sridhar S, Gollisch T (2025) Dataset - Marmoset retinal ganglion cell responses to naturalistic movies and spatiotemporal white noise. G-Node. https://doi.gin.g-node.org/10.12751/g-node.3dfiti/
- Models: Models trained on this dataset were developed as part of A systematic comparison of predictive models on the retina
The paper Most discriminative stimuli for functional cell type clustering explains the discriminatory stimulus objective we showcase in notebooks/most_discriminative_stimulus.
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 openretina-1.1.1.tar.gz.
File metadata
- Download URL: openretina-1.1.1.tar.gz
- Upload date:
- Size: 197.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f719eba27e1313caab1d471f76d69607e5a14e9cf7dbc5cf00f24c0037e240a
|
|
| MD5 |
acc4dc91d5c9cf682df112cc47859aaf
|
|
| BLAKE2b-256 |
66b961591cd2d2349c0767056ff84d292f5053ac28051194807687b5ffd58fbb
|
Provenance
The following attestation bundles were made for openretina-1.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on open-retina/open-retina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openretina-1.1.1.tar.gz -
Subject digest:
6f719eba27e1313caab1d471f76d69607e5a14e9cf7dbc5cf00f24c0037e240a - Sigstore transparency entry: 1271909431
- Sigstore integration time:
-
Permalink:
open-retina/open-retina@4a54141e234ec5bc6fedee43ff2b57350ae17554 -
Branch / Tag:
refs/tags/release-version-1.1.1 - Owner: https://github.com/open-retina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4a54141e234ec5bc6fedee43ff2b57350ae17554 -
Trigger Event:
push
-
Statement type:
File details
Details for the file openretina-1.1.1-py3-none-any.whl.
File metadata
- Download URL: openretina-1.1.1-py3-none-any.whl
- Upload date:
- Size: 226.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01e1e5e750174558d8573ee3c75bff179e3e214bb8d78bc98bc31c1baae603ab
|
|
| MD5 |
6bfc4c7df7dd8a158970471e1508aff3
|
|
| BLAKE2b-256 |
5617408470ae69b351a9df8693f00968925485b060f0380ed20c06d27158f123
|
Provenance
The following attestation bundles were made for openretina-1.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on open-retina/open-retina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openretina-1.1.1-py3-none-any.whl -
Subject digest:
01e1e5e750174558d8573ee3c75bff179e3e214bb8d78bc98bc31c1baae603ab - Sigstore transparency entry: 1271909458
- Sigstore integration time:
-
Permalink:
open-retina/open-retina@4a54141e234ec5bc6fedee43ff2b57350ae17554 -
Branch / Tag:
refs/tags/release-version-1.1.1 - Owner: https://github.com/open-retina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4a54141e234ec5bc6fedee43ff2b57350ae17554 -
Trigger Event:
push
-
Statement type: