Color Detection API for Improving Product Discovery

Color Detection API for Improving Product Discovery


Filtering by color is a feature we often use on fashion marketplaces, e-commerce sites, and any other sites where we buy clothes. Color is also important when buying furniture, and antiques, or searching for stock images.

In such scenarios, color is one of the most important features. Sometimes we search for a specific color, sometimes we want to match or pair it with existing items, and sometimes we just browse the items, but when we see an interesting color, we might find similar items with the same color.

In most cases, product providers do not provide exact descriptions with color labels (or tags), so the page administrators or content moderators must tag the items with colors manually and that can be a very tedious and time-consuming job.

How easy it is to recognize the colors?

Colors are nothing new and computers know how to work with colors. We also have different ways of encoding colors: RGB color space, CMYK color space, etc. It seems like that task can be easily automated.

But colors are somewhat subjective to people. Do you remember the phenomenon of The Dress? A user posted a photo of a dress on Facebook, and people went mad because some perceived it as gold-and-white, while others perceived it as black-and-blue. The phenomenon revealed how differently we may perceive colors.

Blue/black or white/gold dress. Which colors do you see?

When we start talking about colors, we usually think of basic colors such as red, blue, yellow, green, black, etc. But think about pink, magenta, and purple. You could also add lilac, orchid, violet, rose, etc. Where are the borders of these colors? That is not easy to tell.

This task is especially complicated when we talk about user photos. They don’t have perfect lighting, can be a bit blurry, can depict an item from a weird angle, etc.

Why can’t we use a simple color mapping?

While working on the product tagging API, one of the required tag groups was colors. This seems fairly easy: detect the main object, group its colors, select the main ones, find the names for the closest RGB value, and print them.

Then we started experimenting with different algorithms and quickly this is not going in the right direction. We tried several different algorithms, used numerous open-source repositories, and used external services for background removal. To some extent, we understood the results, but they were not acceptable to us.

Consider a white T-shirt on a darker background with dimmed light. If you just look at the colors of pixels of a shirt, it seems gray, and such algorithms will say gray, but when a person looks at that image, it’s obvious that the shirt is white. This was especially bad for other colors such as gold/yellow/mustard, pink/purple/magenta, etc.

Human annotator will tell you this is a white shirt, but if you look at RGB values, it's clearly gray

How do we detect colors from an image?

As mentioned above, color detection can be subjective, so we decided to make our own human-labeled dataset and train a machine-learning model on it. The goal was to integrate background removal and color detection into the same algorithm, that would recognize colors like a person would do.

We also noted to labelers that they ignore color with less than 15% of the share as we are interested in dominant colors. We also allowed multiple colors and we added colorful/multicolor label for items that contain a lot of colors.

In the end, we managed to train such a model, and it identifies colors like a human would do. The resulting model is even better than some labelers. This model is deployed behind an API that you can use for color detection through our Color Detection API for use cases such as color tagging and items.

Color detection process

Which colors can the API detect?

Our color detection API can detect 22 colors + colorful property. You can see a list of supported colors in the image below. These are discrete colors easily understandable to all users. We choose not to use RGB colors or exact coordinates because our approach is to imitate users and their understanding of colors.

Out of this set of 23 color labels (22 colors + colorful), our API can return a set of up to three labels. If you have a black shirt with a large central patch with colorful abstract graphics, API will return black + colorful. If you have a yellow shirt with white sleeves, API might return yellow + white.

Set of colors the API can detect

Use cases

Our Color Recognition API serves as an effective solution for color detection in images (both catalog and user-generated). Specifically designed for product/item color recognition, the API effectively isolates the foreground item and ignores any extraneous background information to accurately detect the item’s colors.

The Color Recognition API can be used in a variety of applications in areas such as e-commerce, search engines, product tagging, content moderation, etc. It can reduce the time required for manually labeling items with colors, or it can improve product discovery and user satisfaction by enabling accurate color filtering.

E-commerce and online stores

Color Detection APIs can be particularly useful for e-commerce and online stores, where they can quickly tag the items with the correct colors. Proper tags and descriptions are used to efficiently categorize and organize products, can have a significant impact on the user experience and overall sales, and can enable a better search experience.

In addition to improving the user experience, color tagging can also help online store owners to better manage and organize their product inventory. By assigning color tags to products, store owners can easily track and analyze sales by color, which can help them to make more informed decisions about product selection and marketing strategies. One thing that will also improve your marketing efforts is the implementation of visual search into your e-commerce business. Find out everything you need to know about visual search.

Example of a color filter on ebay.com

Design inspiration websites

Color Detection API can be particularly useful for fashion or home decor retailers, where color is an important factor in product selection. It can also be used to create color filters or color swatches, which allow users to refine their search results based on color preferences.

Color Detection API will provide users with a more efficient and intuitive way to browse and filter content. And with that additional feature, your websites can make it easier for users to find the inspiration they need and stay engaged with the site for longer periods.

Content management system

Color Detection is beneficial for content management systems (CMS) because it allows you to quickly and easily organize and categorize digital content based on color, which can help to streamline content management processes and improve the overall efficiency of the CMS.

With Color Detection API in place, you can assign color codes to digital assets such as images, videos, or documents, based on various criteria such as content type, topic, or audience.

Color Detection API can also help CMS users to more easily collaborate on content creation and management. It’s something that can help to improve communication and streamline workflows.

How to integrate our Color Detection API?

Our Color Detection API can be used as a Software-as-a-Service (Saas) deployed in the cloud, or we can provide the tool for on-premise deployment and use it if you need a safe AI product.

Color Detection API is implemented as a REST JSON API. This enables easy integration with any backend or e-commerce system. It receives an image and returns a set of colors. You can read more on our Color Detection product page.

API can be also integrated with search databases like ElasticSearch or Solr. You can fetch the color of an image during insertion of a document (or during the ingestion). Color is often used as a facet when filtering products.

If you are thinking about the integration of the API, here are some benefits that come with it:

  • It’s fast — meaning, it can process the image and send back information to your system in less than 50ms
  • It has great scalability
  • It can be used with on-premise deployment — meaning, you can store your data on your own software due to GDPR and privacy policy
  • It’s customizable — meaning, our color tagging API can be customized by your needs, objects, and colors (per request)
  • It’s accurate and precise — meaning, our color tagging API will ignore everything that is not an object you want to color tag

Don’t hesitate! Feel free to contact us so we can integrate color detection API into your system to improve your business.


Recent blog posts

Color Detection API for Improving Product Discovery

Tech Blog: Implementation of the custom bounding box task for the MMDetection framework

We may want to develop a model that solves the detection task, and simultaneously predicts some additional attributes that can be related to the whole image or to the detected instances. This blog post demonstrates how to implement that in the MMDetection framework.
Read more

Color Detection API for Improving Product Discovery

How AI Can Improve UX Design on Mobile Apps

To deliver a smooth user experience, it's essential to stay current with technology in the realm of UX design. In this blog post, we'll look at how AI is becoming increasingly indispensable in web app development to give users a more tailored experience.
Read more

Color Detection API for Improving Product Discovery

Technology and Principles Behind ChatGPT: Invited Talk at FIDIT Rijeka

Velebit AI’s Lead Data Scientist, Mladen Fernežir, held a lecture at the Faculty of Informatics and Digital Technologies in Rijeka about how ChatGPT works, and also what technological excitements lie ahead in front of us.
Read more

We build AI for your needs.

Meet our highly experienced team, who loves to build AI and design its surroundings to incorporate it in your business. Find out how much you can benefit from our fair and open approach.

Contact Us

Members of