Skip to main content

A PyTorch library for evaluating model robustness against FGSM, PGD, and CW attacks.

Project description

PyTorch Adversarial Attackers

A PyTorch-based library for evaluating model robustness against adversarial attacks: FGSM, PGD, and CW attacks. Designed to work with all PyTorch models like ResNet, VGG16, MobileNet, etc.

Installation

pip install pytorch-adversarial-attackers

Usage Example

import torch
import torchvision.models as models
from adversarial_eval.attacks import FGSM, PGD, CW
from adversarial_eval.evaluate import evaluate

# Load pre-trained model
model = models.resnet18(pretrained=True).eval()

# Load image
image = torch.rand((1, 3, 224, 224))  # Example input
label = torch.tensor([0])  # Example label

# Apply attacks
fgsm_attack = FGSM(model, epsilon=0.03)
adv_image = fgsm_attack(image, label)

# Evaluate robustness
evaluate(model, image, label)

Attacks Implemented

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytorch_adversarial_attackers-0.1.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

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

pytorch_adversarial_attackers-0.1-py3-none-any.whl (1.9 kB view details)

Uploaded Python 3

File details

Details for the file pytorch_adversarial_attackers-0.1.tar.gz.

File metadata

File hashes

Hashes for pytorch_adversarial_attackers-0.1.tar.gz
Algorithm Hash digest
SHA256 5a7d4930d8dcb51945467b29b47314b5de7b9f6faf4f0c40e9ba30d338b82d02
MD5 c16eb3f257b7e5bbc26313b22ad025cb
BLAKE2b-256 4b24e881878d2916f372cd61f7d3e57e00e4f61935c33a1bfa10060df29befc2

See more details on using hashes here.

File details

Details for the file pytorch_adversarial_attackers-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pytorch_adversarial_attackers-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5b9bf6c104e4ae190ee9d0a434b3d8daef22b58de0ed43dec4dc1ece82940f8
MD5 26230aa5e8da289e4c59e913399939f9
BLAKE2b-256 53fdda14ec5fd8bedbd79f12478331e023bc6b231c535077d5bba798a932a80e

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