Segmenting images using Mask-RCNN and TensorFlow Hub
Mask-RCNN is a state-of-the-art architecture for object detection. However, as its name suggests, it's also excellent at performing image segmentation. In this recipe, we'll leverage an implementation of Mask-RCNN hosted in TensorFlow Hub (TFHub) that has been trained on the gargantuan COCO
dataset. This will help us perform out-of-the-box object detection and image segmentation.
Getting ready
First, we must install Pillow
and TFHub, as follows:
$> pip install Pillow tensorflow-hub
We also need to install the TensorFlow Object Detection API since it contains a series of convenient visualization tools that'll come in handy for looking at the bounding boxes and segmentation masks. 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:
...