Skip to main content

Unofficial RETFound Package

This is an unofficial, repackaged version of the official RETFound repository. It has been structured specifically to enable installation via pip in secure research environments where direct git clone execution or standard file downloads are restricted.

Source Information

This package distributes the source code from the official RETFound repository, originally based on this source though we have updated the code since:

  • Upstream Commit: ae9a9ecf37857cf47b8aa9f87cd6f710d75db287
  • Commit Date: 30 November 2025

Overview

RETFound is a foundation model for generalisable disease detection from retinal images. This package wraps the original source code, allowing it to be installed and managed as a standard Python dependency without altering the core logic.

Critical Note: This package contains only the source code. It does not include the pre-trained model weights. Weights must be acquired separately via Hugging Face or the links detailed in the official repository.

Installation

Install directly via pip using the designated package name:

pip install retfound-unofficial

Usage

Once installed, the modules from the original repository can be imported natively into your Python environment.

from retfound.models_vit import vit_large_patch16
import torch

# Example: Instantiate the model architecture
model = vit_large_patch16(num_classes=5, drop_path_rate=0.1)

# Note: You must write standard PyTorch code to load your downloaded weights into this model instance
# e.g., model.load_state_dict(torch.load('/path/to/RETFound_mae_natureCFP.pth')['model'])

Acknowledgements and Citation

All intellectual property, model architecture, and original code belong to the RETFound authors at UCL and Moorfields Eye Hospital. This repository is solely a packaging convenience.

If you utilise this code in your research, please cite the original papers:

@article{zhou2023foundation,
  title={A foundation model for generalizable disease detection from retinal images},
  author={Zhou, Yukun and Chia, Mark A and Wagner, Siegfried K and Ayhan, Murat S and Williamson, Dominic J and Struyven, Robbert R and Liu, Timing and Xu, Moucheng and Lozano, Mateo G and Woodward-Court, Peter and others},
  journal={Nature},
  volume={622},
  number={7981},
  pages={156--163},
  year={2023},
  publisher={Nature Publishing Group UK London}
}

@misc{zhou2025generalistversusspecialistvision,
      title={Generalist versus Specialist Vision Foundation Models for Ocular Disease and Oculomics}, 
      author={Yukun Zhou and Paul Nderitu and Jocelyn Hui Lin Goh and Justin Engelmann and Siegfried K. Wagner and Anran Ran and Hongyang Jiang and Lie Ju and Ke Zou and Sahana Srinivasan and Hyunmin Kim and Takahiro Ninomiya and Zheyuan Wang and Gabriel Dawei Yang and Eden Ruffell and Dominic Williamson and Rui Santos and Gabor Mark Somfai and Carol Y. Cheung and Tien Yin Wong and Daniel C. Alexander and Yih Chung Tham and Pearse A. Keane},
      year={2025},
      eprint={2509.03421},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      url={[https://arxiv.org/abs/2509.03421](https://arxiv.org/abs/2509.03421)}, 
}

Metadata

Release files for retfound-unofficial 0.1.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 retfound-unofficial 0.1.0
File Size Uploaded
retfound_unofficial-0.1.0.tar.gz 26.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for retfound-unofficial 0.1.0
File Interpreter ABI Platform
retfound_unofficial-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.8 kB

Release files / retfound_unofficial-0.1.0.tar.gz

Download URL retfound_unofficial-0.1.0.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6824814db9ce2ff682af5b0a2e0c79d71cd314a4e3b49b16c570916b76d03966
BLAKE2b-256 checksum
How to use checksums
786d5b9287fb12b5d1f3213edd160417634120470c09e73c36564699385083d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / retfound_unofficial-0.1.0-py3-none-any.whl

Download URL retfound_unofficial-0.1.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71e9ada185e52ada0c59559777df118df4b9e8a1791d9f56714ccfc638d7e4de
BLAKE2b-256 checksum
How to use checksums
8e8e20f2e8c7d534b9010f15b421ea0e4a5ece77084dd0cc5aa846e250604fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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