Until now, we have been working with models that perform well on tabular data. However, not all data have a tabular structure. There are other types of data, such as image data, audio/video data, or text data, which are considered unstructured data. To tackle problems involving these types of data, we’ll need a different kind of model, such as a convolutional neural network (CNN).
A CNN is specifically designed for processing images. These neural networks consist of many layers, hence the term deep. Deep learning is a subset of machine learning that focuses on deep neural networks.
In this chapter, we’ll use a example to study these new concepts. We’ll analyze hair images and classify them based on the hair type. We can obtain the dataset from Kaggle.
Or we can download and unzip it with the following commands:
!wget <https://github.com/SVizor42/ML_Zoomcamp/releases/download/straight-curly-data/data.zip>
!unzip data.zip
The dataset is already split into folders:
train
: Image for training a model (800 images)test
: Images for testing a model (201 images)The training and testing folders each contain two subfolders, with the name of each subfolder representing a hair type.
The most popular frameworks for training these models are TensorFlow and PyTorch. In our case, we’ll use TensorFlow but the following concepts can be also implemented on PyTorch.
We need to install TensorFlow and we can do with the following command:
pip install tensorflow==2.17.1
In some cases, we can't guarantee exactly the same results during the same experiment runs. Therefore, in this project we suggest to install TensorFlow version 2.17.1.