Skip to main content

Black-box Adversarial Toolbox (BAT) - Python Library for Deep Learning Security

Project description

Black-box Adversarial Toolbox (BAT)

Build Status PyPI version License: MIT PyPI - Python Version

A Python Library for Deep Learning Security that focuses on Black-box attacks.

Installation

pip install blackbox-adversarial-toolbox

Usage

import numpy as np
from PIL import Image

from bat.attacks import SimBA
from bat.apis.deepapi import VGG16Cifar10

# Load Image [0.0, 1.0]
x = np.asarray(Image.open('dog.jpg').resize((32, 32))) / 255.0

# Initialize the Cloud API Model
DEEP_API_URL = 'https://api.wuhanstudio.uk'
model = VGG16Cifar10(DEEP_API_URL + "/vgg16_cifar10")

# SimBA Attack
simba = SimBA(model)
x_adv = simba.attack(x, epsilon=0.1, max_it=1000)

# Distributed SimBA Attack
x_adv = simba.attack(x, epsilon=0.1, max_it=1000, distributed=True , batch=50, max_workers=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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page