Note that this excerpt contains only the raw code - the book is rich with additional explanations and illustrations. If you find this content useful, please consider supporting the work by buying the book!
In the previous chapter, we talked about how to use decision trees for classification and regression. In this chapter, we want to direct our attention to another well established supervised learner in the machine learning world: support vector machines (SVMs).
Soon after their introduction in the early 1990, SVMs quickly became popular in the machine learning community, largely because of their success in early handwritten digit classification. They remain relevant to this day, especially in application domains, such as computer vision.
The goal of this chapter is to apply SVMs to a popular problem in computer vision: pedestrian detection. In contrast to a recognition task (where we name the category of an object), the goal of a detection task is to say whether a particular object (or in our case, a pedestrian) is present in an image or not.
You might already know that OpenCV can do this in two to three lines of code. But, we won't learn anything if we do it that way. So instead, we'll build the whole pipeline from scratch! We will obtain a real-world dataset, perform feature extraction using the histogram of oriented gradients (HOG), and apply an SVM to it.
Along the way, we want to address the following questions:
Excited? Then let's go!