Dog / Cat / Human Detector

Google Inc
Dog
Cat
Human
Supported Device
Vision Kit

The Dog / Cat / Human Detector can identify whether there’s a dog, cat, or person in an image and draw a box around the identified objects. It’s based on the MobileNet model architecture.

Already included in the SD card image

Download

Demo: Human, cat, or dog?

It’s pretty easy for people to spot a person, cat or dog, but it can be pretty tricky for a computer to do it just as well. This demo uses an image recognition model to take an image and guess whether there’s a person, cat or dog on it.

What you’ll need

Assembled Vision Kit with the latest SD card image.

Step 1: Get connected

First, make sure you’re connected to your kit and have a terminal open. All the following commands must be performed on your kit's Raspberry Pi.

Step 2: Stop your current demo

Your Vision Kit might be running another demo, such as the Joy Detector, which runs by default when your kit is turned on. You can tell it's running if the green privacy LED on the front of the kit is illuminated. You can stop the Joy Detector with the following command:

sudo systemctl stop joy_detection_demo

Or if you're running another demo that uses the camera, press Control+C in the terminal to stop it.

Step 3: Find an image to use with your model

This demo requires that you pass it an image, instead of using the camera. So find an image online and download it with the command wget <URL>.

For example, here's an image licensed under Creative Commons:

wget https://c8.staticflickr.com/8/7580/15865399370_3857b60669_o.jpg -O dog.jpg

The file is downloaded to the current directory, named dog.jpg.

Step 4: Run the Dog / Cat / Human Detector

Run the demo with the following command:

~/AIY-projects-python/src/examples/vision/object_detection.py --input dog.jpg

The model takes the image and tries to detect what’s in it, and then print its guess on your terminal screen. Try a couple different images with people, cats or dogs.

You can also specify a filename with the --output argument to receive an image showing a bounding box around the detected dog, cat, or human. For example:

~/AIY-projects-python/src/examples/vision/object_detection.py \
--input dog.jpg --output result.jpg

Note: It takes a few moments for the demo to start because the raw image data must be transferred from the Raspberry Pi memory to the Vision Bonnet—the actual image classification happens very fast. This delay is avoided when processing images directly from the Pi Camera, as shown in the face_detection_camera.py demo.

If you ran into an error, check Help.