Core
b64_encode_image
img
- The image to encode. Expects [RGB] channelsformat
- The format of the image.
TaskSpeedColumn Objects
render
LabelRowMetadataIncludeArgs Objects
dep_storage_item
dependencies instead.
LabelRowInitialiseLabelsArgs Objects
LabelRowV2.initialise_labels
.
FrameData Objects
project_hash
The identifier of the given project.data_hash
The identifier of the given data asset.frame
The frame number. If single image, it’s default 0.object_hashes
Object hashes if the request was made on particular objects from the AppFrame Objects
frame
The frame number within the videocontent
An [h,w,c] np.array with color channels RGB.b64_encoding
image_format
- Which type of image encoding to use.output_format
- Different common formats.raw
: the image content as a raw b64 stringurl
: url encoded image content. Compatible with, e.g.,<img src="<the_encoding>" />
openai
: a dict withtype
andimage_url
keys _anthropic
: a dict withmedia_type
,type
, anddata
keys.
Returns
- a dict or string depending onoutput_format
.
InstanceCrop Objects
instance
The ObjectInstance associated to the crop.EditorAgentResponse Objects
message
A message to be displayed to the user.get_user_client
get_initialised_label_row
frame_data
- The data pointing to the data asset.
Exception
- If theframe_data
cannot be matched to a label row
download_asset
storage_item
- The Storage item for which you want to download the associated asset.frame
- The frame that you need. If frame is none for a video, you will get the video path.
NotImplementedError
- If you try to get all frames of an image group.ValueError
- If you try to download an unsupported data type (e.g., DICOM).
get_frame_count
batch_iterator
iterator
- The source iteratorbatch_size
- Size of each batch > 0
GenericFieldModel Objects
set_answer
FieldType
Field from pydantic can be anything so hard to type. This is supposed to indicate that you should use thepydantic.Field
function to construct this var.
OntologyDataModel Objects
__call__
-
answer
- The json object as a raw string. -
Returns
- a list of classification / object instances that you will then have to add to a label row.
validate_json
-
answer_str
- The json object as a raw string. -
Returns
- a list of classification / object instances that you will then have to add to a label row.
Settings Objects
ssh_key_file
The path to the private access key file to authenticate with Encord. Either this or theENCORD_SSH_KEY
needs to be set for most use-cases.
To setup a key with Encord, please see
the platform docs.
ssh_key_content
The content of the private access key file to authenticate with Encord. Either this or theENCORD_SSH_KEY
needs to be set for most use-cases.
To setup a key with Encord, please see
the platform docs.
get_frame
video_path
- The file path to where the video is stored.desired_frame
- The frame to extract
Exception
- If the video cannot be opened properly or the requested frame could not be retrieved from the video.
write_frame
frame_path
- The file path to write the frame to.frame
- The frame to write.
iter_video
video_path
- The file path to the video you wish to iterate.
Exception
- If the video file could not be opened properly.
iter_video_with_indices
video_path
- The file path to the video you wish to iterate.frame_indices
- The frame indices to iterate over.
FrameData
is automatically injected via the api request body.Project
is automatically loaded based on the frame data.label_row_v2
is automatically loaded based on the frame data.
dep_client
dep_single_frame
lr.data_hash.{suffix}
.
When the function has finished running, the downloaded file is removed from the file system.
Example:
storage_item
- The Storage item. Automatically injected (see example above).
dep_asset
ValueError
- if the underlying assets are not videos, images, or audio.EncordException
- if data type not supported by SDK yet.
dep_video_iterator
storage_item
- Automatically injected storage item dependency.
NotImplementedError
- Fails for data types other than video.
dep_data_lookup
dep_data_lookup
is deprecated and will be removed in version 0.2.10.
Use dep_storage_item
instead for accessing storage items.
Migration Guide:
lookup
- The object that you can use to lookup data rows and storage items. Automatically injected.
dep_storage_item
StorageItem
is useful for multiple things like
- Updating client metadata
- Reading file properties like storage location, fps, duration, DICOM tags, etc.
dep_object_crops
-
filter_ontology_objects
- Specify a list of ontology objects to include. If provided, only instances of these object types are included. Strings are matched againstfeature_node_hashes
. -
Returns
- The dependency to be injected into the cloud function.
DEncordClient
Get an authenticated user client.DObjectsInstances
Get all object instances that the agent was triggered on. No pixels, just the annotation.DObjectCrops
Get all object crops that the agent was triggered on. The instance crop contains the object instance, the frame content (pixel values), and the frame.DSingleFrame
Get the single frame that the agent was triggered on.DAssetPath
Get a local file path to data asset temporarily stored till end of agent execution.DVideoIterator
Get a video frame iterator for doing things over many frames.DStorageItem
Get the storage item associated with the underlying agent task to, for example, read/write client metadata or read data properties.DataLookup Objects
DataLookup
is deprecated and will be removed in version 0.2.10.
Migration Guide:
- For accessing storage items, use
dep_storage_item
instead:
backing_item_uuids
get_storage_item
dep_storage_item
dependency instead.
Arguments:
data_hash
- Data hash for the asset for which you need the underlying storage item.dataset_hash
- If you didn’t provide the associated dataset hash in the constructor, this is your last chance.sign_url
- IfTrue
, pre-fetch a signed URLs for the items (otherwise the URLs will be signed on demand).
ValueError
- Mainly if underlying data row cannot be found.
get_storage_items
data_hashes
- Data hashes for the assets for which you need the underlying storage items.dataset_hash
- If you didn’t provided the associated dataset hash in the constructor, this is your last chance.sign_urls
- IfTrue
, pre-fetch a signed URLs for the items (otherwise the URLs will be signed on demand).
ValueError
- Mainly if underlying data row cannot be found.