Catalog PyPI
Back to packageRELEASE DETAILS

0.0.6

PyPI

adversarial-lab

A unified library for performing adversarial attacks on ML models

Published28 Oct 2025
Direct dependencies15
Transitive dependenciesNot calculated

README

Version 0.0.6 documentation


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.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 19

Native requirements
15 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
matplotlib
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
matplotlib==3.10.0runtime
nltk
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
nltk==3.9.1runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
numpy==2.0.2runtime
plotly
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
plotly==6.0.1runtime
pandas
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pandas==2.2.2runtime
imageio
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
imageioruntime
tensorflow
Environment
{
  "extras": "",
  "marker": "extra == \"tensorflow\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
tensorflow==2.18.0; extra == "tensorflow"runtime
torch
Environment
{
  "extras": "",
  "marker": "extra == \"torch\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
torch==2.4.1; extra == "torch"runtime
tensorflow
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
tensorflow==2.18.0; extra == "full"runtime
torch
Environment
{
  "extras": "",
  "marker": "extra == \"full\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
torch==2.4.1; extra == "full"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest==8.3.3; extra == "testing"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"testing\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov==5.0.0; extra == "testing"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest==8.3.3; extra == "build"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov==5.0.0; extra == "build"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
flake8==7.1.1; extra == "build"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
mypy==1.12.0; extra == "build"runtime
Sphinx
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
Sphinx==8.2.3; extra == "build"runtime
sphinx-autodoc-typehints
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
sphinx-autodoc-typehints==3.1.0; extra == "build"runtime
sphinx-rtd-theme
Environment
{
  "extras": "",
  "marker": "extra == \"build\"",
  "requires_python": ">=3.11",
  "evaluation": "NOT_EVALUATED"
}
sphinx-rtd-theme==3.0.2; extra == "build"runtime

Distribution files

2 collected
adversarial_lab-0.0.6-py3-none-any.whl

bdist_wheel · 128.52 KB · Python py3

Source file
adversarial_lab-0.0.6.tar.gz

sdist · 78.98 KB · Python source

Source file

Repository

PENDING
pavanreddyml/adversarial-lab

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:02 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:1d02bf6d4dd9038b4ed7d564a0184df35b28cd3f760eb25242cb1f5007695945

Other collected versions

View all collected versions →