What is your favorite tie color? TensorFlow analysis

Nicolas Bortolotti
Mar 2, 2018 · 2 min read

Surely in formal meetings, etiquette meetings, and even in the business world you once praised or criticized the color of a tie. This is also possible for the world of computer vision.

Today’s challenge will be analyze an image, extract its objects, identify ties elements and then analyze its dominant color. It is a nice challenge if we think about the future to combine our clothes in an appropriate way.

We are going to use TensorFlow and the Object Detection model. We will follow this architectural scheme:

We are going to select this images and apply our proposal.

Images selected

Diferents scenarios and diferents color.

4 differents scenarios

Solutions

solutions for our scenarios desclared

RGBs:

  • [171 14 12]
  • [249 55 53]
  • [ 33 144 216]
  • [48 88 76]

Procedure used

We will process the images with the object detection model, then using the boxes used to identify the objects we will cut the object interested for us.

note: we will use this modification to search only the objects of the “tie” category and then we will have the option of placing the confidence percentage for the category detection of the object.

Now we will send the numpy array of the box with the object to the explorer color routine. This routine will extract the dominant color.

Let’s see the execution of the TensorFlow session:

In this simple way we will have visibility of the dominant color of each extracted object.

Here I share the complete experience in a python script in a Github project, you can also try this example clicking on this Colab notebook. If you need more information regarding Colab and the object detection model please visit this article.

Nicolas Bortolotti

Written by

Program Manager at Google and Software Researcher