Starting code for the Federated Learning project. Some functions are explicitly left blank for students to fill in.
If not working on CoLab, install environment with conda (preferred):
conda env create -f mldl23fl.yml
The repository supports experiments on the following datasets:
- FEMNIST (Federated Extended MNIST) from LEAF benchmark [1]
- Task: image classification on 62 classes
- 3,500 users
- Instructions for download and preprocessing in
data/femnist/
- Reduced Federated IDDA from FedDrive [2]
- Task: semantic segmentation for autonomous driving
- 24 users
The main.py
orchestrates training. All arguments need to be specified through the args
parameter (options can be found in utils/args.py
).
Example of FedAvg experiment (NB training hyperparameters need to explicitly specified by the students):
- FEMNIST (Image Classification)
python main.py --dataset femnist --model resnet18 --num_rounds 1000 --num_epochs 5 --clients_per_round 10
- IDDA (Semantic Segmentation)
python main.py --dataset idda --model deeplabv3_mobilenetv2 --num_rounds 200 --num_epochs 2 --clients_per_round 8
[1] Caldas, Sebastian, et al. "Leaf: A benchmark for federated settings." Workshop on Federated Learning for Data Privacy and Confidentiality (2019).
[2] Fantauzzo, Lidia, et al. "FedDrive: generalizing federated learning to semantic segmentation in autonomous driving." 2022 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS). IEEE, 2022.