Skip to main content

OntologyClassificationLevel Objects

Enumeration representing the hierarchical level of a classification within an ontology. Attributes:
  • GLOBAL OntologyClassificationLevel - Indicates a global, whole-image classification that applies to the entire data unit rather than to a specific object or region.

Classification Objects

Represents a whole-image classification as part of an Ontology structure. This class encapsulates an image-level classification that describes the entire data unit rather than individual labeled objects. Each classification wraps a single Attribute (or multiple, if applicable) that defines metadata or semantic context for the image, such as scene type, lighting condition, or general content category. Attributes:
  • uid int - Deprecated. Please use feature_node_hash instead.
  • feature_node_hash str - Unique hash value identifying the feature node in the ontology tree corresponding to this classification.
  • attributes List[Attribute] - List of Attribute instances that define the semantic meaning or properties associated with the classification.
  • _level OntologyClassificationLevel | None - The hierarchical level of this classification (for example: GLOBAL). Optional: defaults to None.
Example:

title

Returns the title of the classification, which is the name of the first attribute. Returns:
  • str - The title of the classification.

level

Get the level of the classification. Returns: OntologyClassificationLevel | None: The level of the classification.

children

Returns the attributes of the classification as children elements. Returns:
  • Sequence[OntologyElement] - The attributes of the classification.

is_global

Check if the classification is global. Returns:
  • bool - True if the classification level is global, False otherwise.

create_instance

Create a ClassificationInstance to be used with a label row. Returns:
  • ClassificationInstance - An instance of ClassificationInstance.

from_dict

Create a Classification instance from a dictionary. Arguments:
  • d dict - A dictionary containing classification information.
Returns:
  • Classification - An instance of Classification.

to_dict

Convert the Classification instance to a dictionary. Returns: Dict[str, Any]: A dictionary representation of the classification. Raises:
  • ValueError - If the classification does not have any attributes.

add_attribute

Adds an attribute to the classification. Arguments:
  • cls Type[AttributeType] - The attribute type, one of RadioAttribute, ChecklistAttribute, TextAttribute.
  • name str - The user-visible name of the attribute.
  • local_uid Optional[int] - Integer identifier of the attribute. Normally auto-generated; omit this unless the aim is to create an exact clone of an existing ontology.
  • feature_node_hash Optional[str] - Global identifier of the attribute. Normally auto-generated; omit this unless the aim is to create an exact clone of an existing ontology.
  • required bool - Whether the label editor would mark this attribute as ‘required’.
Returns:
  • AttributeType - The created attribute that can be further specified with Options, where appropriate.
Raises:
  • ValueError - If the classification already has an attribute assigned.