spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

Want to use it for the ReID model embedding visualisation

Open senhorinfinito opened this issue 1 year ago • 1 comments

I wanted to visualise the ReID dataset, here is steps I wanted to implement,

  1. I have csv file which contains the columnA as image_name and column B has the feature vector of [1, 512] I wanted to visualise it like I saw for the classification, similarity score should be cosine.

How I can do it, can I contribute in developing it

senhorinfinito avatar Jan 16 '24 15:01 senhorinfinito

Hi @senhorinfinito,I apologize for the late response.

The both steps you need are implemented already:

  1. To load a CSV file first ensure that embeddings are saved as they are expected by Spotlight, e.g.:
image,embedding
path/to/img.jpg,"[0.1, 0.2, 3.1415926535]"
https://path.to/img.jpg,"[0.2, 0.3, 0.4]"

(small example file). Both image paths and URLs are supported natively.

Now, you have two options to load your CSV file into Spotlight:

  • CLI:
spotlight path/to/dataset.csv

or Python/ipython/Jupyter Notebook:

import pandas as pd
from renumics import spotlight

df = pd.read_csv("path/to/dataset.csv")
spotlight.show(df)

Spotlight starts in a browser automatically. So if you see Similarity Map widget at the top-right corner filled with points, it is a sign that your embeddings are recognized correctly. At the click at a row you should see images in the bottom Inspector widget.

  1. Now click at the gear icon in the Similarity Map widget to open the settings. In the Metric input, choose cosine (s. attached image). Screenshot 2024-02-01 at 15-47-25 Spotlight (mnist-tiny csv)

druzsan avatar Feb 01 '24 14:02 druzsan