Other types of data – images
In Chapter 3, we looked at image data, mostly from the perspective of what kind of image data exists. Now, we will take a more pragmatic approach and introduce a better way of working with images than just using files.
Let’s look at how image data is stored in a popular repository – Hugging Face. The library has a specific module for working with datasets – conveniently called Dataset. It can be installed using the pip install -q datasets
command. So, let’s load a dataset and visualize one of the images from there using the following code fragment:
# importing the images library from datasets import load_dataset, Image # loading a dataset "food101", or more concretely it's split for training dataset = load_dataset("food101", split="train")
Now, the variable dataset contains all the images. Well, not all of them – just the part that the designer of the dataset specified...