Example model inversion attack
This section will create a Jupyter Notebook to demonstrate a model inversion attack on a pretrained convolutional neural network (CNN) for the CIFAR-10 dataset using Keras and the ART. This example will include an initialization with an average image, similar to the approach in other ART sample notebooks:
- Import the libraries we will use and initialize a random seed for our experiment:
# Import necessary libraries import numpy as np import matplotlib.pyplot as plt from keras.models import load_model from keras.datasets import cifar10 from art.attacks.inversion import ModelInversionAttack from art.estimators.classification import KerasClassifier # Set random seed for reproducibility np.random.seed(123)
- Using Keras, we load our CIFAR-10 model as usual and create an ART classifier to use:
# Load the pretrained CIFAR-10 model model = load_model(models/cifar10_model.h5') # Wrap the model with ART's KerasClassifier classifier = KerasClassifier...