Skip to main content

AdversarialAttackNN

A library for adversarial attacks on neural networks. This package provides several common adversarial attack methods, including FGSM, PGD, and more, to test and evaluate the robustness of deep learning models. these are all gradient attacks

Features

  • Implementations of popular adversarial attack methods (e.g., FGSM, PGD, etc.).
  • Easy-to-use API for applying attacks to any PyTorch model.
  • Ability to customize attack parameters (e.g., epsilon, norm, targeted vs. untargeted attacks).
  • Built-in support for ensemble models.

Installation

You can install adversarialattacknn directly from GitHub using pip:

pip install git+https://github.com/yourusername/adversarialattacknn.git

Or you can install it locally by cloning the repository:

git clone https://github.com/yourusername/adversarialattacknn.git
cd adversarialattacknn
pip install -e .

USAGE

Example:

import torch
from adversarialattacknn import Attack

# Initialize the model (replace with your own model)
model = YourModel()

# Example of using the Attack class
attack = Attack(
    attack='fgsm',
    model_name='resnet18',  # or your custom model
    epsilon=0.1,
    targeted=False,
    random_start=True,
    norm='linfty',
    loss='crossentropy'
)

# Sample data (replace with actual data)
data = torch.randn((1, 3, 224, 224))  # Batch of images
label = torch.tensor([0])  # Ground-truth label

# Perform the attack
perturbation = attack(data, label)

# Apply perturbation to input data
adversarial_example = data + perturbation

-santhoshkumar

Metadata

Release files for adversarialattacknn 0.1.1

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

Source distribution (sdist)

Source distribution for adversarialattacknn 0.1.1
File Size Uploaded Provenance
adversarialattacknn-0.1.1.tar.gz 20.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for adversarialattacknn 0.1.1
File Interpreter ABI Platform
adversarialattacknn-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 63.6 kB

Release files / adversarialattacknn-0.1.1.tar.gz

Download URL adversarialattacknn-0.1.1.tar.gz
Size 20.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d738c01a93f75cd981a07d23ab595d53692e652f711c9cce39f42004ba7a64e5
BLAKE2b-256 checksum
How to use checksums
0c0dd64fb8da6bb911d7414ca008470c9fb1b66033f665703855dcc60c62f73d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / adversarialattacknn-0.1.1-py3-none-any.whl

Download URL adversarialattacknn-0.1.1-py3-none-any.whl
Size 43.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98e219cc3355a906e30397235a6f5331a195b57bc9a4096f83c4c0ae9f5586b8
BLAKE2b-256 checksum
How to use checksums
cb7791c1bf0d3dcc21723640a86eed17b6a9b90cefbcfe85684b88c8a466793c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Security for adversarialattacknn 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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