The beauty of this library is that it makes the work of object detection easy. Let’s work through a simple example with this image.

In order to do this, we’ll need to first fire up our terminal. Predicting the objects in an image is fairly easy. However, before we can start making predictions, we have to download a checkpoint so we’ll have consistent starting points for those predictions. Luminoth provides the lumi command that we’ll use for most of the operations.

Managing checkpoints is done using the lumi checkpoint command, which will download pre-trained models that we’ll use to make predictions. This is such a big advantage—it takes a long time and a lot of computing power to train image recognition models. It is, however, possible to do your own training using cloud infrastructure (Google Cloud, AWS, etc.).

lumi checkpoint refresh

Let’s now look at our downloaded checkpoints. This is done via the lumi checkpoint list command.

lumi checkpoint list

We can clearly see that we have two checkpoints:

Faster R-CNN w/COCO — An object detection model trained on the Faster R-CNN model. Uses the COCO dataset. SSD w/Pascal VOC—An object detection model trained on the Single Shot Multibox Detector (SSD) model. Uses the Pascal dataset.

We’ll now use Luminoth’s Command Line Interface to predict the objects in the image we showed above.

lumi predict bike.jpg

This command outputs the predictions in JSON command.

You and I can agree that this output isn’t visually appealing, to say the least. Luckily for us, the good people from Luminoth provide a way to output an image with the objects in the images as labels.

In order to do this, we’ll first create a directory called predictions to hold the JSON output and the predicted image. Remember that we’re still working on the terminal.

mkdir predictions

Once this is done, we can run the command that will make the predictions and return the images with the labeled objects.

lumi predict bike.jpg -f predictions/objects.json -d predictions/

This command might take a couple of minutes to run. Once it's done we’ll see the output shown below in our predictions folder.