A developer guide for creating and modifying features via the Python SDK.

View Features guide page for feature schema definitions and details.

Create a feature

Features will fall into one of two categories: Objects & Classifications.
Here are examples of tool objects you can create.

The optional field requireddefaults to False if not specified.

from labelbox import Tool

bbox_tool = Tool(tool=Tool.Type.BBOX, name="dog_box", required=True)
poly_tool = Tool(tool=Tool.Type.POLYGON, name="dog_poly")
seg_tool = Tool(tool=Tool.Type.SEGMENTATION, name="dog_seg")
point_tool = Tool(tool=Tool.Type.POINT, name="dog_center")
line_tool = Tool(tool=Tool.Type.LINE, name="dog_orientation")
ner_tool = Tool(tool=Tool.Type.NER, name="dog_reference", required=True)

Here are examples of classifications you can create.

from labelbox import Classification, Option

text_classification = Classification(class_type=Classification.Type.TEXT,
                                     name="dog_name", required=True)
radio_classification = Classification(class_type=Classification.Type.RADIO,
                                      options=[Option("poodle")], required=True))
checklist_classification = Classification(
    options=[Option("at_park"), Option("has_leash")])

Get a feature

You can get the feature schema by name or schema id.
Only top level feature schemas are supported.

from labelbox import client

client = Client(api_key="<YOUR_API_KEY>")

## Search feature by name in your org
regulatory_sign_feature_schema = next(client.get_feature_schemas("regulatory-sign"))
classification_feature = next(client.get_feature_schemas("Quality Issues"))

## Get feature by feature schema ID. You can get this from the UI
regulatory_sign_feature_schema = client.get_feature_schema("FEATURE_SCHEMA_ID")


Update feature schema name

Updates the title/name of a feature schema.
Only top level feature schemas are supported.

client.update_feature_schema_title("<feature_id>", "New Title")

Delete or archive a feature in an ontology

Deletes or archives a feature schema from an ontology. If the feature schema is a root-level node with associated labels, it will be archived. If the feature schema is a nested node in the ontology without associated labels, it will be deleted. If the feature schema is a nested ontology node with associated labels, it will neither be deleted nor archived.

To archive a feature means you can unarchive it later on and retrieve annotations made with this feature. If you delete a feature, the feature and its associated annotations cannot be recovered.

client.delete_feature_schema_from_ontology(ontology_id="<ontology_id>", feature_schema_id="<feature_schema_id>")

Unarchive a feature in an ontology

Unarchives a feature schema node in an ontology. Only root-level feature schema nodes can be unarchived.


Check whether a feature is archived

Returns True if a feature schema is archived in the specified ontology, returns False otherwise.

result = client.is_feature_schema_archived(

# True or False