W2 Assignment 2 Structure of train_dataset

How can I learn the structure/shape of “train_dataset” in assignment 2? How are images and labels arranged? What are the attributes? (I already know that “shape” is not one).

BATCH_SIZE = 32
IMG_SIZE = (160, 160)
directory = “dataset/”
train_dataset = image_dataset_from_directory(directory,
shuffle=True,
batch_size=BATCH_SIZE,
image_size=IMG_SIZE,
validation_split=0.2,
subset=‘training’,
seed=42)

I need to know, in order to create a data set that the model can be trained to, for a different classification task.

The input data here is just a tree full of JPEG files. You can see it by clicking “File → Open” and having a look around:


I downloaded a couple of the files and they are JPEGs with image size 1024 x 768. The TF function image_dataset_from_directory converts a directory tree of image files into a TF “Dataset” object. That includes downscaling the images to the size specified in the call.

That’s pretty handy.