Examples#

There are multiple examples available for Dioptra that demonstrate its capabilities across different models, datasets, adversarial attacks, and adversarial defenses. Here you will find instructions on how to prepare your environment for running an example and a table that lists what is available.

Setup#

To prepare your environment for running the examples, follow the linked instructions below:

  1. Clone the repository and build the included containers

  2. Apply the provided cookiecutter template and run Dioptra

  3. Create and activate the Python virtual environment for the Dioptra examples and download the datasets using the download_data.py script

  4. Edit the docker-compose.yml file to mount the data folder in the worker containers.

  5. Initialize and start Dioptra

  6. Register the custom task plugins for Dioptra’s examples and demos

  7. Register the queues for Dioptra’s examples and demos

  8. Start JupyterLab and open the demo Jupyter notebook (ipynb file extension)

Steps 1–3 and 6–7 only need to be run once. Returning users only need to repeat Steps 4 (if you stopped Dioptra using docker compose down) and 8 (if you stopped the jupyter lab process).

List of Examples#

The current list of examples for Dioptra is provided in the table below. It is recommended that newcomers start with the Tensorflow MNIST Classifier example.

Name

Library

Models

Dataset

Attacks

Defenses

GPU

Tensorflow MNIST Classifier

Tensorflow

ShallowNet,
LeNet

MNIST

FGM

No

Tensorflow MNIST Pixel Threshold

Tensorflow

ShallowNet,
LeNet

MNIST

Pixel Threshold

No

Tensorflow MNIST Model Inversion

Tensorflow

ShallowNet,
LeNet

MNIST

Model Inversion

No

Tensorflow MNIST Feature Squeezing

Tensorflow

ShallowNet,
LeNet

MNIST

Feature Squeezing,
Deepfool,

No

Tensorflow Backdoor Poisoning

Tensorflow

LeNet

MNIST

Backdoor Poisoning

Spatial Smoothing,
JPEG Compression,
Gaussian Augmentation

No

PyTorch MNIST Membership Inference

PyTorch

LeNet

MNIST

Membership Inference

No

Tensorflow ImageNet ResNet50 Demo

Tensorflow

ResNet50

ImageNet

Pixel Threshold
(FGM only)
Spatial Smoothing,
JPEG Compression,
Gaussian Augmentation

Yes

Tensorflow Adversarial Patch Demo

Tensorflow

LeNet (MNIST),
VGG16 (Fruits 360),
ResNet50 (ImageNet)
Fruits 360,
ImageNet

Adversarial Patch

Spatial Smoothing,
JPEG Compression,
Gaussian Augmentation,
Adversarial Training
Yes
(Fruits 360, ImageNet only)

PyTorch Detectron2 Demo

PyTorch

RetinaNet

Road Signs

Backdoor Poisoning

Yes