How AI Boosts Conversion by Over 50%: The Revolution in Search and Personalization
Read Full Story
.png)
In the world of ecommerce, effective image classification is key to improving search results and product recommendations. Marqo’s newly launched ecommerce embedding models outperform competitors like Amazon Titan by up to 88%, setting a new standard for retrieval tasks.
In this blog post, we’ll walk you through how to use these models for image classification using the OpenCLIP library. If you’d prefer to use Hugging Face’s transformers, then see this article. By the end, you'll have a practical guide to integrating these state-of-the-art models into your own ecommerce platform and projects.
We have a Google Colab notebook that contains the code presented in this article (as well as for transformers so you can get up and running yourself. Check it out here.
First, we import the relevant modules and define our model, processor and tokenizer. For this example, we will be using a state-of-the-art ecommerce embedding model, Marqo/marqo-ecommerce-embeddings-L. You can find out more about this model, including benchmarking and results, in Marqo's latest blog. This model is capable of encoding both text (ecommerce items) and images into feature vectors that we can compare.
We create a list of ecommerce items to classify and tokenize the text using the model’s tokenizer. This prepares the items for input into the model by converting them into a format the model can process.
Let’s find an image we want to classify. We fetch the image URL and process it using the model’s preprocessing function. This prepares the image for input into the model.
This is what the image URL looks like: it’s a bicycle helmet. Feel free to use a different type of ecommerce item URL here.

With the image processed, we use the model to encode the image into a feature vector, just like we did with the text. This allows the model to compare the image to the list of ecommerce items. Finally, we calculate the similarity between the image features and the text features (ecommerce items).
We then display the top 5 predictions based on the highest similarity scores.
This returns:
As we can see, the model is able to correctly identify the image is indeed a bicycle helmet!
With Marqo’s new ecommerce embedding models, you can efficiently classify images and match them with relevant ecommerce items, providing more accurate and personalized recommendations. Whether you're using Hugging Face transformers or OpenCLIP, these models offer flexibility and top-tier performance for ecommerce tasks. By following the steps in this blog, you can integrate these capabilities into your own systems and improve your ecommerce experience.
Check out the Models on Hugging Face