Learn practical skills, build real-world projects, and advance your career

Lab 7 Working with a More Diverse Dataset

So, as part of the task you need to process your data -- not least resizing it to be uniform in shape.

You'll follow these steps:

  1. Explore the Example Data of Cats and Dogs
  2. Build and Train a Neural Network to recognize the difference between the two
  3. Evaluate the Training and Validation accuracy

A. Downloading and organising the images into directories

1. Let's start by downloading our example data, a .zip of 2,000 JPG pictures of cats and dogs, and extracting it locally in /tmp.

NOTE: The 2,000 images used in this exercise are excerpted from the "Dogs vs. Cats" dataset available on Kaggle, which contains 25,000 images. Here, we use a subset of the full dataset to decrease training time for educational purposes.

!wget --no-check-certificate \
  https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip \
  -O /tmp/cats_and_dogs_filtered.zip
--2020-10-20 12:29:28-- https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip Resolving storage.googleapis.com (storage.googleapis.com)... 108.177.127.128, 172.217.218.128, 173.194.69.128, ... Connecting to storage.googleapis.com (storage.googleapis.com)|108.177.127.128|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 68606236 (65M) [application/zip] Saving to: ‘/tmp/cats_and_dogs_filtered.zip’ /tmp/cats_and_dogs_ 100%[===================>] 65.43M 50.0MB/s in 1.3s 2020-10-20 12:29:29 (50.0 MB/s) - ‘/tmp/cats_and_dogs_filtered.zip’ saved [68606236/68606236]