Black-box Adversarial Toolbox (BAT) - Python Library for Deep Learning Security
Project description
Black-box Adversarial Toolbox (BAT)
A Python Library for Deep Learning Security that focuses on Distributed Black-box attacks.
Installation
pip install blackbox-adversarial-toolbox
Usage (CLI)
Usage: bat [OPTIONS] COMMAND [ARGS]...
The CLI tool for Black-box Adversarial Toolbox (BAT).
Options:
--help Show this message and exit.
Commands:
api Manage Cloud APIs
attack Manage Attacks
example Manage Examples
Useful commands:
# List supported Cloud APIs
$ bat api list
# List supported Attacks
$ bat attack list
# Test Cloud APIs
$ bat api run deepapi
$ bat api run google
$ bat api run imagga
# Run exmaples
$ bat example run simba_deepapi
$ bat example run bandits_deepapi
$ bat example run square_deepapi
Usage (Python)
import numpy as np
from PIL import Image
from bat.attacks import SimBA
from bat.apis.deepapi import DeepAPI_VGG16_Cifar10
# Load Image
x = np.asarray(Image.open("dog.jpg").convert('RGB'))
x = np.array([x])
# Initialize the Cloud API Model
DEEP_API_URL = 'http://localhost:8080'
model = DeepAPI_VGG16_Cifar10(DEEP_API_URL)
# Get Preditction
y_pred = model.predict(x)[0]
# Distributed SimBA Attack
simba = SimBA(model)
x_adv = simba.attack(x, np.argmax(y_pred), epsilon=0.05, max_it=10)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for blackbox-adversarial-toolbox-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2498779fe76c850c01516ac72cffbfe0b8bd3264a3819422bc70ae4c6d15c002 |
|
MD5 | 514f6815a75f91d0b863ffa865475116 |
|
BLAKE2b-256 | f550e4941d90b66a92476039dcc3551d770c92aa0b390f195dde339662e088ee |
Close
Hashes for blackbox_adversarial_toolbox-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d37e953f1a5722dabdb9f24ecf4798554dd3c5e2fbcc00f823dc8117f59ed9b5 |
|
MD5 | 05d3126bdf1164de0e93ba33339a6a25 |
|
BLAKE2b-256 | 9af827544ae5eb5ca9b1e47f0cadd205c084702547e2a949de4afb4a42603926 |