เป็นกล่องเครื่องมือ Python สำหรับการวิจัยความแข็งแกร่งของฝ่ายตรงข้าม ฟังก์ชันหลักจะถูกนำไปใช้ใน pytorch โดยเฉพาะ Adverch มีโมดูลสำหรับการสร้างการก่อกวนของฝ่ายตรงข้ามและการป้องกันตัวอย่างที่เป็นปฏิปักษ์รวมถึงสคริปต์สำหรับการฝึกอบรมฝ่ายตรงข้าม
เราพัฒนาโฆษณาภายใต้ Python 3.6 และ Pytorch 1.0.0 & 0.4.1 ในการติดตั้งโฆษณาเพียงแค่เรียกใช้
pip install advertorch
หรือโคลน repo และเรียกใช้
python setup.py install
ในการติดตั้งแพ็คเกจในโหมด "แก้ไขได้":
pip install -e .
การโจมตีบางอย่างได้รับการทดสอบกับการใช้งานใน Foolbox หรือ Cleverhans เพื่อให้แน่ใจว่าถูกต้อง ปัจจุบันพวกเขาได้รับการทดสอบภายใต้ห้องสมุดที่เกี่ยวข้องรุ่นต่อไปนี้
conda install -c anaconda tensorflow-gpu==1.11.0
pip install git+https://github.com/tensorflow/cleverhans.git@336b9f4ed95dccc7f0d12d338c2038c53786ab70
pip install Keras==2.2.2
pip install foolbox==1.3.2
# prepare your pytorch model as "model"
# prepare a batch of data and label as "cln_data" and "true_label"
# ...
from advertorch . attacks import LinfPGDAttack
adversary = LinfPGDAttack (
model , loss_fn = nn . CrossEntropyLoss ( reduction = "sum" ), eps = 0.3 ,
nb_iter = 40 , eps_iter = 0.01 , rand_init = True , clip_min = 0.0 , clip_max = 1.0 ,
targeted = False )
adv_untargeted = adversary . perturb ( cln_data , true_label )
target = torch . ones_like ( true_label ) * 3
adversary . targeted = True
adv_targeted = adversary . perturb ( cln_data , target ) สำหรับตัวอย่างที่รันได้โปรดดู advertorch_examples/tutorial_attack_defense_bpda_mnist.ipynb สำหรับวิธีการโจมตีและปกป้อง; ดู advertorch_examples/tutorial_train_mnist.py สำหรับวิธีการฝึกอบรมแบบจำลองที่แข็งแกร่งใน MNIST
เว็บเพจเอกสารอยู่บน readthedocs https://advertorch.readthedocs.io
โฆษณายังอยู่ระหว่างการพัฒนาที่ใช้งานอยู่ เราจะเพิ่มคุณสมบัติ/รายการต่อไปนี้ลงบนถนน:
FastFeatureAttack และ JacobianSaliencyMapAttack ไม่ผ่านการทดสอบกับรุ่นของ Cleverhans ที่ใช้ (พวกเขาใช้เพื่อผ่านการทดสอบใน Cleverhans เวอร์ชันก่อนหน้า) ปัญหานี้กำลังถูกตรวจสอบ ในไฟล์ test_attacks_on_cleverhans.py พวกเขาถูกทำเครื่องหมายว่า "ข้าม" ในการทดสอบ pytest
โครงการนี้ได้รับใบอนุญาตภายใต้ LGPL ข้อกำหนดและเงื่อนไขสามารถพบได้ในไฟล์ License and License.gpl
หากคุณใช้โฆษณาในการวิจัยของคุณเราขอให้คุณอ้างถึงรายงานทางเทคนิคต่อไปนี้:
@article{ding2019advertorch,
title={{AdverTorch} v0.1: An Adversarial Robustness Toolbox based on PyTorch},
author={Ding, Gavin Weiguang and Wang, Luyu and Jin, Xiaomeng},
journal={arXiv preprint arXiv:1902.07623},
year={2019}
}