![]() ![]() Luckily Spotify, Google, and Facebook open-sourced their solution for exactly that problem. To optimize this process, we need to build some kind of index and find a way to iterate over it more efficiently. Iterating over millions of images to find the most similar ones doesn't scale very well if we need to process all of the images every time we want to find a similar one. Photo by the author How to scale it to millions of images If you change the model URL keep in mind different models expect different image shapes. That means that the model learned to find patterns of certain sizes, we do right by following the recommended image size. The input shape defines the image size on which the model was trained. We load the model using TensorFlow Keras. TensorFlow Hub makes it easy to reuse already pre-trained image features, and vector models. But before you invest that effort, I recommend starting without fine-tuning. It can make sense to fine-tune the pre-trained model for your specific use case. They generalize well enough to fit most of the use cases. We can take advantage of one of the many pre-trained deep learning models. To get such a Vector also called an Embedding, we need just a few lines of code and a pre-trained model. I recommend reading more about Explainable AI if you are interested in that specific topic. Recent efforts in research help us better understand that. What the model learned is “ mostly” a black box. The deep learning model learned this information during the training. The numbers of our vector might represent similar specifics. We learned as a child unique specifics like a car is mostly square, and has tires, lights, and doors. Let us generalize the approach and compare it to how we as humans perceive the world. Photo by the author - classification vs feature vector The representation is a vector of float numbers between 0 and 1. We can remove this classification layer and get the visual representation of the model produced for the input image. Is this a cat, car, table, dog, or mouse on the image? This layer gives us for example the class of the image. When using a deep learning model we usually use the last layer of the model, the output layer. Image Similarity can be used to find duplicates in the datasets. Having duplicates in the training data can lead to bad results. High-quality training data is key for successful machine learning projects. A deep learning approach removes the need to put labels on the images. ![]() Putting the right labels to find similar documents is extremely time-consuming. Imagine a digital archive with millions of scanned documents, large and unstructured. But also less obvious ones like keeping the product catalog clean by preventing uploading multiple images of the same product. The most obvious one, finding similar products based on an actual product image. A few use cases I worked on in the past several years: E-CommerceĮ-Commerce has many use cases for a similarity search. The use cases are endless, and you can use image similarity in many different areas. All examples use JS async-await syntax, be sure to call the API inside an async function.Ĭonst deepai = require ( 'deepai' ) // OR include as a script tag in your HTMLĭeepai.Let us start with a few use cases to inspire you before we dig deeper into the technical details. ![]() Get the 'deepai' package here (Compatible with browser & nodejs ): ![]()
0 Comments
Leave a Reply. |