Custom Metadata in Index
Active and Index support filtering, creating Collections, and by extension, creating Datasets and Projects based on the custom metadata on your data.
Prerequisites
Before you can filter your data or create a Collection based on your data’s custom metadata, the custom metadata must exist in your Annotate Project.
clientMetadata
), which is the metadata associated with individual data units. This is distinct from videoMetadata
that is used to specify video parameters when using Strict client-only access. It is also distinct from patient metadata in DICOM files.Custom metadata (clientMetadata
) is accessed by specifying the dataset using the <dataset_hash>. All Projects that have the specified Dataset attached contain custom metadata.
READ THIS FIRST
While not required, we strongly recommend importing a metadata schema before importing custom metadata into Encord. The process we recommend:
If a metadata schema already exists, you can import metadata. You can run a small piece of code to verify that a metadata schema exists.
Metadata schema
Before importing your custom metadata to Encord, we recommend that you import a metadata schema. Encord uses metadata schemas to validate custom metadata uploaded to Encord and to instruct Index and Active how to display your metadata.
video.description
, while team B could use audio.description
. Another example could be TeamName.MetadataKey
. This approach maintains clarity and avoids key collisions across departments.Benefits of Using a Metadata Schema
Using a metadata schema provides several benefits:
- Validation: Ensures that all custom metadata conforms to predefined data types, reducing errors during data import and processing.
- Consistency: Maintains uniformity in data types across different datasets and projects, which simplifies data management and analysis.
- Filtering and Sorting: Enhances the ability to filter and sort data efficiently in the Encord platform, enabling more accurate and quick data retrieval.
Metadata Schema Table
Use add_scalar
to add a scalar key to your metadata schema.
Scalar Key | Description | Display Benefits |
---|---|---|
boolean | Binary data type with values “true” or “false”. | Filtering by binary values |
datetime | ISO 8601 formatted date and time. | Filtering by time and date |
number | Numeric data type supporting float values. | Filtering by numeric values |
uuid | Customer specified unique identifier for a data unit. | Filtering by customer specified unique identifier |
varchar | Textual data type. Formally string . string can be used as an alias for varchar , but we STRONGLY RECOMMEND that you use varchar . | Filtering by string. |
text | Text data with unlimited length (example: transcripts for audio). Formally long_string . long_string can be used as an alias for text , but we STRONGLY RECOMMEND that you use text . | Storing and filtering large amounts of text. |
Use add_enum
and add_enum_options
to add an enum and enum options to your metadata schema.
Key | Description | Display Benefits |
---|---|---|
enum | Enumerated type with predefined set of values. | Facilitates categorical filtering and data validation |
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) |
Incorrectly specifying a data type in the schema can cause errors when filtering your data in Index or Active. If you encounter errors while filtering, verify your schema is correct. If your schema has errors, correct the errors, re-import the schema, and then re-sync your Active Project.
Import your metadata schema to Encord
Verify your schema
After importing your schema to Encord we recommend that you verify that the import is successful. Run the following code to verify your metadata schema imported and that the schema is correct.
Deprecated - Reserved Keywords
Reserved keywords are strings that are set aside for exclusive use. The following keywords are reserved:
keyframes
KEYFRAMES
keyframes
is reserved for use with frames of interest in videos. Specifying keyframes
on specific frames ensures that those frames import into Index and Active. That means frames specified using keyframes
are available to filter your frames and for calculating embeddings on your data.
You can include keyframes
while importing your videos or after you import your videos.
Import keyframes
to specific data units in a folder
This code allows you to import keyframes
on specific videos in Index. This code DOES NOT OVERWRITE all existing custom metadata on a data unit. It does overwrite custom metadata with existing values and adds new custom metadata to the data unit.
Import while importing videos
This JSON file imports custom metadata while importing your data into Index from a cloud integration.
Importing with Custom Embeddings
You can import custom embeddings with custom metadata. When importing custom embeddings with custom metadata keep the following in mind:
config
is optional when importing your custom embeddings:
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.Examples
-
Example - Simple: Imports custom metadata with the video.
-
Example - Advanced: Imports custom metadata, key frames, and custom embeddings. If custom embeddings are not specified, only key frames appear in Active and Index.
Import to Videos already in Index
Importing with Custom Embeddings
You can import custom embeddings with custom metadata. When importing custom embeddings with custom metadata keep the following in mind:
config
is optional when importing your custom embeddings:
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.Examples
Folders and custom metadata
List custom metadata (Folders)
Import custom metadata (Folders)
Before importing custom metadata to Encord, first import a metadata schema. We strongly recommend that you upload your custom metadata to Folders, instead of importing using Datasets. Importing custom metadata to data in folders allows you to filter your data in Index by custom metadata.
print
command after importing or updating your custom metadata.Import custom metadata to specific data units in a Folder
This code allows you to import custom metadata on specific data units in Index. This code OVERWRITES all existing custom metadata on a data unit.
Import custom metadata to all data units in a Folder
This code allows you to update ALL custom metadata on ALL data units in a Folder in Index. This code OVERWRITES all existing custom metadata on a data unit.
Update custom metadata to specific data units in a folder
This code allows you to update custom metadata on specific data units in Index. This code DOES NOT OVERWRITE all existing custom metadata on a data unit. It does overwrite custom metadata with existing values and adds new custom metadata to the data unit.
Bulk custom metadata import to all data units in a Folder
This code allows you to update custom metadata on all data units in a Folder in Index. This code OVERWRITES all existing custom metadata on a data unit.
Using bundle
allows you to update up to 1000 label rows at a time.
Bulk custom metadata import on specific data units
This code allows you to update custom metadata on specific data units in a Folder in Index. This code DOES NOT OVERWRITE existing custom metadata on a data unit. It does overwrite custom metadata with existing values and adds new custom metadata to the data unit.
Using bundle
allows you to update up to 1000 label rows at a time.
Add custom metadata to images in an image group
The following script adds clientMetadata
to all images / frames in a specified Image Group.
Esure that you:
- Replace
<private_key_path>
with the file path to your private SSH key. - Replace
<image-group-id>
with the File ID (UUID) of the target Image Group. - Customize the
_get_metadata_for_image
function with the clientMetadata you want to add. To add unique metadata for each image, make the function dynamic by passing additional variables.
Datasets and custom metadata
Before importing custom metadata to Encord, first import a metadata schema.
We strongly recommend that you upload your custom metadata to Folders, instead of importing using Datasets. Importing custom metadata to data in Folders allows you to filter your data in Index by custom metadata.
List custom metadata (Datasets)
The following code lists the custom metadata of all data units in the specified Dataset. The code prints the custom metadata along with the data unit’s index within the dataset.
Import custom metadata (Datasets)
Before importing custom metadata to Encord, first import a metadata schema. We strongly recommend that you import your custom metadata to Folders, instead of importing to Datasets. Importing custom metadata to data in folders allows you to filter your data in Index by custom metadata.
Import custom metadata to a specific data unit in your Dataset
You can import custom metadata (clientMetadata
) to specific data units in the Dataset.
- Replace
<private_key_path>
with the path to your private key. - Replace
<dataset_hash>
with the hash of your Dataset. - Replace
Image1.png
and the other file names in themetadata
variable with the names of the files in your Dataset to which you want to add metadata.
You can find the <data unit number> by reading all metadata in the Dataset.
Import custom metadata (clientMetadata
) to all data units in a Dataset
The following code adds the same custom metadata (clientMetadata
) to each data unit in the specified dataset. The code prints the custom metadata along with the data units index within the dataset, so that you can verify that the custom metadata was set correctly.
Custom Metadata in Index
Once your custom metadata is imported to a Folder, you can create Collections based on your custom metadata and then create Datasets and Projects based on the Collections.
To create a Dataset from an Index Collection:
-
Log in to the Encord platform.
The landing page for the Encord platform appears. -
Go to Index > Files.
The All folders page appears with a list of all folders in Encord. -
Click in to a folder.
The landing page for the folder appears and the Explorer button is enabled. -
Click the Explorer button.
The Index Explorer page appears. -
Search, sort, and filter your data until you have the subset of the data you need.
Filtering bykeyframes
can narrow your search to frames of interest. -
Select one or more of the files in the Explorer workspace.
-
Click Select all to select all the images in the subset.
-
Click Add to a Collection.
-
Click New Collection.
-
Specify a meaningful title and description for the Collection.
The title specified here is applied as a tag/label to every selected image. -
Click Collections.
The Collections page appears. -
Select the checkbox for the Collection to create a Dataset.
-
Click Create Dataset.
The Create Dataset dialog appears. -
Specify meaningful content for the following:
-
Dataset Title
-
Dataset Description
- Select Split image groups/sequences to extract images from the groups or sequences and add each image separately to the Dataset, if your Collection includes images from a group or sequence.
Was this page helpful?