Skip to main content


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 Features • Installation • Quick Start • Usage • Customization • Contributing • License

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.

Metadata

Release files for adversarial-lab 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adversarial-lab 0.0.6
File Size Uploaded Provenance
adversarial_lab-0.0.6.tar.gz 80.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for adversarial-lab 0.0.6
File Interpreter ABI Platform
adversarial_lab-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 212.5 kB

Release files / adversarial_lab-0.0.6.tar.gz

Download URL adversarial_lab-0.0.6.tar.gz
Size 80.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e4e61ad20a887af6bb7203c43eab6b766ff4226c7fd82b2c97d2e904900cd890
BLAKE2b-256 checksum
How to use checksums
1773cddc409eb1e72dad2f96f52e86a3513145788471f3270d5587bf732e4283
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Release files / adversarial_lab-0.0.6-py3-none-any.whl

Download URL adversarial_lab-0.0.6-py3-none-any.whl
Size 131.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7a2c83958b08d6ec823c130a7610981a2fae7268656772d28487d1def3b9f45
BLAKE2b-256 checksum
How to use checksums
fb2c777fa4b4dccb4dacd25c933bc6da83376121d0c07ff4ceae4adb94c6dbc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.13

Security for adversarial-lab 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page