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
- FGSM (Fast Gradient Sign Method)
- PGD (Projected Gradient Descent)
- CW (Carlini & Wagner Attack)
- GITHUB LINK https://github.com/santhosh1705kumar/pytorch-adversarial-attackers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytorch_adversarial_attackers-0.1.tar.gz.
File metadata
- Download URL: pytorch_adversarial_attackers-0.1.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a7d4930d8dcb51945467b29b47314b5de7b9f6faf4f0c40e9ba30d338b82d02
|
|
| MD5 |
c16eb3f257b7e5bbc26313b22ad025cb
|
|
| BLAKE2b-256 |
4b24e881878d2916f372cd61f7d3e57e00e4f61935c33a1bfa10060df29befc2
|
File details
Details for the file pytorch_adversarial_attackers-0.1-py3-none-any.whl.
File metadata
- Download URL: pytorch_adversarial_attackers-0.1-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5b9bf6c104e4ae190ee9d0a434b3d8daef22b58de0ed43dec4dc1ece82940f8
|
|
| MD5 |
26230aa5e8da289e4c59e913399939f9
|
|
| BLAKE2b-256 |
53fdda14ec5fd8bedbd79f12478331e023bc6b231c535077d5bba798a932a80e
|