Giter Site home page Giter Site logo

meta-nerual-trojan-detection's Introduction

Meta Neural Trojan Detection

This repo provides an implementation of detecting Trojans in machine learning models as introduced here.

Installation

The code successfully runs on Python 3.6 and PyTorch 1.6.0. The PyTorch package need to be manually installed as shown here for different platforms and CUDA drivers. Other required packages can be installed by:

pip install -r requirements.txt

The MNIST and CIFAR-10 datasets will be downloaded at running time. To run the audio task, one need to download the SpeechCommand v0.02 dataset, extract it under raw_data/speech_command folder and run python audio_preprocess.py. To run the NLP task, one need to download the pretrained GoogleNews word embedding, extract it under raw_data/rt_polarity folder and run python rtNLP_preprocess.py; the movie review data is already in the folder. The Irish Smart Meter Electricity data is private and we do not include them here.

Training Shadow Models and Target Models

The training of shadow models and target models consist of three parts: training the benign models (train_basic_benign.py), training the shadow models with jumbo learning (train_basic_jumbo.py) and training the target models with certain Trojans (train_basic_trojaned.py).

An example of running on the MNIST task:

python train_basic_benign.py --task mnist
python train_basic_jumbo.py --task mnist
python train_basic_trojaned.py --task mnist --troj_type M
python train_basic_trojaned.py --task mnist --troj_type B

Training and Evaluating the Meta-Classifier

run_meta.py trains and evaluates the meta-classifier using jumbo learning and run_meta_oneclass.py trains and evaluates the meta-classifier using one-class learning. An example of training the meta-classifier with jumbo learning on the MNIST task and evaluating on modification attack:

python run_meta.py --task mnist --troj_type M

meta-nerual-trojan-detection's People

Contributors

xiaojunxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

meta-nerual-trojan-detection's Issues

License

Would you please consider adding a license, such as the MIT license, to this repository? According to GitHub's policy, your code is not open-source unless you specify an open-source license.

Thank you!

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.