ClassificationInstance
ClassificationInstance Objects
classification_hash
A unique identifier for the classification instance.
classification_name
Classification name from the project ontology
feature_hash
Feature node hash from the project ontology
set_for_frames
Places the classification onto the specified frame. If the classification already exists on the frame and
overwrite is set to True
, the currently specified values will be overwritten.
Arguments:
frames:
The frame to add the classification instance to. Defaulting to the first frame for convenience.
overwrite:
If True
, overwrite existing data for the given frames. This will not reset all the
non-specified values. If False
and data already exists for the given frames,
raises an error.
created_at:
Optionally specify the creation time of the classification instance on this frame. Defaults to datetime.now()
.
created_by:
Optionally specify the creator of the classification instance on this frame. Defaults to the current SDK user.
last_edited_at:
Optionally specify the last edit time of the classification instance on this frame. Defaults to datetime.now()
.
last_edited_by:
Optionally specify the last editor of the classification instance on this frame. Defaults to the current SDK
user.
confidence:
Optionally specify the confidence of the classification instance on this frame. Defaults to 1.0
.
manual_annotation:
Optionally specify whether the classification instance on this frame was manually annotated. Defaults to True
.
reviews:
Should only be set by internal functions.
get_annotation
Arguments:
frame
- Either the frame number or the image hash if the data type is an image or image group. Defaults to the first frame.
get_annotations
Returns:
A list of ClassificationInstance.Annotation
in order of available frames.
set_answer
Set the answer for a given ontology Attribute. This is the equivalent of e.g. selecting a checkbox in the UI after adding a ClassificationInstance. There is only one answer per ClassificationInstance per Attribute.
Arguments:
answer
- The answer to set.attribute
- The ontology attribute to set the answer for. If not set, this will be attempted to be inferred. For answers to :class:encord.objects.common.RadioAttribute
or :class:encord.objects.common.ChecklistAttribute
, this can be inferred automatically. For :class:encord.objects.common.TextAttribute
, this will only be inferred if there is only one possible TextAttribute to set for the entire classification instance. Otherwise, a :class:encord.exceptionsLabelRowError
will be thrown.overwrite
- IfTrue
, the answer will be overwritten if it already exists. IfFalse
, this will throw a LabelRowError if the answer already exists.
set_answer_from_list
This is a low level helper function and should not be used directly.
Sets the answer for the classification from a dictionary.
Arguments:
answers_list
- The list to set the answer from.
get_answer
Get the answer set for a given ontology Attribute. Returns None
if the attribute is not yet answered.
For the ChecklistAttribute, it returns None if and only if the attribute is nested and the parent is unselected. Otherwise, if not yet answered it will return an empty list.
Arguments:
attribute
- The ontology attribute to get the answer for.
delete_answer
This resets the answer of an attribute as if it was never set.
Arguments:
attribute
- The ontology attribute to delete the answer for. If not provided, the first level attribute is used.
copy
Creates an exact copy of this ClassificationInstance but with a new classification hash and without being
associated to any LabelRowV2. This is useful if you want to add the semantically same
ClassificationInstance to multiple LabelRowV2
s.
get_all_static_answers
A low level helper function.
Annotation Objects
This class can be used to set or get data for a specific annotation (i.e. the ClassificationInstance for a given frame number).
created_by
Set the created_by field with a user email or None if it should default to the current user of the SDK.
last_edited_by
Set the last_edited_by field with a user email or None if it should default to the current user of the SDK.
reviews
A read only property about the reviews that happened for this object on this frame.
Was this page helpful?