Object Detection with Tensorflow

10 Jun 2018

Talking to a bunch of friends yesterday about some data projects, and one of them involved scanning aerial videos of grasslands for endangered animals. So here I am today, trying out the Google TensorFlow Object Detection API - one year late, but better late than never right? LOL

I’m beginning first with images, but I’d love to eventually progress to videos, and training it to identify custom objects.


I am installing the below on a Macbook (aka I have no GPU).

1) Install Tensorflow

Thankfully I already have Tensorflow installed. If you don’t, follow the instructions here: https://www.tensorflow.org/install/

2) Install dependencies

Follow this: https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

Some additional notes/ troubleshooting:

$ python setup.py build
$ python setup.py install

Check out this thread if you have more issues: https://github.com/tensorflow/models/issues/2031

Run the notebook!

Being the impatient me, I ran all the cells, skipped to the end and checked that the output was there. Hurrah! It was. Haha

Then I decided to change up the images (second last cell - under the Detection heading. Change the TEST_IMAGE_PATHS to a list of your full image paths).

To save the photos instead of displaying it, instead of plt.imsave(image_np), use plt.imsave('output.jpg', image_np)

Who knew, poodles (if they are sufficiently cute) can be classified as teddy bears!!!!!


This is my dog! I need to level him up to teddy bear cuteness level LOL

Still my dog - still a dog LOL

Hypothesis: does it know it’s a dog because of its position (lying down)? Teddy bears don’t lie down. Let’s use a dog and a soft toy, both lying down on the floor, to try.

Result: soft toy detected as a CAT, dog detected as a BEAR!!!!!! Love this HAHAHAHAHA

Next time, I will move towards real time object recognition! AKA videos!! https://towardsdatascience.com/building-a-real-time-object-recognition-app-with-tensorflow-and-opencv-b7a2b4ebdc32

Or maybe first, building an app using AWS lambda: https://medium.com/tooso/serving-tensorflow-predictions-with-python-and-aws-lambda-facb4ab87ddd

Exciting times ahead!!!!