View Features guide page for feature schema definitions and details.
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, name="dog_breed", options=[Option("poodle")], required=True)) checklist_classification = Classification( class_type=Classification.Type.CHECKLIST, name="background", options=[Option("at_park"), Option("has_leash")])
You can get the feature schema by name or schema id.
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") print(regulatory_sign_feature_schema) print(classification_feature)
Updates a title of a feature schema
client.update_feature_schema_title("<feature_id>", "New Title")
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.
Unarchives a feature schema node in an ontology. Only root-level feature schema nodes can be unarchived.
client.unarchive_feature_schema_node( ontology_id="<ontology_id>", root_feature_schema_id="<root_feature_schema_id>" )
True if a feature schema is archived in the specified ontology, returns
result = client.is_feature_schema_archived( ontology_id="<ontology_id>", feature_schema_id="<feature_schema_id>" ) # True or False print(result)