Catalog PyPI
PACKAGE EXPLORERView in registry

adversarialattacknn

PyPI

A library for adversarial attacks on neural networks

Versions collected1
Direct dependencies4From release 0.1.1
Last observed20 Oct, 20:02 UTC

README

Version 0.1.1 documentation

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

Downloads & popularity

Awaiting observations

No metric observations yet

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

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.113 Mar 20254

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
santhosh1705kumar/adversarialattacknn

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:744aa40718ed71c86977d1bcdf832a4af82380eddd6ea21926d27055955f54f9