LabelRowV2 Objects
.initialise_labels()
first. To upload your added labels, call :meth:.save()
.
label_hash
Optional[str]
- The label row hash or None if not set.
branch_name
str
- The branch name.
data_hash
str
- The data row hash.
group_hash
Optional[str]
- The data group hash.
dataset_hash
str
- The dataset hash.
dataset_title
str
- The dataset title.
data_title
str
- The data row title.
data_type
DataType
- The data type.
file_type
client_metadata
label_status
workflow documentation <tutorials/workflows:Workflows>
for more details.
Returns:
LabelStatus
- The current labeling status.
WrongProjectTypeError
- If used with workflow-based projects.
annotation_task_status
workflow documentation <tutorials/workflows:Workflows>
for more details.
Returns:
AnnotationTaskStatus
- The current annotation task status.
WrongProjectTypeError
- If used with workflow-based projects.
workflow_graph_node
Optional[WorkflowGraphNode]
- The workflow graph node or None if not set.
is_shadow_data
bool
- True if the label row is shadow data, False otherwise.
created_at
Optional[datetime]
- The creation date or None if not yet created.
last_edited_at
Optional[datetime]
- The last edited date or None if not yet edited.
number_of_frames
int
- The number of frames.
duration
Optional[float]
- The duration or None if not applicable.
fps
Optional[float]
- The fps or None if not applicable.
data_link
None
for DICOM series or image groups created without performance optimizations, as there is no single underlying
file for these data types.
This property will contain a signed URL if :meth:.initialise_labels
was called with include_signed_url=True
.
Returns:
Optional[str]
- The data link or None if not applicable.
width
None
for image groups without performance optimization, as there is no single underlying width
for this data type.
Returns:
Optional[int]
- The width or None if not applicable.
height
None
for image groups without performance optimization, as there is no single underlying height
for this data type.
Returns:
Optional[int]
- The height or None if not applicable.
audio_codec
Optional[str]
- The codec or None if not applicable.
audio_sample_rate
Optional[int]
- The sample rate or None if not applicable.
audio_bit_depth
Optional[int]
- The bit depth or None if not applicable.
audio_num_channels
Optional[int]
- The number of channels or None if not applicable.
backing_item_uuid
Optional[UUID]
- The backing storage item id or None if not found.
task_uuid
Optional[UUID]
- The workflow task uuid or None if not applicable.
WrongProjectTypeError
- If used with non-workflow-based projects.
priority
Optional[float]
- The workflow priority or None if not applicable.
WrongProjectTypeError
- If used with non-workflow-based projects.
is_valid
True
if the labels have correct structure and match the project ontology.
If it is False
, then loading the labels via LabelRowV2
will raise an error, and the label editor
will not be able to load the labels.
You can call :meth:.get_validation_errors
to get the validation error messages.
Returns:
bool
- True if the labels are valid, False otherwise.
ontology_structure
is_labelling_initialised
-
bool
-True
if labelling is initialized,False
otherwise. If this isFalse
, call the :meth:.initialise_labels
method to read or write specific ObjectInstances or ClassificationInstances.
assigned_user_email
last_actioned_by_user_email
get_storage_item
initialise_storage_item
get_signed_url
- IfTrue
,is set true, you can get the signed url from LabelRowV2.get_storage_item().get_signed_url()bundle
- If not provided, initialization is performed independently. If provided, initialization is delayed and performed along with other objects in the same bundle.
initialise_labels
LabelStatus.LABEL_IN_PROGRESS
.
Arguments:
include_object_feature_hashes
- IfNone
, all objects will be included. Otherwise, only objects with the specified feature hashes will be included.WARNING
- Use this filter only for reading labels. Saving a filtered subset will delete all other object instances stored in the Encord platform.include_classification_feature_hashes
- IfNone
, all classifications will be included. Otherwise, only classifications with the specified feature hashes will be included.WARNING
- Use this filter only for reading labels. Saving a filtered subset will delete all other classification instances stored in the Encord platform.include_reviews
- Whether to request read-only information about the reviews of the label row.overwrite
- IfTrue
, overwrite current labels with those stored in the Encord server. IfFalse
and the label row is already initialized, this function will raise an error.bundle
- If not provided, initialization is performed independently. If provided, initialization is delayed and performed along with other objects in the same bundle.include_signed_url
- IfTrue
, the :attr:.data_link
property will contain a signed URL. See documentation for :attr:.data_link
for more details.
from_labels_dict
label_row_dict
- The dictionary of all labels in the Encord format.
get_image_hash
frame_number
- The frame number.
Optional[str]
- The image hash if the frame number is within bounds,None
otherwise.
LabelRowError
- If this function is used for non-image data types.
get_frame_number
image_hash
- The image hash.
Optional[int]
- The frame number if the image hash is found,None
otherwise.
LabelRowError
- If this function is used for non-image data types.
save
bundle
- If not provided, save is executed immediately. If provided, save is executed as part of the bundle.validate_before_saving
- Enable stricter server-side integrity checks. Default isFalse
.
metadata
-
Optional[DICOMSeriesMetadata]
- Metadata for the data type, orNone
if not supported. Currently only supported for DICOM. ReturnsNone
for other formats. Label row needs to be initialized before using this property.
get_frame_view
frame
- Either the frame number or the image hash if the data type is an image or image group. Defaults to the first frame.
FrameView
- A view of the specified frame.
get_frame_metadata
frame
- The frame number or the image hash. Defaults to the first frame.
FrameViewMetadata
- Metadata for the specified frame or image hash.
LabelRowError
- If the specified frame or image hash is not found in the label row.
get_frames_metadata
List[FrameViewMetadata]
- A list of metadata for each frame.
get_frame_views
List[FrameView]
- A list of frame views in order of available frames.
get_object_instances
filter_ontology_object
- Optionally filter by a specific ontology object.filter_frames
- Optionally filter by specific frames.
List[ObjectInstance]
- A list ofObjectInstance
s that match the filters.
add_object_instance
object_instance
- The object instance to add.force
- IfTrue
, overwrites the current objects; otherwise, it will replace the current object.
LabelRowError
- If the object instance is already part of another LabelRowV2.
add_classification_instance
classification_instance
- The classification instance to add.force
- IfTrue
, overwrites the current objects; otherwise, it will replace the current object.
LabelRowError
- If the classification instance is already part of another LabelRowV2 or has overlapping frames.
remove_classification
classification_instance
- The classification instance to remove.
get_classification_instances
filter_ontology_classification
- Optionally filter by a specific ontology classification.filter_frames
- Optionally filter by specific frames.
List[ClassificationInstance]
- All theClassificationInstance
s that match the filter.
remove_object
object_instance
- The object instance to remove.
to_encord_dict
.save()
function.
Returns:
Dict[str, Any]: A dictionary representing the label row in Encord format.
workflow_reopen
Workflow <tutorials/workflows:Workflows>
feature, and will raise an error for pre-workflow projects.
Arguments:
bundle
- Optional parameter. If passed, the method will be executed in a deferred way as part of the bundle.
workflow_complete
.initialise_labels()
was called at least once, and
consequentially the “label_hash” field is not None
. Labels need not be initialized every time the
workflow_complete() method is called.
This method is only relevant for the projects that use the :ref:Workflow <tutorials/workflows:Workflows>
feature, and raises an error for projects that do not use Workflows.
Arguments:
bundle
- Optional parameter. If passed, the method will be executed in a deferred way as part of the bundle.
LabelRowError
- If the label hash is None.
set_priority
priority
- Float value from 0.0 to 1.0, where 1.0 is the highest priority.bundle
- Optional parameter. If passed, the method will be executed in a deferred way as part of the bundle.
WrongProjectTypeError
- If the project is not a workflow-based project.
get_validation_errors
None
.
FrameViewMetadata Objects
image_hash
str
- The image hash.
frame_number
int
- The frame number.
FrameView Objects
image_hash
str
- The image hash.
LabelRowError
- If the data type is not IMAGE or IMG_GROUP.
image_title
str
- The image title.
LabelRowError
- If the data type is not IMAGE or IMG_GROUP.
file_type
str
- The file type.
LabelRowError
- If the data type is not IMAGE or IMG_GROUP.
frame
int
- The frame number.
width
int
- The width of the image or image group.
LabelRowError
- If the width is not set for the data type.
height
int
- The height of the image or image group.
LabelRowError
- If the height is not set for the data type.
data_link
Optional[str]
- The data link, orNone
if not available.
LabelRowError
- If the data type is not IMAGE or IMG_GROUP.
metadata
Optional[DICOMSliceMetadata]
- The metadata for the frame, orNone
if not applicable.
None
for other formats.
add_object_instance
object_instance
- The object instance to add.coordinates
- The coordinates for the object instance.overwrite
- Whether to overwrite existing instance data (default is False).created_at
- Optional creation timestamp.created_by
- Optional creator identifier.last_edited_at
- Optional last edited timestamp.last_edited_by
- Optional last editor identifier.confidence
- Optional confidence score.manual_annotation
- Optional flag indicating manual annotation.
LabelRowError
- If the object instance is already assigned to a different label row.
add_classification_instance
classification_instance
- The classification instance to add.overwrite
- Whether to overwrite existing instance data (default is False).created_at
- Optional creation timestamp.created_by
- Optional creator identifier.confidence
- Confidence score (default is DEFAULT_CONFIDENCE).manual_annotation
- Flag indicating manual annotation (default is DEFAULT_MANUAL_ANNOTATION).last_edited_at
- Optional last edited timestamp.last_edited_by
- Optional last editor identifier.
LabelRowError
- If the classification instance is already assigned to a different label row.
get_object_instances
filter_ontology_object
- Optionally filter by a specific ontology object.
List[ObjectInstance]
- AllObjectInstance
s that match the filter.
get_classification_instances
filter_ontology_classification
- Optionally filter by a specific ontology classification.
List[ClassificationInstance]
- AllClassificationInstance
s that match the filter.
FrameLevelImageGroupData Objects
image_hash
- Hash of the image.image_title
- Title of the image.file_type
- Type of the file (e.g., JPEG, PNG).frame_number
- The number of the frame in the sequence.width
- Width of the image.height
- Height of the image.data_link
- Optional link to additional data related to the image.
LabelRowReadOnlyDataImagesDataEntry Objects
index
- Index of the image.title
- Title of the image.file_type
- Type of the file (e.g., JPEG, PNG).height
- Height of the image.width
- Width of the image.image_hash
- Hash of the image.
LabelRowReadOnlyData Objects
label_hash
- Optional hash for the label.None
if not initialized for labeling.created_at
- Optional creation timestamp.None
if not initialized for labeling.last_edited_at
- Optional last edited timestamp.None
if not initialized for labeling.data_hash
- Hash of the data.data_type
- Type of the data (e.g., IMAGE, VIDEO).label_status
- Status of the label.annotation_task_status
- Optional status of the annotation task.workflow_graph_node
- Optional workflow graph node related to the data.is_shadow_data
- Boolean indicating if the data is shadow data.number_of_frames
- Number of frames in the data.duration
- Optional duration of the video or sequence.fps
- Optional frames per second for video.dataset_hash
- Hash of the dataset.dataset_title
- Title of the dataset.data_title
- Title of the data.audio_codec
- Codec for audio data.audio_bit_depth
- Bit depth for audio data.audio_sample_rate
- Sample Rate for audio data.audio_num_channels
- Number of channels for audio data.width
- Optional width of the data.height
- Optional height of the data.data_link
- Optional link to additional data.task_uuid
- Optional task uuid of the data.priority
- Optional priority of the data.file_type
- Optional file type of the data.client_metadata
- Optional metadata provided by the client.images_data
- Optional list of image data entries.branch_name
- Name of the branch associated with the data.frame_level_data
- Mapping from frame number to frame level data.image_hash_to_frame
- Mapping from image hash to frame number.frame_to_image_hash
- Mapping from frame number to image hash.is_valid
- Boolean indicating if the data is valid.assigned_user_email
- Optional email of the user assigned to the data.last_actioned_by_user_email
- Optional email of the user who last actioned the data.