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.
Diferents scenarios and diferents color.
- [171 14 12]
- [249 55 53]
- [ 33 144 216]
- [48 88 76]
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.