1. Overview
  2. Custom Models
  3. Image Similarity Model

Image Similarity Model

DeepLobe's Image Similarity Model is a powerful tool that allows you to compare and identify similar images. This pre-trained model is designed to analyze the visual features of images and provide a similarity score that represents the level of similarity between two images. By leveraging advanced neural network algorithms, the Image Similarity Model can be used in various applications, such as image search engines, content-based recommendation systems, and duplicate image detection.

Overview of Image Similarity Model

The Image Similarity Model works by processing an input image through multiple layers of neural networks. Each layer transforms the input in a way that enables the subsequent layer to analyze it more effectively. The final layer of the model generates a list of similarity scores for each image in a dataset. These scores indicate how similar each image is to the reference image.

Feature extraction is to extract features from the images. This is done using a variety of methods, such as CNNs, local feature-based methods, or global feature-based methods.
Feature comparison compares the extracted features using a similarity function such as L1 and L2 distances, cosine similarity, Correlation coefficient, Jaccard coefficient, Mahalanobis, etc.

Add Training Data


To create a custom Image Similarity Model in DeepLobe, you can follow these steps:

Select "Create New Model" and choose the Image Similarity Model option.

Provide a name and description for your model to help identify and differentiate it from other models.

Next, you will need to add training image data for the two classes you want to compare for similarity. In this case, we will refer to them as "Class 1" and "Class 2".

Adding Training Image Data

For each class, you will need to add a collection of similar images. The more diverse and representative your training data is, the better your model's performance will be. Follow these steps to add training image data:

Select "Add Class" and name it as "Class 1".

Click on "Upload Images" to add a minimum of 50 images that belong to Class 1. These images should be similar to each other in terms of the visual content or category they represent.

Repeat the process for "Class 2", uploading a minimum of 50 images that belong to Class 2. These images should be similar to each other but different from the images in Class 1.

Once you have uploaded the images for both classes, click on "Continue" to proceed with the data health check.

Data Health Check

The data health check is an important step to ensure the quality and effectiveness of your training data. DeepLobe will automatically analyze your data and provide insights into the distribution and balance of images across classes. Here's how to perform the data health check:

DeepLobe will split the dataset into training, validation and testing sets, typically using an 80:10:10 ratio.

You will be presented with a data health report, which includes metrics such as class balance, distribution, and overall dataset quality.

Review the report and make any necessary adjustments to ensure the dataset is balanced and representative of the classes you want to compare.

If the data health report indicates any issues or imbalances, consider adding more images to the classes that are underrepresented to improve the model's performance.

By carefully curating and evaluating your training image data, you can enhance the accuracy and reliability of your custom Image Similarity Model. The data health check ensures that your dataset is balanced and suitable for training the model effectively.

Train Model


Once the data health is good, the next step is to train your image similarity model. Click on "Train model" and DeepLobe will initiate the training process. The model will learn to extract features from the uploaded images and calculate similarity scores based on those features. You will receive an email notification once the training is complete and the model is ready to use.

Test Model

To test the performance of your image similarity model, you can upload an image and click on "Test model". The model will analyze the features of the uploaded image and compare them to the features of the images in the training dataset. It will then generate a similarity score that represents how similar the uploaded image is to the images in the training dataset.

If the similarity score is not satisfactory, you can choose to retrain the model. This can be done by adding more training data to the model, specifically images that are representative of the similarities you want to capture. By retraining the model, you can enhance its accuracy and improve the similarity scoring.

Retrain Model

You can navigate to the "My models" section in the left panel of DeepLobe's interface. Locate the image similarity model you want to retrain and click on the three-vertical dots corresponding to that model. From the dropdown menu, select the "Retrain" option. This will initiate the retraining process for the model.

By incorporating more or additional data and retraining the model, you can achieve greater accuracy and performance in your Image Similarity tasks. DeepLobe simplifies the retraining process, allowing you to optimize your model's performance with ease.

Integrate Model

To integrate the image similarity model into your own applications or systems, you will need the API endpoint and API key. To obtain these, follow these steps:

  1. Navigate to the "My models" section in DeepLobe.
  2. Find the image similarity model you want to integrate and locate the API endpoint. Click on the copy icon next to it to copy the API endpoint.
  3. Generate the API key by going to the "APIs" section. Click on the "Copy" icon next to the API key to copy it.

In your code, replace the placeholder variables with the API endpoint and API key. The API endpoint should be replaced in the first line of the code, while the API key should be replaced in the last line of the code.

For further details on integrating the image similarity model using the API, refer to DeepLobe's API documentation.

Please note that the screenshots provided in the documentation can visually guide you through the process.


Was this article helpful?
© 2024 DeepLobe Help Documentation