Preparing an ensemble classifier for Kaggle's Cats vs. Dogs

To make our demonstration more similar to practical scenarios, we will train a decent model on Kaggle's Cats vs. Dogs dataset (https://www.kaggle.com/c/dogs-vs-cats), then break the model with adversarial examples generated by GAN. This dataset contains 25,000 training images and 12,500 testing images of either dogs or cats. Here, we will only use the 25,000 training images in our experiment.

For convenience, after downloading the dataset, put images of cats and dogs in separate folders, so that the file structure looks like this:

/cats-dogs-kaggle    /cat        /cat.0.jpg        /cat.1.jpg        ...    /dog        /dog.0.jpg        /dog.1.jpg        ...

The model we are training on this dataset is formed of several pre-trained ...

Get Hands-On Generative Adversarial Networks with PyTorch 1.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.