Giter Site home page Giter Site logo

backdoor_detection's Introduction

Backdoor backdoor detection in FL with similarity measurement

The implementation of federated average learning [1] based on PyTorch.

environment

PyTorch-version
  1. GPU RTX3090 + torch1.7.1(cu110) + torchvision 0.8.0

prepare datasets

Before run the code, you need to download train dataset and test data of GTSRB from https://benchmark.ini.rub.de/?section=gtsrb&subsection=dataset#Downloads and move them to GTSRB dirctory.

prepare model

You are supposed to prepare the model in ./checkpoints2/, which is required by load_round in sim_compare1.py. We have given two models for testing. Run server.py first to obtain the required model at the specific round in load_round. Run sim_compare1.py to complete detection of backdoor attack.

usage

Run the code python server.py -nc 100 -cf 0.1 -E 5 -B 10 -mn GTSRB -ncomm 300 -iid 0 -lr 0.01 -vf 1 -g 0 python sim_compare1 -nc 100 -cf 0.1 -E 5 -B 10 -mn GTSRB -ncomm 300 -iid 0 -lr 0.1 -vf 1 -g 0

which means there are 100 clients, we randomly select 10 in each communicating round. The data set are allocated in Non-IID way. The epoch and batch size are set to 5 and 10. The learning rate is 0.1, we validate the codes every 1 rounds during the training, training stops after 300 rounds.

[1] Mcmahan H B , Moore E , Ramage D , et al. Communication-Efficient Learning of Deep Networks from Decentralized Data[J]. 2016.

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.