This repository contains the PyTorch implementation of FedFound, our federated learning framework for foundation model pretraining and downstream tasks in gastrointestinal (GI) endoscopy imaging.
FedFound enables federated self-supervised pretraining of Vision Transformer (ViT)–based foundation models across multiple institutions while preserving data privacy. The learned representations can be fine-tuned for classification, object detection, and instance segmentation in GI endoscopy datasets.
conda create --name ffm python=3.8pip install -r requirements.txtPlease follow the instructions in data/README.md to organize your dataset before training.
The scripts for pretraining and fine-tuning are located in the /code/fedmae/scripts/endo folder:
-
SLURM users:
Runstart_multiple_pretraining.shto launch federated pretraining across multiple nodes. -
Local users:
Run individual pretraining scripts such asfedavg_ssl.sh,fedavgm_ssl.sh, etc. for single-machine experiments. -
Baseline experiments:
Usefed_ssl.shto run lower- and upper-bound comparisons.
The scripts for fine-tuning pretrained models are also in the /code/fed_mae/scripts/endo folder:
-
SLURM users:
Runstart_multiple_finetuning.shto launch fine-tuning for multiple methods. -
Local users:
Refer tofed_ssl_finetune_multiple.shfor individual or single-machine fine-tuning experiments.
This repository builds upon and extends the code from the SSL-FL repository by Rui Yan et al., which provided the starting point for our federated self-supervised learning framework.