Object detection refers to identifying objects of particular classes in images and videos. For example, in self-driving cars, pedestrians and trees have to be identified in order to be avoided.
In this recipe, we'll implement an object detection algorithm in Keras. We'll apply it to a single image and then to our laptop camera. In the How it works... section, we'll discuss the theory and more algorithms for object detection.
Getting ready
For this recipe, we'll need the Python bindings for the Open Computer Vision Library (OpenCV) and scikit-image:
!pip install -U opencv-python scikit-image
As our example image, we'll download an image from an object detection toolbox:
def download_file(url: str, filename='demo.jpg'):
import requests
response = requests.get(url)
with open(filename, 'wb') as f:
f.write(response.content)
download_file('https://raw.githubusercontent.com/open-mmlab/mmdetection/master/demo...