In this section, we first download the dataset from the official website and then parse it into a convenient format. During this stage, we will leave out the images, which occupy quite a lot of memory. We cover this procedure in the following steps:
-
Define where we want to store our pets dataset and download it using a convenient get_file function in Keras:
DATASET_DIR = "dataset"for type in ("annotations", "images"): tf.keras.utils.get_file( type, f"https://www.robots.ox.ac.uk/~vgg/data/pets/data/{type}.tar.gz", untar=True, cache_dir=".", cache_subdir=DATASET_DIR)
As our dataset resides in an archive, we have also extracted it by passing untar=True. We also pointed cache_dir to the current directory. ...