Coder Social home page Coder Social logo

trustgan's Introduction

TrustGAN

TrustGAN: Training safe and trustworthy deep learning models through generative adversarial networks

This package provides the code developped for the paper:
"TrustGAN: Training safe and trustworthy deep learning models through generative adversarial networks"
presented at the CAID-2022 (Conference on Artificial Intelligence for Defence) https://arxiv.org/abs/2211.13991

Install

With python, pip and setuptools installed, you simply need to:

python -m pip install .

Get the data and train a model

We will work within ./xps/:

Get the datasets

You can download in-distribution (ID) sample datasets within data/:

python3 ../bin/trustgan-download-data.py --path2save "data/" --dataset "MNIST"

You can download out-of-distribution (OOD) sample datasets within data/:

python3 ../bin/trustgan-download-data.py --path2save "data/" --dataset "FashionMNIST"
python3 ../bin/trustgan-download-data.py --path2save "data/" --dataset "CIFAR10"

Train a model

We will now train two models, one without TrustGAN and another with it, with a selected device <device>:

python3 ../bin/trustgan-model-gan-combined-training.py \
    --path2save "mnist-wo-gan/" \
    --path2dataset "data/MNIST" \
    --nb-classes 10 \
    --prop-net-alone 1 \
    --num-epochs 100 \
    --batch-size 512 \
    --device "cuda:0"
python3 ../bin/trustgan-model-gan-combined-training.py \
    --path2save "mnist-wi-gan/" \
    --path2dataset "data/MNIST" \
    --nb-classes 10 \
    --num-epochs 100 \
    --batch-size 512 \
    --nb-step-net-alone 1 \
    --device "cuda:1"

Test

You can get summary plots and gifs with:

python3 ../bin/trustgan-model-gan-combined-training.py \
    --path2save "mnist-wo-gan/" \
    --path2dataset "data/MNIST" \
    --nb-classes 10 \
    --produce-plots
python3 ../bin/trustgan-model-gan-combined-training.py \
    --path2save "mnist-wi-gan/" \
    --path2dataset "data/MNIST" \
    --nb-classes 10 \
    --produce-plots

Contributing

If you are interested in contributing to the project, start by reading the Contributing guide.

License

This repository is licensed under the terms of the MIT License (see the file LICENSE).

Citing

Please cite the following paper if you are using TrustGAN

@ARTICLE{2022arXiv221113991D,
       author = {{du Mas des Bourboux}, H{\'e}lion},
        title = "{TrustGAN: Training safe and trustworthy deep learning models through generative adversarial networks}",
      journal = {arXiv e-prints},
     keywords = {Computer Science - Machine Learning, Computer Science - Computer Vision and Pattern Recognition},
         year = 2022,
        month = nov,
          eid = {arXiv:2211.13991},
        pages = {arXiv:2211.13991},
archivePrefix = {arXiv},
       eprint = {2211.13991},
 primaryClass = {cs.LG},
       adsurl = {https://ui.adsabs.harvard.edu/abs/2022arXiv221113991D},
      adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

trustgan's People

Contributors

helion-du-mas-des-bourboux-thales avatar sebastienlejeune avatar

Watchers

 avatar  avatar  avatar

Forkers

pcdevsecops

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.