Skip to main content

A unified library for performing adversarial attacks on ML models

Project description


Adversarial Lab
Adversarial Lab

Adversarial Lab is a unified Python library for launching adversarial attacks on any machine learning model. It is framework-agnostic, supporting both TensorFlow and PyTorch.

Key FeaturesInstallationQuick StartUsageCustomizationContributingLicense

Key Features

  • Framework Agnostic: Works seamlessly with both TensorFlow and PyTorch.
  • Wide Range of Attacks: Includes both black-box and white-box attack implementations.
  • Customizable Loss Functions and Optimizers: Easily extendable to custom loss functions and optimization techniques.
  • Noise Generators: Supports various noise generation methods to craft adversarial examples.
  • Defenses: Built-in methods to evaluate and defend against adversarial attacks.

Installation

To install Adversarial Lab, you can use pip. The pip installation does not install tensorflow and pytorch. Both these libraries must be installed for Adversarial Lab to work.

pip install adversarial-lab

Quick Start

Here's a basic example to get you started with a white-box attack on a PyTorch model:

from PIL import Image
import tensorflow as tf
from tensorflow.keras.applications import InceptionV3
from adversarial_lab.attacks.whitebox import WhiteBoxMisclassification

image = Image.open('data/panda.jpg')
model = InceptionV3(weights='imagenet')

attacker = WhiteBoxMisclassification(model, "cce", "adam")
noise = attacker.attack(image_array, epochs=20, strategy="random", verbose=3)

Usage

Attacks

Adversarial Lab supports a variety of adversarial attack techniques. Here's a brief overview:

  • Black-Box Attacks: Located in adversarial_lab/attacks/blackbox
  • White-Box Attacks: Located in adversarial_lab/attacks/whitebox

Defenses

COMING SOON

Customization

Adversarial Lab is designed to be extensible. You can add your custom components in the following areas:

  • Loss Functions: Create your own loss functions in adversarial_lab/core/losses.
  • Optimizers: Extend or modify optimizers in adversarial_lab/core/optimizers.
  • Noise Generators: Implement new noise generators under adversarial_lab/core/noise_generators.

Contributing

We welcome contributions to Adversarial Lab! If you'd like to contribute, please follow these steps:

For detailed guidelines, see the CONTRIBUTING.md file.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

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

adversarial_lab-0.0.5.tar.gz (79.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adversarial_lab-0.0.5-py3-none-any.whl (129.5 kB view details)

Uploaded Python 3

File details

Details for the file adversarial_lab-0.0.5.tar.gz.

File metadata

  • Download URL: adversarial_lab-0.0.5.tar.gz
  • Upload date:
  • Size: 79.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for adversarial_lab-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a6dd4f5d0b0c5537c9513f9d3d06f97e0f413997982e9c132797b1ac29a2e000
MD5 9b4cbf862a63f4ba90c88018362f51e9
BLAKE2b-256 05052efe08c5e1f68efc32d3ce9576a685f9b3905e5f77795624a324dcfc9f26

See more details on using hashes here.

File details

Details for the file adversarial_lab-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for adversarial_lab-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7c9c507d19271c6d7b9c07fdee21dae18d3b4112952571d385e86009a58bb202
MD5 16d7d87905e0f22b45d53dc903d5197a
BLAKE2b-256 73674c06673554c63230ff23ed2bf012a1863e2ac53c0e32a20ab05677d13735

See more details on using hashes here.

Supported by

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