Embeddings

Embeddings of the selected images are uploaded to the Lightly Platform and can be explored in the embeddings view. The embeddings can be downloaded as CSV files with the Lightly Python client:

from lightly.api import ApiWorkflowClient

# Create the Lightly client to connect to the API.
client = ApiWorkflowClient(token="MY_LIGHTLY_TOKEN", dataset_id="MY_DATASET_ID")

client.download_embeddings_csv(output_path="embedding.csv")

This will download the embeddings of all images in your dataset.

Every run adds a new embedding file to your dataset. You can list all available embedding files as follows:

print(client.get_all_embedding_data())

# Example output:
# [
#     {
#         'created_at': 1670582750137,
#         'id': '639311ded9bf8c106b6d8881',
#         'is2d': False,
#         'is_processed': True,
#         'name': 'default_20221209_10h45m49s'
#     }, 
#     {
#         'created_at': 1670582689602,
#         'id': '639311a17a74719ee7036345',
#         'is2d': False,
#         'is_processed': True,
#         'name': 'default_20221209_10h44m49s'
#     }
# ]

And download a specific embedding file by its id attribute:

client.download_embeddings_csv_by_id(
    embedding_id="639311ded9bf8c106b6d8881",
    output_path="embedding.csv",
)