How Bagisto utilized TensorFlow.js in production for seamless product search

Updated 24 November 2020

Today in this article we will see “How bagisto utilized TensorFlow.js in production for seamless product search

We’ve been adding many innovative retail eCommerce features in Bagisto since 2018. To make eCommerce simpler for merchants and provide an omnichannel experience to the customers. 

Now the aim is to take Bagisto to the next level. By providing native support for ML features to the customers through a seamless search experience powered by TensorFlow.js.

The challenge, and how we solved it.

Images play a crucial role when selling products online allowing an item to stand out amongst many similar things.

A quick glance at an image can provide instant information about it, and in some cases, reveal more detail faster than reading paragraphs of text.

A good image match can even increase your chances of successfully converting a prospective buyer. 

Traditionally our users would need to use text searches to find products they desired, even if they had an image of the item they wanted to hand.

Depending on how the products have been tagged/described.

The searches a user may use to describe a product may not be accurately reflected in the product description text leading to suboptimal results like the one shown below.


It would be more efficient to allow a user to upload an image of a visually similar product to what they are looking to buy.

So we implemented a system to do just that, as you can see from the image below.

Bagisto utilized TensorFlow.js in production

Now customers can easily search for desired products on the Bagisto website by uploading a product image which we then use to find visually similar products. 

Even better, by combining this with TensorFlow.js, the customer will also find some automatically extracted keywords from the product description.

Which they can then click to find similar products of this category type to further refine results.

This solution currently works for all the products available in the Bagisto store and is not limited to certain types of products.

Further, Bagisto can use these keywords to increase their engagement as well, which can help us to decide what to surface to the user based on items the user was previously interested in.

The Journey 

We tried to give a fast, lightweight, and accurate AR experience to all the users. The difference of a few seconds of loading time will determine whether the experience captures a user’s interest or they just go away.

The main focus of our development was to maximize the accuracy of the result to capture maximum user interest with less computing power.

For this, we are using the MobileNetV2 which is a convolutional neural network that is 53 layers deep and we greatly reduced the number of operations in the network at only a slight performance cost. 

With a strong neural network in place, we provide more than 80% accuracy to the users.

So whenever a user uploads an image on Bagisto, tensorflow.js is activated and sends the query to the convolutional neural network. Which analyses the content of the image and shows the result to the end-users based.


In the very first go when we have decided to implement an image search in Bagisto using TensorFlow.js. Convolution Neural Network is the first thing that comes to our mind.

Because when you need to deal with the images CNN’s are always best.

After that, the next task was to train a good model for detection. But training a model is too computationally expensive because the resources required for training are at least 10s of thousand at least.

Collecting these many images is itself a very lengthy process, so we have decided to go to transfer training.

Transfer learning is the reuse of a pre-trained model on a new problem. It’s currently very popular in deep learning because it can train deep neural networks with comparatively little data.

Moreover, this is very useful in the data science field since most real-world problems typically do not have millions of labeled data points to train such complex models.

Selection of CNN(Convolutional neural network)

There is one more concern that this whole application might also be used in an old laptop, maybe without GPU, or even on your mobile phone.

Also which pretrained model we need to use for Transfer learning.

During the research, we got to know there are many CNN available in the market. And each of them has its pros and cons.

After some more research, we have decided to go with MobilNet.

Choosing the right CNN for your application depends on two factors which you need to trade Accuracy vs FLOPs.

Here’s the comparison of a few of the popular CNNs





Apart from that, mobilenet models can classify images into 1000 object categories, such as a keyboard, mouse, pencil, and many animals.

As a result, the network has learned rich feature representations for a wide range of images. The pretrained version of the network has more than a million images from the ImageNet database.

There are a few things that make MobileNets awesome:

Tensorflow.js is an open-source library you can use to define, train, and run machine learning models entirely in the browser, using Javascript and a high-level layers API.

Also, this whole power-packed library is way too small in size as any other javascript library that makes it more convenient to use.

Running machine learning programs entirely client-side in the browser unlocks new opportunities.

It helps us run our complete ML-based application in the browser only, which reduces the load on the server for each hit.

Bagisto is not only an eCommerce platform for us we are treating it as a part of our daily life. For which we are continuously doing R&D and adopting new technologies. And now our focus is on “How Bagisto utilized TensorFlow.js in production” so that we can give our customers a better search experience.

Not only empowering customers but also providing them seamless services that are simple & easy to use.

When we look at the next generation of eCommerce, we expect TensorFlow.js to provide the backbone of an eCommerce.

TensorFlow.js gives us the tools to build amazing experiences for the users and make it more digital day by day.

Experience it by yourself 

Now you can easily try out our web-based Bagisto Demo powered by TensorFlow.js by yourself in your web browser.

To search for a desirable product you can simply upload a product image. After that, within a few seconds, you will find the same or similar product over the web store as a result of some analyzed keywords to enhance the user searchability experience.


Try it by yourself and share with us your experience here at

That “How Bagisto utilized TensorFlow.js in production for seamless product search”.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • ty le macao
  • Dai Software
    • Simant Verma (Moderator)
  • Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home