Custom Embeddings with the SDK
Learn how to import custom embeddings using the Encord SDK.
Encord enables the use of custom embeddings for images, image sequences, image groups, and individual video frames. Custom embeddings allow you to incorporate your own feature representations into Encord’s platform, enhancing capabilities like similarity search, visualizations, and data filtering. This flexibility supports more advanced workflows and deeper insights tailored to your specific use cases.
Custom Embeddings Support
We currently support embeddings of dimensions ranging from 1 to 4096 for Index, and 1 to 2000 for Active, following on from our in-house clip Embeddings.
Import Custom Embeddings
To bring your custom embeddings into Encord, you first need to create a key in your metadata schema. After the key is in your schema, you can import your custom embeddings.
Step 1: Create a New Embedding Type
A key is required in your custom metadata schema for your embeddings. You can use any string as the key for your embeddings. We strongly recommend that you use a string that is meaningful.
If you do not include a key in your metadata schema, your imported embeddings are treated as strings.
Use add_embedding
to add an embedding to your metadata schema.
Key | Description | Display Benefits |
---|---|---|
embedding | 1 to 4096 for Index. 1 to 2000 for Active | Filtering by embeddings, similarity search, 2D scatter plot visualization (Coming Soon) |
Step 2: Upload Embeddings
With the key in the custom metadata schema ready, we can now import our embeddings.
Custom embedding sizes are flexible and can be set anywhere between 1 and 4096.
You can import embeddings after you have imported your data or during your data import.
If config
is not specified, the sampling_rate
is 1 frame per second, and the keyframe_mode
is frame
.
sampling_rate
of 0
only imports the first frame and all keyframes of your video into Index.Final Setup for Custom Embeddings
Once you import custom embeddings to your data (during data import or to existing data in Encord), there is a bit more setup required in Index and Active. These steps can only be performed from the UI.
Use Custom Embeddings
Custom embeddings in Index and Active allow you to:
- Perform similarity searches on your data with custom embeddings
- Adjust the similarity distance on similarity searches
- View your data in a 2D embedding plot graph
- Filter your data based on whether it has custom embeddings or not (Index only)
Was this page helpful?