SkyMask: Attack-agnostic Robust Federated Learning with Fine-grained Learnable Masks.

April 4, 2025 · View on GitHub

This repository contains the Official Pytorch Implementation for [ECCV'24] SkyMask: Attack-agnostic Robust Federated Learning with Fine-grained Learnable Masks.

If the project is useful to you, please give us a star. ⭐️

Framework

arch-horizon

Preparation

Install packages

pip install -r requirements.txt

Datasets

For Fashion-MNIST and CIFAR-10 datasets, they will be download automatically during runtime.

For Human Activity Recognition (HAR) dataset, please download train.csv and test.csv from https://www.kaggle.com/datasets/meetnagadia/human-action-recognition-har-dataset, then put them into ./data/HAR/ directory.

Run

Below are the command-line arguments supported by the script:

ParameterTypeDefaultDescription
--server_pcint100The number of data samples held by the server.
--datasetstrFashionMNISTThe dataset to use. Options: FashionMNIST, CIFAR-10, HAR.
--biasfloat0.5Degree of non-IID data distribution.
--netstrcnnThe neural network architecture. Options: cnn, resnet20, LR.
--batch_sizeint32Batch size for local training.
--local_lrfloat0.6Local learning rate for federated learning.
--global_lrfloat0.6Global learning rate for federated learning.
--nworkersint100Number of workers (clients) in federated learning.
--niterint2500Number of global iterations.
--nbyzint20Number of Byzantine (malicious) workers.
--byz_typestrnoType of Byzantine attack. Options: no, trim_attack, krum_attack, etc.
--aggregationstrfedavgAggregation method. Options: fedavg, etc.
--pfloat0.1Bias probability of 1 in server samples.
--local_iterint5Number of local iterations per worker.
--thresfloat0.5Threshold for mask application.

Example Usage

python main.py --aggregation skymask --net resnet20 --dataset CIFAR-10 --niter 500 --global_lr 0.5 --local_lr 0.5 --local_iter 1 --batch_size 64 --nworkers 100 --nbyz 20 --bias 0.5 --byz_type minmax_agnostic

Citation

@inproceedings{yan2024skymask,
  title={SkyMask: Attack-agnostic robust federated learning with fine-grained learnable masks},
  author={Yan, Peishen and Wang, Hao and Song, Tao and Hua, Yang and Ma, Ruhui and Hu, Ningxin and Haghighat, Mohammad Reza and Guan, Haibing},
  booktitle={European Conference on Computer Vision},
  pages={291--308},
  year={2024},
  organization={Springer}
}