img
- The image to encode. Expects [RGB] channelsformat
- The format of the image.dep_storage_item
dependencies instead.
LabelRowV2.initialise_labels
.
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 with type
and image_url
keys
_ anthropic
: a dict with media_type
, type
, and data
keys.Returns
- a dict or string depending on output_format
.frame_data
- The data pointing to the data asset.Exception
- If the frame_data
cannot be matched to a label rowstorage_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).iterator
- The source iteratorbatch_size
- Size of each batch > 0pydantic.Field
function to construct this var.
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.
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.
ENCORD_SSH_KEY
needs to be set for most use-cases.
To setup a key with Encord, please see
the platform docs.
ENCORD_SSH_KEY
needs to be set for most use-cases.
To setup a key with Encord, please see
the platform docs.
video_path
- The file path to where the video is stored.desired_frame
- The frame to extractException
- If the video cannot be opened properly or the requested
frame could not be retrieved from the video.frame_path
- The file path to write the frame to.frame
- The frame to write.video_path
- The file path to the video you wish to iterate.Exception
- If the video file could not be opened properly.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.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).ValueError
- if the underlying assets are not videos, images, or audio.EncordException
- if data type not supported by SDK yet.storage_item
- Automatically injected storage item dependency.NotImplementedError
- Fails for data types other than video.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.StorageItem
is useful for multiple things like
filter_ontology_objects
- Specify a list of ontology objects to include.
If provided, only instances of these object types are included.
Strings are matched against feature_node_hashes
.
Returns
- The dependency to be injected into the cloud function.
DataLookup
is deprecated and will be removed in version 0.2.10.
Migration Guide:
dep_storage_item
instead:
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
- If True
, 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.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
- If True
, 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.