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 suported 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)
Documentation
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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38a5cf6ef5814d9c11a7004d642a71582c1929ed4a6a2c295aa3f6651a7502ea |
|
MD5 | 4f55c1458c441e63d9153bad75af3f17 |
|
BLAKE2b-256 | 4b8907ebdae7553e7192f07a37865a5e92bfabb884ecb977923cab38c443974e |
Close
Hashes for blackbox_adversarial_toolbox-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7662f705a69c755cddc6ff48e2a5a75479721a2d8c7ca4e09d82e99db12619a9 |
|
MD5 | 612c59ef0e888b8a36fdd11fb0781329 |
|
BLAKE2b-256 | 3834e5ed3c8d042fdf31254ae6e9c6f9387ccdd73328a241aa66b440c36c1fa6 |