Creating an object detector with image pyramids and sliding windows
Traditionally, object detectors have worked following an iterative algorithm whereby a window is slid across the image, at different scales, in order to detect potential objects at every location and perspective. Although this approach is outdated due to its noticeable drawbacks (which we'll talk more about in the How it works… section), it has the great advantage of being agnostic about the type of image classifier we use, meaning we can use it as a framework to turn any classifier into an object detector. This is precisely what we'll do in this first recipe!
Let's begin.
Getting ready
We need to install a couple of external libraries, such as OpenCV
, Pillow
, and imutils
, which can easily be accomplished with this command:
$> pip install opencv-contrib-python Pillow imutils
We'll use a pre-trained model to power our object detector; therefore, we don't need any data...