In this chapter, we will learn how to label image data using data augmentation for semi-supervised machine learning. We will use the CIFAR-10 dataset and the MNIST dataset of handwritten digits to generate labels using data augmentation. From there we will build an image classification machine learning model.
Data augmentation plays a crucial role in data labeling by enhancing the diversity, size, and quality of the dataset. Data augmentation techniques generate additional samples by applying transformations to existing data. This effectively increases the size of the dataset, providing more examples for training and improving the model’s ability to generalize.
In this chapter, we will cover the following:
- How to prepare training data with image data augmentation and implement support vector machines
- How to implement convolutional neural networks with augmented image data
Technical requirements
For this chapter, we will use the CIFAR-10 dataset, which is a publicly available image dataset consisting of 60,000 32×32 color images in 10 classes (http://www.cs.toronto.edu/~kriz/cifar.html), along with the famous MNIST handwritten digits dataset.
Training support vector machines with augmented image data
Support Vector Machines (SVMs) are widely used in machine learning to solve classification problems. SVMs are known for their high accuracy and ability to handle complex datasets. One of the challenges in training SVMs is the availability of large and diverse datasets. In this section, we will discuss the importance of data augmentation in training SVMs for image classification problems. We will also provide Python code examples for each technique.
Figure 6.1 – SVM separates class A and class B with largest margin
SVMs are a type of supervised learning algorithm used for classification and regression analysis. SVMs can be used for outlier detection. SVMs were originally designed for classification tasks, but can also be adapted for anomaly or outlier detection as well.
The objective of SVMs is to find the hyperplane that maximizes the margin between two classes of data. The hyperplane is defined as the decision boundary that separates the data points of two classes. The margin is the distance between the hyperplane and the nearest data point of each class.
SVMs use something called the kernel trick. Let’s understand what this is next.