Detecting objects using TFHub
TFHub is a cornucopia of state-of-the-art models when it comes to object detection. As we'll discover in this recipe, using them to spot elements of interest in our images is a fairly straightforward task, especially considering they've been trained on the gigantic COCO
dataset, which make them an excellent choice for out-of-the-box object detection.
Getting ready
First, we must install Pillow
and TFHub, as follows:
$> pip install Pillow tensorflow-hub
Also, because some visualization tools we'll use live in the TensorFlow Object Detection API, we must install it. First, cd
to a location of your preference and clone the tensorflow/models
repository:
$> git clone –-depth 1 https://github.com/tensorflow/models
Next, install the TensorFlow Object Detection API, like this:
$> sudo apt install -y protobuf-compiler $> cd models/research $> protoc object_detection/protos/*.proto –-python_out=. ...