Skip to content

A Python sample for demonstrating Targeted Adversarial Attack - manipulate a source image to be classified as a specified target class by the machine learning classifier

License

Notifications You must be signed in to change notification settings

aaronchong888/Targeted-Adversarial-Attacks

Repository files navigation

Targeted-Adversarial-Attacks

Getting Started

Prerequisites

  • Python 3 (Tested on 3.6.8)
  • numpy (Tested on 1.19.3)
  • opencv-python (Tested on 4.2.0)
  • matplotlib (Tested on 3.0.3)
  • TensorFlow 2 (Tested on 2.2.0)

Installation

pip install -r requirements.txt

Usage

python generate_adversarial_example_targeted.py <input_file_name> <target_class_name>

For example:

python generate_adversarial_example_targeted.py input.jpg airliner

In this code sample, ResNet50 model pre-trained on ImageNet is used. You may refer to imagenet_index.json file for a mapping of ImageNet 1000 class labels to their corresponding index.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

This project is built referencing the tutorial at pyimagesearch - Targeted adversarial attacks with Keras and TensorFlow, and using the following packages and libraries as listed here

About

A Python sample for demonstrating Targeted Adversarial Attack - manipulate a source image to be classified as a specified target class by the machine learning classifier

Topics

Resources

License

Stars

Watchers

Forks

Languages