Giter Club home page Giter Club logo

fedmgd's Introduction

Modeling Global Distribution for Federated Learning with Label Distribution Skew

Abstract

Federated learning achieves joint training of deep models by connecting decentralized data sources, which can significantly mitigate the risk of privacy leakage. However, in a more general case, the distributions of labels among clients are different, called "label distribution skew". Directly applying conventional federated learning without consideration of label distribution skew issue significantly hurts the performance of the global model. To this end, we propose a novel federated learning method, named FedMGD, to alleviate the performance degradation caused by the label distribution skew issue. It introduces a global Generative Adversarial Network to model the global data distribution without access to local datasets, so the global model can be trained using the global information of data distribution without privacy leakage. The experimental results demonstrate that our proposed method significantly outperforms the state-of-the-art on several public benchmarks.

Generative Adversarial Stage Federated Enhancement Stage
(a) Generative Adversarial Stage (b) Federated Enhancement Stage

Requirements

  • torch
  • torchvision
  • dominate
  • visdom
  • h5py
  • numpy
  • matplotlib

Generate Datasets

  • Download dataset (EMNIST / FashionMNIST / SVHN / CIFAR10), and divide data to the client.

For example:

cd ./data/EMNIST

python generate_niid_dirichlet.py

  • Collect distillation data.

pyhton upload_0.05_data.py

Get Started

Example: the EMNIST dataset

1.Comparison with State-of-the-art Methods.

  • FedMGD
  python train_fedmgd.py    --dataroot your_data_root \
                            --name fedmgd \ 
                            --gpu_ids 0,1 \
                            --checkpoints_dir ./result \
                            --model fedmgd  \
                            --input_nc 1 \
                            --n_class 26 \
                            --n_client 5 \
                            --rounds 100 \
                            --num_epochs 10 \
                            --lr 0.0002 \
                            --lr_G 0.0002 \
                            --lr_D 0.0002 
  • Other Methods (In the case of FedAvg, please change the parameter "model")
  python train_federated.py --dataroot your_data_root \
                            --name fedavg \ 
                            --gpu_ids 0,1 \
                            --checkpoints_dir ./result \
                            --model fedavg  \
                            --input_nc 1 \
                            --n_class 26 \
                            --n_client 5 \
                            --rounds 100 \
                            --num_epochs 10 \
                            --lr 0.0002 \

2.Ablation Experiment.

  • (1) Realistic Score in FedMGD.

    • FedDF(unlabeled real data)

      python train_federated.py --model feddf --dataroot your_data_root
      
    • FedDF(labeled real data)

      python train_federated.py --model feddf_with_label --dataroot your_data_root
      
    • FedMGD+FedDF(w/o real data)

      python train_fedmgd.py --model fedmgd_feddf --dataroot your_data_root
      
    • F2U+FedDF(unlabeled w/o real data)

      python train_gan.py --model f2u --dataroot your_data_root
      python train_federated.py --model feddf --dataroot your_data_root --G_path f2u_model_path
      
  • (2) Compare with other distributed GANs.

    python train_gan.py --model mdgan --dataroot your_data_root
    
    python train_gan.py --model fedgan --dataroot your_data_root
    
    python train_fedmgd.py --model fedmgd --dataroot your_data_root
    

Models

Dataset α Epoch Model Generator Acc(%)
FashionMNIST 0.01 400+100 download download 84.04±0.58 (↑13.02)
FashionMNIST 0.05 400+100 download download 87.57±0.40 (↑3.90)
FashionMNIST 0.1 400+100 download download 89.29±1.33 (↑1.01)

Acknowledgments

We refer to the structure of CycleGAN and pix2pix to build the code.

fedmgd's People

Contributors

sheng-t avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.