geti_sdk.data_models

Introduction

The data_models package contains the SDK representation for all entities in GETi, such as AnnotationScene, Image, Project and Model and many more.

When interacting with the GETi cluster through the geti_sdk.geti.Geti or the rest_clients, all entities retrieved from the cluster will be deserialized into the data models defined in this package.

Module contents

Algorithm-related entities

class geti_sdk.data_models.algorithms.Algorithm(model_size: str, model_template_id: str, gigaflops: float, name: str | None = None, summary: str | None = None, task_type: str | EnumType | None = None, supports_auto_hpo: bool | None = None, default_algorithm: bool | None = None, performance_category: str | None = None, lifecycle_stage: str | None = None)

Representation of a supported algorithm on the Intel® Geti™ platform.

model_size: str
model_template_id: str
gigaflops: float
name: str | None
summary: str | None
task_type: str | None
supports_auto_hpo: bool | None
default_algorithm: bool | None
performance_category: str | None
lifecycle_stage: str | None
to_dict() Dict[str, Any]

Convert the Algorithm to a dictionary representation.

Returns:

Dictionary holding the algorithm data

property overview: str

Return a string that shows an overview of the Algorithm properties.

Returns:

String holding an overview of the algorithm

Project-related entities

class geti_sdk.data_models.task.Task(title: str, task_type: str | TaskType, labels: List[Label] | None = None, label_schema_id: str | None = None, id: str | None = None)

Representation of a Task in GETi.

Variables:
  • title – Title of the task

  • task_type – Type of the task

  • labels – List of labels belonging to the task

  • id – unique database ID of the task

  • label_schema_id – unique database ID of the label schema for the task

title: str
task_type: str
labels: List[Label] | None
label_schema_id: str | None
id: str | None
property type: TaskType

Return the type of the task.

This property is here to make sure that the type of task_type is derived correctly. The attribute self.task_type can be instantiated both as a string and as a TaskType

Returns:

type of the task

property is_trainable: bool

Return True if this Task represents a trainable task.

Returns:

True if the task is trainable, False otherwise

property is_global: bool

Return True if this Task represents a trainable task that produces global labels, False otherwise.

Returns:

True if the task produces global labels, False otherwise

property is_anomaly: bool

Return True if this task is an anomaly task.

Returns:

True if task is an anomaly type task, False otherwise

deidentify() None

Set all identifier fields for the task to None.

get_label_names(include_empty: bool = True) List[str]

Return a list of label names for the task.

Parameters:

include_empty – True to include the empty label (if present), False to exclude it

Returns:

List of label names for the task

to_dict() Dict[str, Any]

Return the dictionary representation of the task.

Returns:

property overview: str

Return a string that shows an overview of the task. This still shows all the detailed information of the task. If less details are required, please use the summary property

Returns:

String holding an overview of the project

property summary: str

Return a string that gives a very brief summary of the task. This is the least detailed representation of the task, if more details are required please use the overview property

Returns:

String holding a brief summary of the task

prepare_for_post() None

Set all fields to None that are not valid for making a POST request to the /projects endpoint.

Returns:

class geti_sdk.data_models.project.Connection(to: str, from_: str)

Representation of a connection between two tasks in GETi.

Variables:
  • to – Name of the task to which the connection is leading

  • from – Name of the task from which the connection originates

to: str
from_: str
class geti_sdk.data_models.project.Pipeline(tasks: List[Task], connections: List[Connection])

Representation of a pipeline for a project in GETi.

Variables:
  • tasks – List of tasks in the pipeline

  • connections – List of connections between the tasks in the pipeline

tasks: List[Task]
connections: List[Connection]
property trainable_tasks: List[Task]

Return an ordered list of trainable tasks.

Returns:

List of trainable tasks in the pipeline

resolve_connections()

Replace the task id’s in the connections attribute of the pipeline with the actual task titles.

Returns:

resolve_parent_labels()

Replace the parent_id’s in the pipeline labels by the actual label names.

Returns:

property label_id_to_name_mapping: Dict[str, str]

Return a mapping of label ID’s to label names for all labels in the pipeline.

Returns:

dictionary containing the label ID’s as keys and the label names as values

get_labels_per_task(include_empty: bool = True) List[List[Label]]

Return a nested list of labels for each task in the pipeline.

Each entry in the outermost list corresponds to a task in the pipeline. The innermost list holds the labels for that specific task

Parameters:

include_empty – True to include empty labels in the output

Returns:

nested list of labels for each task in the pipeline

get_all_labels() List[Label]

Return a list of all labels in the pipeline.

Returns:

List of all labels for every task in the pipeline

deidentify() None

Remove all unique database ID’s from the tasks and labels in the pipeline.

prepare_for_post() None

Set all fields to None that are not valid for making a POST request to the /projects endpoint.

Returns:

class geti_sdk.data_models.project.Project(name: str, pipeline: Pipeline, datasets: List[Dataset] | None = None, score: float | None = None, performance: Performance | None = None, creation_time: str | datetime | None = None, id: str | None = None, thumbnail: str | None = None, creator_id: str | None = None, storage_info: Dict | None = None)

Representation of a project in Intel® Geti™.

Variables:
  • id – Unique database ID of the project

  • name – Name of the project

  • creation_time – Time at which the project was created

  • pipeline – Pipeline for the project

  • datasets – List of datasets belonging to the project

  • score – Score achieved by the AI assistant for the project

  • thumbnail – URL at which a thumbnail for the project can be obtained

  • storage_info – Storage information for the project can be obtained

name: str
pipeline: Pipeline
datasets: List[Dataset] | None
score: float | None
performance: Performance | None
creation_time: str | None
id: str | None
thumbnail: str | None
creator_id: str | None
storage_info: Dict | None
get_trainable_tasks() List[Task]

Return an ordered list of trainable tasks.

Returns:

List of trainable tasks in the project

property project_type: str

Return a string containing the project type. The type is constructed by concatenating the types of tasks in the task chain together, separated by a ‘_to_’ sequence.

For example, a project with a detection task followed by a segmentation task will have it’s project type set as: ‘detection_to_segmentation’

Returns:

string containing the project type

deidentify() None

Remove all unique database ID’s from the project, pipeline and datasets.

Returns:

prepare_for_post() None

Set all fields to None that are not valid for making a POST request to the /projects endpoint.

Returns:

to_dict() Dict[str, Any]

Convert the project to a dictionary representation.

Returns:

Dictionary holding the project data

get_labels_per_task(include_empty: bool = True) List[List[Dict[str, Any]]]

Return a nested list containing the labels for each task in the project. Each entry in the outermost list corresponds to a trainable task in the project.

Parameters:

include_empty – True to include empty labels in the output, False to exclude them

Returns:

get_parameters() Dict[str, str | List[str]]

Return the parameters used to create the project.

Returns:

Dictionary containing the keys project_name, project_type and labels

get_all_labels() List[Label]

Return a list of all labels in the project.

Returns:

List of all labels in the project

property overview: str

Return a string that shows an overview of the project. This still shows all the detailed information of the project. If less details are required, please use the summary property

Returns:

String holding an overview of the project

property summary: str

Return a string that gives a very brief summary of the project. This is the least detailed representation of the project, if more details are required please use the overview property

Returns:

String holding a brief summary of the project

property training_dataset: Dataset

Return a training dataset for the project.

Returns:

Training dataset for the project

Annotation-related entities

class geti_sdk.data_models.label.LabelSource(user_id: str | None = None, model_id: str | None = None, model_storage_id: str | None = None)

Representation of a source for a ScoredLabel in GETi

Variables:
  • user_id – ID of the user who assigned the label, if any

  • model_id – ID of the model which generated the label, if any

  • model_storage_id – ID of the model storage to which the model belongs

user_id: str | None
model_id: str | None
model_storage_id: str | None
class geti_sdk.data_models.label.Label(name: str, color: str, group: str, is_empty: bool, hotkey: str = '', domain: Domain | None = None, id: str | None = None, parent_id: str | None = None, is_anomalous: bool | None = None)

Representation of a Label in GETi.

Variables:
  • name – Name of the label

  • id – Unique database ID of the label

  • color – Color (in hex representation) of the label

  • group – Name of the label group to which the label belongs

  • is_empty – True if the label represents an empty label, False otherwise

  • parent_id – Optional name of the parent label, if any

name: str
color: str
group: str
is_empty: bool
hotkey: str
domain: Domain | None
id: str | None
parent_id: str | None
is_anomalous: bool | None
prepare_for_post() None

Set all fields to None that are not valid for making a POST request to the /projects endpoint.

Returns:

property color_tuple: Tuple[int, int, int]

Return the color of the label as an RGB tuple.

Returns:

class geti_sdk.data_models.label.ScoredLabel(probability, name: str | None = None, color: str | None = None, id: str | None = None, source: LabelSource | None = None)

Representation of a Label with an assigned probability in GETi.

Variables:
  • name – Name of the label

  • id – Unique database ID of the label

  • color – Color (in hex representation) of the label

  • probability

  • source

probability: float
name: str | None
color: str | None
id: str | None
source: LabelSource | None
property color_tuple: Tuple[int, int, int]

Return the color of the label as an RGB tuple.

Returns:

classmethod from_label(label: Label, probability: float) ScoredLabel

Create a ScoredLabel instance from an input Label and probability score.

Parameters:
  • label – Label to convert to ScoredLabel

  • probability – probability score for the label

Returns:

ScoredLabel instance corresponding to label and probability

class geti_sdk.data_models.shapes.Shape(type: str | ShapeType)

Representation of a shape in on the Intel® Geti™ platform.

Variables:

type – Type of the shape

type: str
abstract to_roi() Rectangle

Return the bounding box containing the shape, as an instance of the Rectangle class.

Returns:

Rectangle representing the bounding box for the shape

abstract to_absolute_coordinates(parent_roi: Rectangle) Shape

Convert the Shape to absolute coordinates, given the rectangle representing it’s parent region of interest.

Parameters:

parent_roi – Region of interest containing the shape

Returns:

Shape converted to the coordinate system of it’s parent roi

abstract to_normalized_coordinates(image_width: int, image_height: int) Dict[str, Any]

Convert the Shape to a normalized coordinate system, such that all coordinates are represented as floats in the interval [0, 1].

Parameters:
  • image_width – Width (in pixels) of the image or region with respect to which the shape coordinates should be normalized.

  • image_height – Height (in pixels) of the image or region with respect to which the shape coordinates should be normalized

Returns:

Dictionary representing the Shape object with it’s coordinates normalized with respect to image_width and image_height

abstract property area: float

Return the area of the shape, given in number of pixels.

Returns:

Area of the shape, in pixels

class geti_sdk.data_models.shapes.Rectangle(x: float, y: float, width: float, height: float, *, type: str | ShapeType = ShapeType.RECTANGLE)

Representation of a Rectangle on the Intel® Geti™ platform, as used in the /annotations REST endpoints.

NOTE: All coordinates and dimensions are given in pixels

Variables:
  • x – X coordinate of the left side of the rectangle

  • y – Y coordinate of the top of the rectangle

  • width – Width of the rectangle

  • height – Height of the rectangle

x: int
y: int
width: int
height: int
type: str
to_normalized_coordinates(image_width: int, image_height: int) Dict[str, float]

Get the normalized coordinates of the rectangle, with respect to the image with dimensions image_width x image_height.

Parameters:
  • image_width – Width of the image to which the coordinates should be normalized

  • image_height – Height of the image to which the coordinates should be normalized

Returns:

Dictionary containing the rectangle, represented in normalized coordinates

is_full_box(image_width: int, image_height: int) bool

Return True if this Rectangle represents a box containing the full image.

Parameters:
  • image_width – Width of the image to check for

  • image_height – Height of the image to check for

Returns:

True if the Rectangle encompasses the full image, False otherwise

to_roi() Rectangle

Return the bounding box containing the shape, as an instance of the Rectangle class.

Returns:

Rectangle representing the bounding box for the shape

to_absolute_coordinates(parent_roi: Rectangle) Rectangle

Convert the Rectangle to absolute coordinates, given the rectangle representing it’s parent region of interest.

Parameters:

parent_roi – Region of interest containing the rectangle

Returns:

Rectangle converted to the coordinate system of it’s parent

property area: float

Return the area of the Rectangle, in pixels.

Returns:

property x_max: int

Return the value of the maximal x-coordinate that the Rectangle instance touches.

Returns:

Maximum x-coordinate for the rectangle

property y_max: int

Return the value of the maximal y-coordinate that the Rectangle instance touches.

Returns:

Maximum y-coordinate for the rectangle

classmethod generate_full_box(image_width: int, image_height: int) Rectangle

Return a rectangle that fully encapsulates the image.

Parameters:
  • image_width – Width of the image to which the rectangle applies (in pixels)

  • image_height – Height of the image to which the rectangle applies (in pixels)

Returns:

Rectangle: A rectangle that fully encapsulates the image.

class geti_sdk.data_models.shapes.Ellipse(x: float, y: float, width: float, height: float, *, type: str | ShapeType = ShapeType.ELLIPSE)

Representation of an Ellipse on the Intel® Geti™ platform, as used in the /annotations REST endpoints.

NOTE: All coordinates and dimensions are given in pixels

Variables:
  • x – Lowest x coordinate of the ellipse

  • y – Lowest y coordinate of the ellipse

  • width – Width of the ellipse

  • height – Height of the ellipse

x: int
y: int
width: int
height: int
type: str
to_roi() Rectangle

Return the bounding box containing the Ellipse, as an instance of the Rectangle class.

Returns:

Rectangle representing the bounding box for the ellipse

to_absolute_coordinates(parent_roi: Rectangle) Ellipse

Convert the Ellipse to absolute coordinates, given the rectangle representing it’s parent region of interest.

Parameters:

parent_roi – Region of interest containing the ellipse

Returns:

Ellipse converted to the coordinate system of it’s parent

to_normalized_coordinates(image_width: int, image_height: int) Dict[str, float]

Get the normalized coordinates of the ellipse, with respect to the image with dimensions image_width x image_height.

Parameters:
  • image_width – Width of the image to which the coordinates should be normalized

  • image_height – Height of the image to which the coordinates should be normalized

Returns:

Dictionary containing the ellipse, represented in normalized coordinates

get_center_point() Tuple[int, int]

Return the coordinates of the center of the ellipse.

Returns:

Tuple of integers representing the coordinates of the center of the ellipse

property area: float

Return the area of the Ellipse, in pixels.

Returns:

property x_max: int

Return the value of the maximal x-coordinate that the Ellipse instance touches.

Returns:

Maximum x-coordinate for the ellipse

property y_max: int

Return the value of the maximal y-coordinate that the Ellipse instance touches.

Returns:

Maximum y-coordinate for the ellipse

class geti_sdk.data_models.shapes.Point(x: float, y: float)

Representation of a point on a 2D coordinate system. Used to define Polygons on the Intel® Geti™ platform.

NOTE: All coordinates are defined in pixels

Variables:
  • x – X coordinate of the point

  • y – Y coordinate of the point

x: int
y: int
as_int_tuple() Tuple[int, int]

Return the coordinates of the point as a tuple of integers.

Returns:

Tuple of integers representing the coordinates of the point

class geti_sdk.data_models.shapes.Polygon(points: List[Point], *, type: str | ShapeType = ShapeType.POLYGON)

Representation of a polygon on the Intel® Geti™ platform, as used in the /annotations REST endpoints.

Variables:

points – List of Points that make up the polygon

points: List[Point]
type: str
points_as_contour() ndarray

Return the list of points for this Polygon as a numpy array representing contour points that can be plotted by openCV’s drawContours function.

NOTE: the contour is cached, to avoid going over the list of points twice. If the polygon is modified the cache has to be cleared. It is recommended to create a new polygon instead

Returns:

Numpy array containing the contour

to_roi() Rectangle

Return the bounding box containing the Polygon, as an instance of the Rectangle class.

Returns:

Rectangle representing the bounding box for the polygon

to_absolute_coordinates(parent_roi: Rectangle) Polygon

Convert the Polygon to absolute coordinates, given the rectangle representing it’s parent region of interest.

Parameters:

parent_roi – Region of interest containing the polygon

Returns:

Polygon converted to the coordinate system of it’s parent ROI

to_normalized_coordinates(image_width: int, image_height: int) Dict[str, List[Dict[str, float]] | str]

Get the normalized coordinates of the polygon, with respect to the image with dimensions image_width x image_height.

Parameters:
  • image_width – Width of the image to which the coordinates should be normalized

  • image_height – Height of the image to which the coordinates should be normalized

Returns:

Dictionary containing the polygon, represented in normalized coordinates

property area: float

Return the area of the Polygon, in pixels.

Returns:

area of the polygon

property x_max: int

Return the maximum x-coordinate of the Polygon, in pixels

Returns:

largest x-coordinate that the polygon touches

property y_max: int

Return the maximum y-coordinate of the Polygon, in pixels

Returns:

largest y-coordinate that the polygon touches

fit_rotated_rectangle() RotatedRectangle

Fit a RotatedRectangle object around the Polygon, such that the area spanned by the rectangle is minimal.

Returns:

RotatedRectangle object with minimal area, which encloses the Polygon

class geti_sdk.data_models.shapes.RotatedRectangle(angle: float, x: float, y: float, width: float, height: float, *, type: str | ShapeType = ShapeType.ROTATED_RECTANGLE)

Representation of a RotatedRectangle on the Intel® Geti™ platform, as used in the /annotations REST endpoints.

NOTE: All coordinates and dimensions are specified in pixels

Variables:
  • angle – angle, in degrees, under which the rectangle is defined.

  • x – X coordinate of the center of the rectangle

  • y – Y coordinate of the center of the rectangle

  • width – Width of the rectangle

  • height – Height of the rectangle

angle: float
x: int
y: int
width: int
height: int
type: str
property x_max: float

Return the value of the maximal x-coordinate that the rotated rectangle touches.

Returns:

Maximum x-coordinate for the rotated rectangle

property x_min: float

Return the value of the minimal x-coordinate that the rotated rectangle touches.

Returns:

Minimum x-coordinate for the rotated rectangle

property y_max: float

Return the value of the maximal y-coordinate that the rotated rectangle touches.

Returns:

Maximum y-coordinate for the rotated rectangle

property y_min

Return the value of the minimal y-coordinate that the rotated rectangle touches.

Returns:

Minimum y-coordinate for the rotated rectangle

classmethod from_polygon(polygon: Polygon) RotatedRectangle

Create a :py:class`~geti_sdk.data_models.shapes.RotatedRectangle` from the Polygon entity passed.

NOTE: The Polygon MUST consist of 4 points, otherwise a ValueError is raised

Parameters:

polygon – Polygon entity to convert from

Returns:

Rectangle instance created according to the polygon object

to_roi() Rectangle

Return the bounding box containing the RotatedRectangle, as an instance of the Rectangle class.

Returns:

Rectangle representing the bounding box for the rotated_rectangle

to_absolute_coordinates(parent_roi: Rectangle) RotatedRectangle

Convert the RotatedRectangle to absolute coordinates, given the rectangle representing it’s parent region of interest.

Parameters:

parent_roi – Region of interest containing the rotated rectangle

Returns:

RotatedRectangle converted to the coordinate system of it’s parent ROI

to_polygon() Polygon

Convert the RotatedRectangle instance to a Polygon consisting of 4 points.

Returns:

Polygon object corresponding to the RotatedRectangle instance

to_normalized_coordinates(image_width: int, image_height: int) Dict[str, float | str]

Get the normalized coordinates of the rotated rectangle, with respect to the image with dimensions image_width x image_height.

Parameters:
  • image_width – Width of the image to which the coordinates should be normalized

  • image_height – Height of the image to which the coordinates should be normalized

Returns:

Dictionary containing the rotated rectangle, represented in normalized coordinates

property area: float

Return the area of the RotatedRectangle, in pixels

Returns:

area enclosed by the rotated rectangle in pixels

class geti_sdk.data_models.annotations.Annotation(labels: List[ScoredLabel], shape: Rectangle | Ellipse | Polygon | RotatedRectangle, modified: str | datetime | None = None, id: str | None = None, labels_to_revisit: List[str] | None = None)

Representation of a single annotation for a media item on the Intel® Geti™ platform.

Variables:
  • labels – List of labels belonging to the annotation

  • modified – Date and time of the last modification made to this annotation

  • shape – Shape of the annotation

  • id – Unique database ID assigned to the annotation

  • labels_to_revisit – Optional list of database ID’s of the labels that may not be up to date and therefore need to be revisited for this annotation

labels: List[ScoredLabel]
shape: Rectangle | Ellipse | Polygon | RotatedRectangle
modified: str | None
id: str | None
labels_to_revisit: List[str] | None
deidentify() None

Remove all unique database ID’s from the annotation and the entities it contains

property label_names: List[str]

Return a list of label names for this Annotation.

append_label(label: ScoredLabel) None

Add a label to the list of labels belonging to this annotation.

Parameters:

label

Returns:

extend_labels(labels: List[ScoredLabel]) None

Add a list of labels to the labels already attached to this annotation.

Parameters:

labels – List of ScoredLabels to add

Returns:

pop_label_by_name(label_name: str) None

Remove a label from the list of labels belonging to this annotation.

Parameters:

label_name – Name of the label to remove from the list

Returns:

map_labels(labels: Sequence[ScoredLabel | Label]) Annotation

Attempt to map the labels found in labels to those in the Annotation instance. Labels are matched by name. This method will return a new Annotation object.

Parameters:

labels – Labels to which the existing labels should be mapped

Returns:

Annotation with updated labels, corresponding to those found in the project (if matching labels were found)

class geti_sdk.data_models.annotation_scene.AnnotationScene(annotations: List[Annotation], kind: str | AnnotationKind = AnnotationKind.ANNOTATION, media_identifier: ImageIdentifier | VideoFrameIdentifier | None = None, id: str | None = None, modified: str | datetime | None = None, labels_to_revisit_full_scene: List[str] | None = None, annotation_state_per_task: List[TaskAnnotationState] | None = None)

Representation of an annotation scen for a certain media entity in GETi. An annotation scene holds all annotations for that specific media entity.

Variables:
  • annotations – List of :py:class:`~geti_sdk.data_models.annotations.Annotation`s belonging to the media entity

  • id – unique database ID of the AnnotationScene in GETi

  • kindAnnotationKind of the annotation (Annotation or Prediction)

  • media_identifier – Identifier of the media entity to which this AnnotationScene applies

  • modified – Date and time at which this AnnotationScene was last modified

  • labels_to_revisit_full_scene – Optional list of database ID’s of the labels that may not be up to date and therefore need to be revisited for this AnnotationScene.

  • annotation_state_per_task – Optional dictionary holding the annotation state for this AnnotationScene for each task in the project pipeline.

annotations: List[Annotation]
kind: str
media_identifier: ImageIdentifier | VideoFrameIdentifier | None
id: str | None
modified: str | None
labels_to_revisit_full_scene: List[str] | None
annotation_state_per_task: List[TaskAnnotationState] | None
property has_data: bool

Return True if this AnnotationScene has annotation associated with it.

deidentify() None

Remove all unique database ID’s from the annotationscene and the entities it contains.

prepare_for_post() None

Remove all fields that are not valid for making a POST request to the /annotations endpoint.

Returns:

append(annotation: Annotation) None

Add an annotation to the annotation scene.

Parameters:

annotation – Annotation to add

get_by_shape(shape: Shape) Annotation | None

Return the annotation belonging to a specific shape. Returns None if no Annotation is found for the shape.

Parameters:

shape – Shape to return the annotation for

Returns:

extend(annotations: List[Annotation])

Extend the list of annotations in the AnnotationScene with additional entries in the annotations list.

Parameters:

annotations – List of Annotations to add to the AnnotationScene

Returns:

to_dict() Dict[str, Any]

Convert the AnnotationScene to a dictionary representation.

Returns:

Dictionary holding the annotation scene data

property overview: str

Return a string that gives an overview of the annotation scene.

Returns:

overview string of the annotation scene

as_mask(media_information: MediaInformation) ndarray

Convert the shapes in the annotation scene to a mask that can be overlayed on an image.

Parameters:

media_information – MediaInformation object containing the width and height of the image for which the mask should be generated.

Returns:

np.ndarray holding the mask representation of the annotation scene

get_labels() List[Label]

Return a list of all labels present in the annotation scene.

Returns:

List of labels

get_label_names() List[str]

Return a list with the unique label names in the annotation scene.

Returns:

List of label names

apply_identifier(media_identifier: ImageIdentifier | VideoFrameIdentifier) AnnotationScene

Apply a media_identifier to the current AnnotationScene instance, such that the GETi cluster will recognize this AnnotationScene as belonging to the media item identified by the media_identifier.

This method creates and returns a new AnnotationScene instance. The instance on which this method is called remains unmodified.

Parameters:

media_identifier – Image or VideoFrame identifier to apply

Returns:

new AnnotationScene instance with the identifiers set according to media_identifier

map_labels(labels: Sequence[ScoredLabel | Label]) AnnotationScene

Attempt to map the labels found in labels to those in the AnnotationScene instance. Labels are matched by name. This method will return a new AnnotationScene object.

Parameters:

labels – Labels to which the existing labels should be mapped

Returns:

AnnotationScene with updated labels, corresponding to those found in the project (if matching labels were found)

filter_annotations(labels: Sequence[Label | ScoredLabel | str]) AnnotationScene

Filter annotations in the scene to only include labels that are present in the provided list of labels.

Parameters:

labels – List of labels or label names to filter the scene with

Returns:

AnnotationScene with filtered annotations

resolve_label_names_and_colors(labels: List[Label]) None

Add label names and colors to all annotations, based on a list of available labels.

Parameters:

labels – List of labels for the project, serving as a reference point for label names and colors

Configuration-related entities

class geti_sdk.data_models.configurable_parameter.ConfigurableParameter(name: str, value: str | bool | float | int, data_type: str | EnumType | None = None, default_value: str | bool | float | int | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None)

Representation of a generic configurable parameter in GETi.

Variables:
  • data_type – Data type for the parameter. Can be integer, float, string or boolean

  • default_value – Default value for the parameter

  • description – Human readable description of the parameter

  • editable – Boolean indicating whether this parameter is editable (True) or not (False)

  • header – Human readable name for the parameter

  • name – system name for the parameter

  • template_type – Indicates whether the parameter takes free input (input) or the value has to be selected from a list of options (selectable)

  • value – The current value for the parameter

  • ui_rules – Dictionary representing rules for logic processing in the UI, based on parameter values

  • warning – Optional warning message pointing out possible risks of changing the parameter

name: str
value: str | bool | float | int
data_type: str | None
default_value: str | bool | float | int | None
description: str | None
editable: bool | None
header: str | None
template_type: str | None
ui_rules: Dict[str, Any] | None
warning: str | None
auto_hpo_state: str | None
auto_hpo_value: str | bool | float | int | None
to_dict() Dict[str, Any]

Return the dictionary representation of the ConfigurableParameter object.

property summary: str

Return a string containing a very brief summary of the ConfigurableParameter object.

Returns:

string holding a very short summary of the ConfigurableParameter

property overview: str

Return a string that shows an overview of the configurable parameter. This still shows all the metadata of the parameter. If less details are required, please use the summary property

Returns:

String holding an overview of the configurable parameter

class geti_sdk.data_models.configurable_parameter.ConfigurableBoolean(name: str, data_type: str | EnumType | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None, *, default_value: bool | None = None, value: bool)

Representation of a configurable boolean in GETi.

default_value: bool | None
value: bool
class geti_sdk.data_models.configurable_parameter.ConfigurableInteger(name: str, data_type: str | EnumType | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None, *, default_value: int | None = None, value: int, min_value: int | None = None, max_value: int | None = None)

Representation of a configurable integer in GETi.

Variables:
  • min_value – Minimum value allowed to be set for the configurable integer

  • max_value – Maximum value allowed to be set for the configurable integer

default_value: int | None
value: int
min_value: int | None
max_value: int | None
class geti_sdk.data_models.configurable_parameter.ConfigurableFloat(name: str, data_type: str | EnumType | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None, *, default_value: float | None = None, value: float, min_value: float, max_value: float, step_size: float | None = None)

Representation of a configurable float in GETi.

Variables:
  • min_value – Minimum value allowed to be set for the configurable float

  • max_value – Maximum value allowed to be set for the configurable float

default_value: float | None
value: float
min_value: float
max_value: float
step_size: float | None
class geti_sdk.data_models.configurable_parameter.SelectableFloat(name: str, data_type: str | EnumType | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None, *, default_value: float | None = None, value: float, options: List[float])

Representation of a float selectable configurable parameter in GETi.

Variables:

options – List of options that the selectable float is allowed to take

default_value: float | None
value: float
options: List[float]
class geti_sdk.data_models.configurable_parameter.SelectableString(name: str, data_type: str | EnumType | None = None, description: str | None = None, editable: bool | None = None, header: str | None = None, template_type: str | EnumType | None = None, ui_rules: Dict[str, Any] | None = None, warning: str | None = None, auto_hpo_state: str | None = None, auto_hpo_value: str | bool | float | int | None = None, *, default_value: str | None = None, enum_name: str, value: str, options: List[str])

Representation of a string selectable configurable parameter in GETi.

Variables:

options – List of options that the selectable string is allowed to take

default_value: str | None
enum_name: str
value: str
options: List[str]
class geti_sdk.data_models.configurable_parameter_group.ParameterGroup(header: str, type: str | EnumType, description: str | None = None, parameters: Sequence[SelectableFloat | SelectableString | ConfigurableFloat | ConfigurableInteger | ConfigurableBoolean] | None = None, name: str | None = None, groups: List[ParameterGroup] | None = None)

Representation of a group of configurable parameters in GETi, as returned by the /configuration endpoints.

Variables:
  • header – Human readable name for the parameter group

  • type – Type of the parameter group

  • name – name by which the parameter group is identified in the system

  • parameters – List of configurable parameters

  • groups – List of parameter groups

header: str
type: str
description: str | None
parameters: Sequence[SelectableFloat | SelectableString | ConfigurableFloat | ConfigurableInteger | ConfigurableBoolean] | None
name: str | None
groups: List[ParameterGroup] | None
to_dict() Dict[str, Any]

Return the dictionary representation of the ParameterGroup

classmethod from_dict(input_dict: Dict[str, Any]) ParameterGroup

Create a ParameterGroup object from an input dictionary.

Parameters:

input_dict – Dictionary to create the parameter group from

Returns:

ParameterGroup instance corresponding to the data received in input_dict

deidentify() None

Remove all identifier fields from the ParameterGroup

parameter_names(get_nested: bool = True) List[str]

Return a list of names of all parameters in the ParameterGroup.

Parameters:

get_nested – True to include parameter names in nested ParameterGroups belonging to this group as well. False to only consider this groups’ parameters

Returns:

List of parameter names

get_parameter_group_by_name(name: str) ParameterGroup | None

Return the parameter group named name, if it belongs to this ParameterGroup or any of it’s nested groups.

If no group by name is found, this method returns None

Parameters:

name – Name of the parameter group to look for

Returns:

ParameterGroup named name, if any group by that name is found. None otherwise

get_parameter_by_name(name: str, group_name: str | None = None) SelectableFloat | SelectableString | ConfigurableFloat | ConfigurableInteger | ConfigurableBoolean | None

Get the data for the configurable parameter named name from the ParameterGroup. This method returns None if no parameter by that name was found

Parameters:
  • name – Name of the parameter to get

  • group_name – Optional name of the parameter group to which the parameter belongs. If None is specified (the default), this method looks in all parameter groups belonging to this group.

Returns:

ConfigurableParameter object representing the parameter named name

get_group_containing(parameter_name: str) ParameterGroup | None

Return the parameter group that contains the parameter specified in parameter_name. If no group containing the parameter is found, this method returns None

Parameters:

parameter_name – Name of the parameter for which to retrieve the group

Returns:

ParameterGroup containing the parameter by name parameter_name

property summary: str

Return a string containing a very brief summary of the ParameterGroup.

Returns:

string holding a very short summary of the ParameterGroup

class geti_sdk.data_models.configuration_identifiers.EntityIdentifier(type: str | EnumType, workspace_id: str | None = None)

Identifying information for a configurable entity on the Intel® Geti™ platform, as returned by the /configuration endpoint.

Variables:
  • workspace_id – ID of the workspace to which the entity belongs

  • type – Type of the configuration

type: str
workspace_id: str | None
to_dict() Dict[str, Any]

Return the dictionary representation of the EntityIdentifier.

Returns:

Dictionary representing the EntityIdentifier

class geti_sdk.data_models.configuration_identifiers.HyperParameterGroupIdentifier(type: str | EnumType, workspace_id: str | None = None, model_storage_id: str | None = None, project_id: str | None = None, algorithm_name: str | None = None, model_template_id: str | None = None, *, group_name: str)

Identifying information for a HyperParameterGroup on the Intel® Geti™ platform, as returned by the /configuration endpoint.

Variables:
  • model_storage_id – ID of the model storage to which the hyper parameter group belongs

  • group_name – Name of the hyper parameter group

group_name: str
model_storage_id: str | None
project_id: str | None
algorithm_name: str | None
model_template_id: str | None
resolve_algorithm(algorithm: Algorithm)

Resolve the algorithm name and id of the model template to which the HyperParameterGroup applies.

Parameters:

algorithm – Algorithm instance to which the hyper parameters belong

Returns:

class geti_sdk.data_models.configuration_identifiers.ComponentEntityIdentifier(type: str | EnumType, workspace_id: str | None = None, project_id: str | None = None, task_id: str | None = None, *, component: str)

Identifying information for a configurable Component on the Intel® Geti™ platform, as returned by the /configuration endpoint.

Variables:
  • component – Name of the component

  • project_id – ID of the project to which the component belongs

  • task_id – Optional ID of the task to which the component belongs

component: str
project_id: str | None
task_id: str | None
class geti_sdk.data_models.configuration.ConfigurableParameters(header: str, type: str | EnumType, description: str | None = None, parameters: Sequence[SelectableFloat | SelectableString | ConfigurableFloat | ConfigurableInteger | ConfigurableBoolean] | None = None, name: str | None = None, groups: List[ParameterGroup] | None = None, *, entity_identifier: HyperParameterGroupIdentifier | ComponentEntityIdentifier, id: str | None = None)

Representation of configurable parameters in GETi, as returned by the /configuration endpoint

Variables:
  • entity_identifier – Identification information for the entity to which the configurable parameters apply

  • id – Unique database ID of the configurable parameters

entity_identifier: HyperParameterGroupIdentifier | ComponentEntityIdentifier
id: str | None
deidentify() None

Remove all unique database ID’s from the configurable parameters

class geti_sdk.data_models.configuration.Configuration(components: List[ConfigurableParameters])

Representation of a set of configurable parameters in GETi, that apply to a project or task.

components: List[ConfigurableParameters]
to_dict() Dict[str, Any]

Return the dictionary representation of the Configuration.

deidentify() None

Remove all unique database ID’s from the Configuration

get_all_parameter_names() List[str]

Return a list of names of all configurable parameters within the task configuration.

get_parameter_by_name(name: str) SelectableFloat | SelectableString | ConfigurableFloat | ConfigurableInteger | ConfigurableBoolean | None

Return the configurable parameter named name. If no parameter by that name is found within the Configuration, this method returns None

Parameters:

name – Name of the parameter to get

Returns:

ConfigurableParameter object

property component_configurations: List[ConfigurableParameters]

Return all configurable parameters that are component-related.

Returns:

get_component_configuration(component: str) ConfigurableParameters | None

Return the configurable parameters for a certain component. If no configuration is found for the specified component, this method returns None

Parameters:

component – Name of the component to get the configuration for

Returns:

ConfigurableParameters for the component

class geti_sdk.data_models.configuration.GlobalConfiguration(components: List[ConfigurableParameters])

Representation of the project-wide configurable parameters for a project in GETi.

set_parameter_value(parameter_name: str, value: bool | float | int | str, group_name: str | None = None) List[Dict[str, Any]]

Prepare a dictionary that can be used for setting a parameter value in GETi.

Parameters:
  • parameter_name – Name of the parameter to set

  • value – Value to set for the parameter

  • group_name – Optional name of the parameter group in which the parameter lives. If left as None (the default), this method will attempt to find the group automatically

Returns:

Dictionary that can be passed directly to the /configuration POST endpoints to set the parameter value

apply_identifiers(workspace_id: str, project_id: str)

Apply the unique database identifiers passed in workspace_id and project_id to all configurable parameters in the GlobalConfiguration.

Parameters:
  • workspace_id – Workspace ID to assign

  • project_id – Project ID to assign

Returns:

property summary: str

Return a string containing a very brief summary of the GlobalConfiguration.

Returns:

string holding a very short summary of the GlobalConfiguration

class geti_sdk.data_models.configuration.TaskConfiguration(components: List[ConfigurableParameters], *, task_id: str | None = None, task_title: str)

Representation of the configurable parameters for a task in GETi.

task_id: str | None
task_title: str
property model_configurations: List[ConfigurableParameters]

Return all configurable parameters that are model-related.

Returns:

List of configurable parameters

set_parameter_value(parameter_name: str, value: bool | float | int | str, group_name: str | None = None) Dict[str, Any]

Prepare a dictionary that can be used for setting a configurable parameter value in GETi.

Parameters:
  • parameter_name – Name of the parameter to set

  • value – Value to set for the parameter

  • group_name – Optional name of the parameter group in which the parameter lives. If left as None (the default), this method will attempt to find the group automatically

Returns:

Dictionary that can be passed directly to the /configuration POST endpoints to set the parameter value

resolve_algorithm(algorithm: Algorithm)

Resolve the algorithm name and id of the model template for all hyper parameter groups in the task configuration.

Parameters:

algorithm – Algorithm instance to which the hyper parameters belong

Returns:

apply_identifiers(workspace_id: str, project_id: str, task_id: str, model_storage_id: str)

Apply the unique database identifiers passed in workspace_id, project_id, task_id and model_storage_id to all configurable parameters in the TaskConfiguration.

Parameters:
  • workspace_id – Workspace ID to assign

  • project_id – Project ID to assign

  • task_id – Task ID to assign

  • model_storage_id – Model storage ID to assign

Returns:

property summary: str

Return a string containing a very brief summary of the TaskConfiguration.

Returns:

string holding a very short summary of the TaskConfiguration

class geti_sdk.data_models.configuration.FullConfiguration(global_: GlobalConfiguration, task_chain: List[TaskConfiguration])

Representation of the full configuration (both global and task-chain) for a project in GETi.

global_: GlobalConfiguration
task_chain: List[TaskConfiguration]
deidentify() None

Remove all unique database ID’s from the Configuration.

to_dict() Dict[str, Any]

Return the dictionary representation of the FullConfiguration.

property summary: str

Return a string containing a very brief summary of the FullConfiguration.

Returns:

string holding a very short summary of the FullConfiguration

Model-related entities

class geti_sdk.data_models.model.OptimizationCapabilities(is_nncf_supported: bool, is_filter_pruning_supported: bool | None = None, is_filter_pruning_enabled: bool | None = None)

Representation of the various model optimization capabilities in Intel Geti.

is_nncf_supported: bool
is_filter_pruning_supported: bool | None
is_filter_pruning_enabled: bool | None
class geti_sdk.data_models.model.ModelPurgeInfo(is_purged: bool, purge_time: str | None = None, user_uid: str | None = None)

Representation of the model soft deletion status. If is_purged==True, the model binaries (i.e. the trained weights) have been deleted from the server storage.

is_purged: bool
purge_time: str | None
user_uid: str | None
class geti_sdk.data_models.model.TrainingFramework(type: str, version: str)

Representation of the training framework used to train the model.

type: str
version: str
class geti_sdk.data_models.model.OptimizationConfigurationParameter(name: str, value: Any)

Representation of a parameter for model optimization in Intel Geti.

name: str
value: Any
class geti_sdk.data_models.model.BaseModel(name: str, fps_throughput: str, latency: str, precision: List[str], creation_date: str | datetime | None, purge_info: ModelPurgeInfo | None = None, size: int | None = None, target_device: str | None = None, target_device_type: str | None = None, previous_revision_id: str | None = None, previous_trained_revision_id: str | None = None, performance: Performance | None = None, id: str | None = None, label_schema_in_sync: bool | None = None, total_disk_size: int | None = None, training_framework: TrainingFramework | None = None, learning_approach: str | None = None)

Representation of the basic information for a Model or OptimizedModel in Intel Geti

name: str
fps_throughput: str
latency: str
precision: List[str]
creation_date: str
purge_info: ModelPurgeInfo | None
size: int | None
target_device: str | None
target_device_type: str | None
previous_revision_id: str | None
previous_trained_revision_id: str | None
performance: Performance | None
id: str | None
label_schema_in_sync: bool | None
total_disk_size: int | None
training_framework: TrainingFramework | None
learning_approach: str | None
property model_group_id: str | None

Return the unique database ID of the model group to which the model belongs, if available.

Returns:

ID of the model group for the model

property base_url: str | None

Return the base url that can be used to get the model details, download the model, etc., if available.

Returns:

base url at which the model can be addressed. The url is defined relative to the ip address or hostname of the Intel® Geti™ server

to_dict() Dict[str, Any]

Return the dictionary representation of the model.

Returns:

property overview: str

Return a string that represents an overview of the model.

Returns:

deidentify() None

Remove unique database IDs from the BaseModel.

class geti_sdk.data_models.model.OptimizedModel(name: str, fps_throughput: str, latency: str, precision: List[str], creation_date: str | datetime | None, purge_info: ModelPurgeInfo | None = None, size: int | None = None, target_device: str | None = None, target_device_type: str | None = None, previous_revision_id: str | None = None, previous_trained_revision_id: str | None = None, performance: Performance | None = None, id: str | None = None, label_schema_in_sync: bool | None = None, total_disk_size: int | None = None, training_framework: TrainingFramework | None = None, learning_approach: str | None = None, model_format: str | None = None, has_xai_head: bool = False, *, model_status: str | EnumType, optimization_methods: List[str], optimization_objectives: Dict[str, Any], optimization_type: str | EnumType, version: int | None = None, configurations: List[OptimizationConfigurationParameter] | None = None)

Representation of an OptimizedModel in Intel® Geti™. An optimized model is a trained model that has been converted OpenVINO representation. This conversion may involve weight quantization, filter pruning, or other optimization techniques supported by OpenVINO.

model_status: str
optimization_methods: List[str]
optimization_objectives: Dict[str, Any]
optimization_type: str
version: int | None
configurations: List[OptimizationConfigurationParameter] | None
model_format: str | None
has_xai_head: bool
class geti_sdk.data_models.model.Model(name: str, fps_throughput: str, latency: str, precision: List[str], creation_date: str | datetime | None, purge_info: ModelPurgeInfo | None = None, size: int | None = None, target_device: str | None = None, target_device_type: str | None = None, previous_revision_id: str | None = None, previous_trained_revision_id: str | None = None, performance: Performance | None = None, id: str | None = None, label_schema_in_sync: bool | None = None, total_disk_size: int | None = None, training_framework: TrainingFramework | None = None, learning_approach: str | None = None, labels: List[Label] | None = None, training_dataset_info: Dict[str, str] | None = None, *, architecture: str, score_up_to_date: bool, optimized_models: List[OptimizedModel], optimization_capabilities: OptimizationCapabilities | None = None, version: int | None = None)

Representation of a trained Model in Intel® Geti™.

architecture: str
score_up_to_date: bool
optimized_models: List[OptimizedModel]
optimization_capabilities: OptimizationCapabilities | None
labels: List[Label] | None
version: int | None
training_dataset_info: Dict[str, str] | None
property model_group_id: str | None

Return the unique database ID of the model group to which the model belongs, if available.

Returns:

ID of the model group for the model

classmethod from_dict(model_dict: Dict[str, Any]) Model

Create a Model instance from a dictionary holding the model data.

Parameters:

model_dict – Dictionary representing a model

Returns:

Model instance reflecting the data contained in model_dict

classmethod from_file(filepath: str) Model

Create a Model instance from a .json file holding the model data.

Parameters:

filepath – Path to a json file holding the model data

Returns:

get_optimized_model(optimization_type: str | None = None, precision: str | None = None, require_xai: bool = False) OptimizedModel | None

Return the OptimizedModel of the specified optimization_type or precision. The following optimization types are supported: ‘nncf’, ‘pot’, ‘onnx’, ‘mo’, openvino (case insensitive). The supported precision levels are FP32, FP16, INT8. Precision, optimization type or both can be specified.

Parameters:
  • optimization_type – Optimization type for which to return the model

  • precision – Precision level for which to return the model. Can be FP32, FP16 or INT8

  • require_xai – If True, only include models that have an XAI head for saliency map generation. Defaults to False

Returns:

OptimizedModel object representing the optimized model

class geti_sdk.data_models.model_group.ModelSummary(name: str, creation_date: str | datetime | None, score_up_to_date: bool, purge_info: ModelPurgeInfo | None = None, size: int | None = None, version: int | None = None, score: float | None = None, performance: Performance | None = None, active_model: bool = False, id: str | None = None, model_storage_id: str | None = None, label_schema_in_sync: bool | None = None)

Representation of a Model on the Intel® Geti™ platform, containing only the minimal information about the model.

Variables:
  • name – Name of the model

  • creation_date – Creation date of the model

  • version – Model version

  • score – Score that was achieved upon evaluation of the model on the test set

  • active_model – True if this model was the active model for the project it was created in, False if it was not the active model

  • id – Unique database ID of the model

  • model_storage_id – Unique database ID of the model storage (also referred to as model group) that this model belongs to

  • label_schema_in_sync – Boolean indicating whether the labels of the model are matching with the latest project labels

name: str
creation_date: str
score_up_to_date: bool
purge_info: ModelPurgeInfo | None
size: int | None
version: int | None
score: float | None
performance: Performance | None
active_model: bool
id: str | None
model_storage_id: str | None
label_schema_in_sync: bool | None
class geti_sdk.data_models.model_group.ModelGroup(name: str, model_template_id: str, models: List[ModelSummary], task_id: str | None = None, id: str | None = None, learning_approach: str | None = None)

Representation of a ModelGroup on the Intel® Geti™ server. A model group is a collection of models that all share the same neural network architecture, but may have been trained with different training datasets or hyper parameters.

name: str
model_template_id: str
models: List[ModelSummary]
task_id: str | None
id: str | None
learning_approach: str | None
property has_trained_models: bool

Return True if the ModelGroup contains at least one trained model.

Returns:

True if the model group holds at least one trained model, False otherwise

get_latest_model() ModelSummary | None

Return the latest model in the model group.

Returns:

summary information of the most recently model in the model group

get_model_by_version(version: int) ModelSummary

Return the model with version version in the model group. If no model with the version is found, this method raises a ValueError.

Parameters:

version – Number specifying the desired model version

Returns:

ModelSummary instance with the specified version, if any

get_model_by_creation_date(creation_date: datetime) ModelSummary

Return the model created on creation_date in the model group. If no model by that date is found, this method raises a ValueError

Parameters:

creation_date – Datetime object representing the desired creation_date

Returns:

ModelSummary instance with the specified creation_date, if any

property algorithm: Algorithm | None

Return the details for the algorithm corresponding to the ModelGroup This property will return None unless the get_algorithm_details method is called to retrieve the algorithm information from the Intel® Geti™ server

Returns:

Algorithm details, if available

contains_model(model: ModelSummary | Model) bool

Return True if the model group contains the model.

Parameters:

model – Model or ModelSummary object

Returns:

True if the group contains the model, False otherwise

Media-related entities

class geti_sdk.data_models.media.MediaInformation(display_url: str, height: int, width: int, extension: str | None = None, size: int | None = None)

Basic information about a media item in Intel® Geti™.

Variables:
  • display_url – URL that can be used to download the full size media entity

  • height – Height of the media entity, in pixels

  • width – Width of the media entity, in pixels

  • size – Size of the media entity, in bytes

display_url: str
height: int
width: int
extension: str | None
size: int | None
class geti_sdk.data_models.media.VideoInformation(display_url: str, height: int, width: int, extension: str | None = None, size: int | None = None, *, duration: int, frame_count: int, frame_stride: int, frame_rate: float | None = None)

Basic information about a video entity in Intel® Geti™.

Variables:
  • duration – Duration of the video

  • frame_count – Total number of frames in the video

  • frame_stride – Frame stride of the video

  • frame_rate – Frame rate of the video

duration: int
frame_count: int
frame_stride: int
frame_rate: float | None
class geti_sdk.data_models.media.ImageInformation(display_url: str, height: int, width: int, extension: str | None = None, size: int | None = None)

Basic information about an image entity in Intel® Geti™

class geti_sdk.data_models.media.VideoFrameInformation(display_url: str, height: int, width: int, extension: str | None = None, size: int | None = None, *, frame_index: int, video_id: str)

Basic information about a video frame in Intel® Geti™.

frame_index: int
video_id: str
class geti_sdk.data_models.media.MediaItem(id: str, name: str, type: str | MediaType, upload_time: str | datetime | None, media_information: MediaInformation, annotation_state_per_task: List[TaskAnnotationState] | None = None, thumbnail: str | None = None, uploader_id: str | None = None, last_annotator_id: str | None = None)

Representation of a media entity in Intel® Geti™.

Variables:
  • id – Unique database ID of the media entity

  • name – Filename of the media entity

  • type – MediaType of the entity

  • upload_time – Time and date at which the entity was uploaded to the system

  • thumbnail – URL that can be used to get a thumbnail for the media entity

  • annotation_state_per_task – Annotation state of the media entity

  • media_information – Container holding basic information such as width and height about the media entity

Parameters:

last_annotator_id – the name or id of the editor.

id: str
name: str
type: str
upload_time: str
media_information: MediaInformation
annotation_state_per_task: List[TaskAnnotationState] | None
thumbnail: str | None
uploader_id: str | None
last_annotator_id: str | None
property download_url: str

Return the URL that can be used to download the full size media entity from the Intel® Geti™ server.

Returns:

URL at which the media entity can be downloaded

property base_url: str

Return the base URL for the media item, which is the URL pointing to the media details of the entity.

Returns:

Base URL of the media entity

property identifier: MediaIdentifier

Return the media identifier for the media item.

Returns:

MediaIdentifier which uniquely identifies the media item.

abstract get_data(session: GetiSession) ndarray | str

Get the pixel data for this MediaItem. Uses caching.

For Image and VideoFrames, this method will return a np.ndarray. For Video objects, this method will return a path-like string, pointing to the video on the local disk.

Parameters:

session – REST session to the Intel® Geti™ server on which the MediaItem lives

Raises:

ValueError – If the cache is empty and no data can be downloaded from the cluster

Returns:

numpy array holding the pixel data for the MediaItem, or string pointing to the file location for Videos.

to_dict() Dict[str, Any]

Convert the MediaItem to a dictionary representation.

Returns:

Dictionary holding the annotation scene data

property overview: str

Return a string holding an overview of the media item.

Returns:

overview string of the media item

class geti_sdk.data_models.media.Image(id: str, name: str, type: str | MediaType, upload_time: str | datetime | None, annotation_state_per_task: List[TaskAnnotationState] | None = None, thumbnail: str | None = None, uploader_id: str | None = None, last_annotator_id: str | None = None, *, media_information: ImageInformation, annotation_scene_id: str | None = None, roi_id: str | None = None)

Representation of an image in Intel® Geti™.

Variables:

media_information – Container holding basic information such as width and height about the image entity

media_information: ImageInformation
annotation_scene_id: str | None
roi_id: str | None
property identifier: ImageIdentifier

Return the media identifier for the Image instance

Returns:

ImageIdentifier object that contains the identifiers of the image

get_data(session: GetiSession) ndarray

Get the pixel data for this Image. This method uses caching: If the cache is empty, it will download the data using the provided session. Otherwise it will return the cached data directly

NOTE: The pixel data will be returned in BGR channel order

Parameters:

session – REST session to the Intel® Geti™ server on which the Image lives

Raises:

ValueError – If the cache is empty and no data can be downloaded from the cluster

Returns:

Numpy.ndarray holding the pixel data for this Image.

property numpy: ndarray | None

Pixel data for the Image, as a numpy array of shape (width x heigth x 3). If this attribute is None, the pixel data should be downloaded from the cluster first using the get_data method

Returns:

numpy.ndarray containing the pixel data

id: str
name: str
type: str
upload_time: str
annotation_state_per_task: List[TaskAnnotationState] | None
thumbnail: str | None
uploader_id: str | None
last_annotator_id: str | None
class geti_sdk.data_models.media.VideoAnnotationStatistics(annotated: int, partially_annotated: int, unannotated: int)

Annotation statistics for a video in Intel® Geti™.

Variables:
  • annotated – Number of frames in the video that have been fully annotated

  • partially_annotated – Number of frames in the video that have been partially annotated, meaning that one task in the task chain is still missing annotations

  • unannotated – Number of frames in the video that have not yet been annotated

annotated: int
partially_annotated: int
unannotated: int
class geti_sdk.data_models.media.Video(id: str, name: str, type: str | MediaType, upload_time: str | datetime | None, annotation_state_per_task: List[TaskAnnotationState] | None = None, thumbnail: str | None = None, uploader_id: str | None = None, last_annotator_id: str | None = None, *, media_information: VideoInformation, matched_frames: int | None = None, annotation_statistics: VideoAnnotationStatistics | None = None)

Representation of a video in Intel® Geti™.

Variables:

media_information – Container holding basic information such as width, height and duration about the video entity

media_information: VideoInformation
matched_frames: int | None
annotation_statistics: VideoAnnotationStatistics | None
property identifier: VideoIdentifier

Return the media identifier for the Video instance.

Returns:

VideoIdentifier object that contains the identifiers of the video

get_data(session: GetiSession) str

Get the video data from the Intel® Geti™ server. Calling this method will download the video data to a temporary file, and returns the path to file.

Parameters:

session – GetiSession object pointing to the instance from which the video should be downloaded.

Returns:

Path to the temporary video file on local disk.

to_frames(frame_stride: int | None = None, include_data: bool = False) List[VideoFrame]

Extract VideoFrames from the Video. Returns a list of VideoFrame objects.

Parameters:
  • frame_stride – Stride to use for frame extraction. If left as None (the default), the frame_stride stored in the media_information is used.

  • include_data – True to include pixel data for the frames, if available.

Returns:

List of VideoFrames constructed from the Video

get_frame(frame_index: int) VideoFrame

Return a VideoFrame extracted from the Video, at the specified index.

This method loads the numpy data for the frame, if available.

Parameters:

frame_index – Index of the frame to extract

Returns:

VideoFrame at the specified index

id: str
name: str
type: str
upload_time: str
annotation_state_per_task: List[TaskAnnotationState] | None
thumbnail: str | None
uploader_id: str | None
last_annotator_id: str | None
class geti_sdk.data_models.media.VideoFrame(id: str, name: str, type: str | MediaType, upload_time: str | datetime | None, annotation_state_per_task: List[TaskAnnotationState] | None = None, thumbnail: str | None = None, uploader_id: str | None = None, last_annotator_id: str | None = None, *, media_information: VideoFrameInformation, video_name: str | None = None)

Representation of a video frame in Intel® Geti™.

Variables:
  • media_information – Container holding basic information such as width and height about the VideoFrame entity

  • data – Pixel data for the VideoFrame. If this is None, the data can be downloaded using the ‘get_data’ method

media_information: VideoFrameInformation
video_name: str | None
classmethod from_video(video: Video, frame_index: int) VideoFrame

Create a VideoFrame entity from a video and a frame_index.

Parameters:
  • video – Video to extract the VideoFrame from

  • frame_index – index at which the frame lives in the video

Returns:

property identifier: VideoFrameIdentifier

Return the media identifier for the VideoFrame instance.

Returns:

VideoFrameIdentifier object that contains the identifiers of the video frame

property numpy: ndarray | None

Pixel data for the Image, as a numpy array of shape (width x heigth x 3). If this attribute is None, the pixel data should be downloaded from the cluster first using the get_data method

Returns:

numpy.ndarray containing the pixel data

get_data(session: GetiSession) ndarray

Get the pixel data for this VideoFrame. This method uses caching: If the cache is empty, it will download the data using the provided session. Otherwise it will return the cached data directly

Parameters:

session – REST session to the Intel® Geti™ server on which the VideoFrame lives

Raises:

ValueError – If the cache is empty and no data can be downloaded from the cluster

Returns:

Numpy.ndarray holding the pixel data for this VideoFrame.

id: str
name: str
type: str
upload_time: str
annotation_state_per_task: List[TaskAnnotationState] | None
thumbnail: str | None
uploader_id: str | None
last_annotator_id: str | None
class geti_sdk.data_models.media_identifiers.MediaIdentifier(type: str | MediaType)

Representation of media identification data as output by the Intel® Geti™ /annotations REST endpoints.

Variables:

type – Type of the media to which the annotation belongs

type: str
to_dict() Dict[str, str]

Return a dictionary form of the MediaIdentifier instance.

Returns:

Dictionary containing the media identifier data

class geti_sdk.data_models.media_identifiers.ImageIdentifier(type: str | MediaType, image_id: str)

Representation of image identification data used by the Intel® Geti™ /annotations endpoints. This object uniquely identifies an Image on the Intel® Geti™ server.

Variables:

image_id – unique database ID of the image

image_id: str
class geti_sdk.data_models.media_identifiers.VideoFrameIdentifier(type: str | MediaType, frame_index: int, video_id: str, key_index: int | None = None)

Representation of video frame identification data used by the Intel® Geti™ /annotations endpoints. This object uniquely identifies a VideoFrame on the Intel® Geti™ server.

Variables:
  • frame_index – Index of the video frame in the full video

  • video_id – unique database ID of the video to which the frame belongs

  • key_index – Index of the key frame in the video

frame_index: int
video_id: str
key_index: int | None
class geti_sdk.data_models.media_identifiers.VideoIdentifier(type: str | MediaType, video_id: str)

Representation of video identification data used by the Intel® Geti™ /annotations endpoints. This object uniquely identifiers a Video on the Intel® Geti™ server.

Variables:

video_id – unique database ID of the video

video_id: str
class geti_sdk.data_models.task_annotation_state.TaskAnnotationState(task_id: str, state: str | EnumType | None = None)

Representation of the state of an annotation for a particular task in an Intel® Geti™ project.

task_id: str
state: str | None

Prediction-related entities

class geti_sdk.data_models.predictions.ResultMedium(name: str, type: str | None = None, url: str | None = None, label_id: str | None = None, id: str | None = None, roi: Dict[str, Any] | None = None)

Representation of a single result medium in Intel® Geti™.

Variables:
  • name – Name of the result medium option

  • type – Type of the result medium represented by this object

  • url – URL at which the full result medium can be downloaded

  • id – Unique database ID assigned to the result medium

  • label_id – Unique database ID of the label referenced by this result medium

name: str
type: str | None
url: str | None
label_id: str | None
id: str | None
roi: Dict[str, Any] | None
label_name: str | None
data: bytes | None
resolve_label_name(labels: List[Label])

Add the label name to the result medium, by matching the label_id to a list of Labels.

Parameters:

labels – List of Labels to get the name from

get_data(session: GetiSession) bytes

Download the data belonging to this ResultMedium object.

Parameters:

session – REST session to the Intel® Geti™ server from which this ResultMedium was generated

Returns:

bytes object holding the data, if any is found

property friendly_name: str

Return a human readable name with which the result medium can be identified.

Returns:

friendly name for the result medium

class geti_sdk.data_models.predictions.Prediction(annotations: List[Annotation], media_identifier: ImageIdentifier | VideoFrameIdentifier | None = None, id: str | None = None, modified: str | datetime | None = None, labels_to_revisit_full_scene: List[str] | None = None, annotation_state_per_task: List[TaskAnnotationState] | None = None, created: str | datetime | None = None, *, kind: str | AnnotationKind = AnnotationKind.PREDICTION, maps: List[ResultMedium] = NOTHING, feature_vector: ndarray | None = None)

Representation of the model predictions for a certain media entity in Intel® Geti™.

Variables:
  • annotations – List of predictions belonging to the media entity

  • id – unique database ID of the Prediction in Intel® Geti™

  • kind – Kind of prediction (Annotation or Prediction)

  • media_identifier – Identifier of the media entity to which this Prediction applies

  • modified – Date and time at which this Prediction was last modified

  • maps – List of additional result media belonging to this prediction

  • feature_vector – Optional feature vector (produced by the model) for the image to which the prediction relates

  • active_score – Optional active score (produced by the model) for the image to which the prediction relates

kind: str
maps: List[ResultMedium]
feature_vector: ndarray | None
created: str | None
resolve_labels_for_result_media(labels: List[Label]) None

Resolve the label names for all result media available with this Prediction.

Parameters:

labels – List of Labels for the project, from which the names are taken

deidentify() None

Remove all unique database ID’s from the prediction and the entities it contains.

property has_result_media: bool

Return True if this Prediction has result media belonging to it, False otherwise.

Returns:

True if there are result media belonging to the prediction

get_result_media_data(session: GetiSession) List[ResultMedium]

Download the data for all result media belonging to this prediction.

Parameters:

session – REST session to the Intel® Geti™ server from which this Prediction was generated

Returns:

List of result media, that have their data downloaded from the cluster

as_mask(media_information: MediaInformation, probability_threshold: float | None = None) ndarray

Convert the shapes in the prediction to a mask that can be overlayed on an image.

Parameters:
  • media_information – MediaInformation object containing the width and heigth of the image for which the mask should be generated.

  • probability_threshold – Threshold (between 0 and 1) for the probability. Shapes that are predicted with a probability below this threshold will not be plotted in the mask. If left as None (the default), all predictions will be shown.

Returns:

np.ndarray holding the mask representation of the prediction

filter_by_confidence(confidence_threshold: float) Prediction

Return a new Prediction instance containing only those predicted annotations that have a confidence higher than confidence_threshold.

Parameters:

confidence_threshold – Float between 0 and 1. Annotations that only have predicted labels with a probability lower than this value will be filtered out.

Returns:

new Prediction object containing only annotations with a predicted probability higher than the confidence_threshold

Status- and job-related entities

class geti_sdk.data_models.status.StatusSummary(progress: float, message: str | None = None)

Summary of the status of a project or task on the GETi cluster.

NOTE: the ‘message’ attribute was removed in Geti 1.1

Variables:
  • progress – Training progress, if a model is being trained

  • message – Optional Human readable message describing the status

progress: float
message: str | None
classmethod from_dict(status_dict: Dict[str, Any]) StatusSummary

Create a StatusSummary object from a dictionary.

Parameters:

status_dict – Dictionary representing a status, as returned by the GETi /status and /jobs endpoints

Returns:

StatusSummary object holding the status data contained in status_dict

property user_friendly_message: str

Return a message describing the status in a human readable format

class geti_sdk.data_models.status.LabelAnnotationRequirements(id: str, label_name: str, label_color: str, value: int)

Detailed information regarding the required number of annotations for a specific label.

Variables:
  • id – Unique database ID of the label

  • label_name – Name of the label

  • label_color – Color of the label

  • value – Required number of annotations for this label

id: str
label_name: str
label_color: str
value: int
class geti_sdk.data_models.status.AnnotationRequirements(details: List[LabelAnnotationRequirements], value: int)

Container holding the required number of annotations before auto-training can be triggered for a task in GETi.

Variables:
  • value – Total number of required annotations for the task

  • details – Required annotations per label

details: List[LabelAnnotationRequirements]
value: int
class geti_sdk.data_models.status.TaskStatus(id: str, is_training: bool, required_annotations: AnnotationRequirements, status: StatusSummary, title: str, n_new_annotations: int | None = None, ready_to_train: bool | None = None)

Status of a single task in GETi.

Variables:
  • id – Unique database ID of the task

  • is_training – True if a training job is currently running for the task

  • required_annotations – AnnotationRequirements object that holds details related to the required number of annotations before auto-training will be started for the task

  • status – StatusSummary object that contains (among others) a human readable message describing the status of the task

  • title – Title of the taks

  • n_new_annotations – Number of new annotations that have been made for this task since its last training round. Only used in Geti v1.1 and up

id: str
is_training: bool
required_annotations: AnnotationRequirements
status: StatusSummary
title: str
n_new_annotations: int | None
ready_to_train: bool | None
class geti_sdk.data_models.status.ProjectStatus(is_training: bool, n_required_annotations: int, status: StatusSummary, tasks: List[TaskStatus], n_new_annotations: int | None = None, project_performance: Performance | None = None, n_running_jobs: int | None = None, n_running_jobs_project: int | None = None)

Status of a project in GETi.

Parameters:

is_training – True if a training job is currently running for any of the tasks in the project

Variables:
  • n_required_annotations – Total number of required annotations for the project, before auto-training can be started

  • status – StatusSummary object that contains (among others) a human readable message describing the status of the project

  • tasks – List of TaskStatus objects, detailing the status of each task in the project

  • n_new_annotations – Only used in Geti v1.1

is_training: bool
n_required_annotations: int
status: StatusSummary
tasks: List[TaskStatus]
n_new_annotations: int | None
project_performance: Performance | None
n_running_jobs: int | None
n_running_jobs_project: int | None
property summary: str

Return a string that gives a very brief summary of the project status.

Returns:

String holding a brief summary of the project status

class geti_sdk.data_models.job.JobStatus(progress: float, message: str | None = None, *, state: str | EnumType)

Current status of a job on the Intel® Geti™ server.

Variables:

state – Current state of the job

state: str
classmethod from_dict(status_dict: Dict[str, Any]) JobStatus

Create a JobStatus object from a dictionary.

Parameters:

status_dict – Dictionary representing a status, as returned by the Intel® Geti™ /status and /jobs endpoints

Returns:

JobStatus object holding the status data contained in status_dict

class geti_sdk.data_models.job.TaskMetadata(model_architecture: str | None = None, model_template_id: str | None = None, model_version: int | None = None, name: str | None = None, dataset_storage_id: str | None = None, task_id: str | None = None)

Metadata related to a task on the Intel® Geti™ cluster.

Variables:
  • name – Name of the task

  • model_template_id – Identifier of the model template used by the task

  • model_architecture – Name of the neural network architecture used for the model

  • model_version – Version of the model currently used by the job

  • dataset_storage_id – Unique database ID of the dataset storage used by the job

  • task_id – ID of the task to which the TaskStatus object applies. Only used in Geti v1.1 and up

model_architecture: str | None
model_template_id: str | None
model_version: int | None
name: str | None
dataset_storage_id: str | None
task_id: str | None
class geti_sdk.data_models.job.TestMetadata(model_architecture: str, model_template_id: str, datasets: List[Dataset], model: dict | None = None)

Metadata related to a model test job on the GETi cluster.

Variables:
  • model_template_id – Identifier of the model template used in the test

  • model_architecture – Name of the neural network architecture used for the model

  • datasets – List of dictionaries, each dictionary holding the id and name of a dataset used in the test

model_architecture: str
model_template_id: str
datasets: List[Dataset]
model: dict | None
class geti_sdk.data_models.job.ProjectMetadata(name: str | None = None, id: str | None = None, type: str | None = None)

Metadata related to a project on the GETi cluster.

Variables:
  • name – Name of the project

  • id – ID of the project

name: str | None
id: str | None
type: str | None
class geti_sdk.data_models.job.DatasetMetadata(name: str | None = None, id: str | None = None)

Metadata related to a dataset on the GETi cluster.

Variables:
  • name – Name of the dataset

  • id – ID of the dataset

name: str | None
id: str | None
class geti_sdk.data_models.job.ParametersMetadata(file_id: str | None = None)

Metadata related to a project import to the GETi cluster.

Variables:

file_id – ID of the uploaded file

file_id: str | None
class geti_sdk.data_models.job.ModelMetadata(model_storage_id: str, model_id: str, model_activated: bool | None = None)

Metadata for a Job related to a model on the GETi cluster.

Variables:
  • model_storage_id – ID of the model storage in which the model lives

  • model_id – ID of the model

  • model_activated – True if the model has been activated succesfully This is applicable after a training job. Defaults to None

model_storage_id: str
model_id: str
model_activated: bool | None
class geti_sdk.data_models.job.ScoreMetadata(task_id: str, score: float)

Metadata element containing scores for the tasks in the project

Variables:
  • task_id – ID of the task for which the score was achieved

  • score – Performance score for the model for the task

task_id: str
score: float
class geti_sdk.data_models.job.JobMetadata(task: TaskMetadata | None = None, project: ProjectMetadata | None = None, dataset: DatasetMetadata | None = None, parameters: ParametersMetadata | None = None, test: TestMetadata | None = None, base_model_id: str | None = None, model_storage_id: str | None = None, optimization_type: str | None = None, optimized_model_id: str | None = None, download_url: str | None = None, export_format: str | None = None, file_id: str | None = None, scores: List[ScoreMetadata] | None = None, trained_model: ModelMetadata | None = None, warnings: List[dict] | None = None, supported_project_types: List[dict] | None = None, project_id: str | None = None)

Metadata for a particular job on the GETi cluster.

Variables:
  • task – TaskMetadata object holding information regarding the task from which the job originates

  • base_model_id – Optional unique database ID of the base model. Only used for optimization jobs

  • model_storage_id – Optional unique database ID of the model storage used by the job.

  • optimization_type – Optional type of the optimization method used in the job. Only used for optimization jobs

  • optimized_model_id – Optional unique database ID of the optimized model produced by the job. Only used for optimization jobs.

  • scores – List of scores for the job. Added in Geti v1.1

task: TaskMetadata | None
project: ProjectMetadata | None
dataset: DatasetMetadata | None
parameters: ParametersMetadata | None
test: TestMetadata | None
base_model_id: str | None
model_storage_id: str | None
optimization_type: str | None
optimized_model_id: str | None
download_url: str | None
export_format: str | None
file_id: str | None
scores: List[ScoreMetadata] | None
trained_model: ModelMetadata | None
warnings: List[dict] | None
supported_project_types: List[dict] | None
project_id: str | None
class geti_sdk.data_models.job.JobCancellationInfo(cancellable: bool = True, is_cancelled: bool = False, user_uid: str | None = None, cancel_time: str | datetime | None = None)

Information relating to the cancellation of a Job in Intel Geti

Variables:
  • is_cancelled – True if the job is cancelled, False otherwise

  • user_uid – Unique ID of the User who cancelled the Job

  • cancel_time – Time at which the Job was cancelled

cancellable: bool
is_cancelled: bool
user_uid: str | None
cancel_time: str | None
class geti_sdk.data_models.job.JobCost(requests: List, consumed: List)

Information relating to the cost of a Job in Intel Geti.

requests: List
consumed: List
class geti_sdk.data_models.job.Job(name: str, id: str, type: str | EnumType, metadata: JobMetadata, description: str | None = None, creation_time: str | datetime | None = None, start_time: str | datetime | None = None, end_time: str | datetime | None = None, author: str | None = None, cancellation_info: JobCancellationInfo | None = None, state: str | EnumType | None = None, steps: List[dict] | None = None, cost: JobCost | None = None)

Representation of a job running on the GETi cluster.

Variables:
  • name – Name of the job

  • id – Unique database ID of the job

  • project_id – Unique database ID of the project from which the job originates

  • type – Type of the job

  • creation_time – Time at which the job was created

  • start_time – Time at which the job started running

  • end_time – Time at which the job finished running

  • author – Author of the job

  • cancellation_info – Information relating to the cancellation of the jobW

  • metadata – JobMetadata object holding metadata for the job

name: str
id: str
type: str
metadata: JobMetadata
description: str | None
creation_time: str | None
start_time: str | None
end_time: str | None
author: str | None
cancellation_info: JobCancellationInfo | None
state: str | None
steps: List[dict] | None
cost: JobCost | None
property workspace_id: str

Return the unique database ID of the workspace to which the job belongs.

Returns:

Unique database ID of the workspace to which the job belongs

property relative_url: str

Return the url at which the Job can be addressed on the GETi cluster, relative to the url of the cluster itself.

Returns:

Relative url for the Job instance

update(session: GetiSession) Job

Update the job status to its current value, by making a request to the GETi cluster addressed by session.

Parameters:

session – GetiSession to the cluster from which the Job originates

Raises:

ValueError – If no workspace_id has been set for the job prior to calling this method

Returns:

Job with its status updated

cancel(session: GetiSession) Job

Cancel and delete the job, by making a request to the GETi cluster addressed by session.

Parameters:

session – GetiSession to the cluster on which the Job is running

Returns:

Job with updated status

property overview: str

Return a string that shows an overview of the job.

Returns:

String holding an overview of the job

to_dict() Dict[str, Any]

Return the dictionary representation of the job.

Returns:

property is_finished: bool

Return True if the job finished successfully, False otherwise

property is_running: bool

Return True if the job is currently running, False otherwise

property total_steps: int

Return the total number of steps in the job

property current_step: int

Return the current step for the job

property current_step_message: str

Return the description of the current step for the job

Returns:

String containing the current step name/description. If for whatever reason the current step cannot be determined, an empty string is returned

property current_step_progress: float

Return the progress of the current step for the job

Returns:

float indicating the progress of the current step in the job

property geti_version: GetiVersion

Return the version of the Intel Geti instance from which the job originates.

Returns:

Version of the Intel Geti instance from which the job originates

Utility functions

geti_sdk.data_models.utils.deidentify(instance: Any)

Set all identifier fields of an instance of an attr.define decorated class within the GETi REST DataModels to None.

Parameters:

instance – Object to deidentify

geti_sdk.data_models.utils.str_to_enum_converter(enum: Type[EnumType]) Callable[[str | EnumType], EnumType]

Construct a converter function to convert an input value into an instance of the Enum subclass passed in enum.

Parameters:

enum – type of the Enum to which the converter should convert

Returns:

Converter function that takes an input value and attempts to convert it into an instance of enum

geti_sdk.data_models.utils.str_to_optional_enum_converter(enum: Type[EnumType]) Callable[[str | EnumType], EnumType]

Construct a converter function to convert an input value into an instance of the Enum subclass passed in enum.

Parameters:

enum – type of the Enum to which the converter should convert

Returns:

Converter function that takes an input value and attempts to convert it into an instance of enum

geti_sdk.data_models.utils.str_to_enum_converter_by_name_or_value(enum: Type[EnumType], allow_none: bool = False) Callable[[str | EnumType], EnumType]

Construct a converter function to convert an input value into an instance of the Enum subclass passed in enum.

This method attempts to convert both from the Enum value as well as it’s name

Parameters:
  • enum – type of the Enum to which the converter should convert

  • allow_none – True to allow None as input value, i.e. for optional parameters

Returns:

Converter function that takes an input value and attempts to convert it into an instance of enum

geti_sdk.data_models.utils.str_to_task_type(task_type: str | TaskType) TaskType

Convert an input string to a task type.

Parameters:

task_type

Returns:

TaskType instance corresponding to task_type

geti_sdk.data_models.utils.str_to_media_type(media_type: str | MediaType) MediaType

Convert an input string to a media type.

Parameters:

media_type

Returns:

MediaType instance corresponding to media_type

geti_sdk.data_models.utils.str_to_shape_type(shape_type: str | ShapeType) ShapeType

Convert an input string to a shape type.

Parameters:

shape_type

Returns:

ShapeType instance corresponding to shape_type

geti_sdk.data_models.utils.str_to_annotation_kind(annotation_kind: str | AnnotationKind) AnnotationKind

Convert an input string to an annotation kind.

Parameters:

annotation_kind

Returns:

AnnotationKind instance corresponding to annotation_kind

geti_sdk.data_models.utils.str_to_datetime(datetime_str: str | datetime | None) datetime | None

Convert a string to a datetime.

Parameters:

datetime_str – string containing the datetime, in isoformat.

Returns:

datetime instance

geti_sdk.data_models.utils.attr_value_serializer(instance, field, value)

Convert a value in an attr.define decorated class to string representation, used while converting the attrs object to a dictionary.

Converts Enums and datetime objects to string representation

Parameters:
  • instance

  • field

  • value

Returns:

geti_sdk.data_models.utils.numpy_from_buffer(buffer: bytes) ndarray

Convert a bytes string representing an image into a numpy array.

Parameters:

buffer – Bytes object to convert

Returns:

Numpy.ndarray containing the numpy data from the image

geti_sdk.data_models.utils.round_dictionary(input_data: Dict[str, Any] | List[Any], decimal_places: int = 3) Dict[str, Any] | List[Any]

Convert all floats in a dictionary to string representation, rounded to decimal_places.

Parameters:
  • input_data – Input dictionary to convert and round

  • decimal_places – Number of decimal places to round to. Defaults to 3

Returns:

dictionary with all floats rounded

geti_sdk.data_models.utils.round_to_n_digits(n: int) Callable[[float], float]

Return a function to round an input number to n digits.

Parameters:

n – Number of digits to round to

Returns:

Callable that, when called with a number as input, will round the number to n digits.

geti_sdk.data_models.utils.remove_null_fields(input: Any)

Remove fields that have ‘None’ or an emtpy string ‘’ as their value from a dictionary.

NOTE: This function modifies the input dictionary in place

Parameters:

input – Dictionary to remove the null fields from

Custom container classes

class geti_sdk.data_models.containers.AlgorithmList(data: Sequence[Algorithm] | None = None)

A list containing the algorithms supported in Intel® Geti™.

static from_rest(rest_input: Dict[str, Any]) AlgorithmList

Create an AlgorithmList from the response of the /supported_algorithms REST endpoint in Intel® Geti™.

Parameters:

rest_input – Dictionary retrieved from the /supported_algorithms REST endpoint

Returns:

AlgorithmList holding the information related to the supported algorithms in Intel® Geti™

get_by_model_template(model_template_id: str) Algorithm

Retrieve an algorithm from the list by its model_template_id.

Parameters:

model_template_id – Name of the model template to get the Algorithm information for

Returns:

Algorithm holding the algorithm details

get_by_task_type(task_type: TaskType) AlgorithmList

Return a list of supported algorithms for a particular task type.

Parameters:

task_type – TaskType to get the supported algorithms for

Returns:

List of supported algorithms for the task type

property summary: str

Return a string that gives a very brief summary of the algorithm list.

Returns:

String holding a brief summary of the list of algorithms

get_by_name(name: str) Algorithm

Retrieve an algorithm from the list by its algorithm_name.

Parameters:

name – Name of the Algorithm to get

Returns:

Algorithm holding the algorithm details

get_default_for_task_type(task_type: TaskType) Algorithm

Return the default algorithm for a given task type. If there is no algorithm for the task type in the AlgorithmList, this method will raise a ValueError.

Parameters:

task_type – TaskType of the task to get the default algorithm for

Raises:

ValueError if there are no available algorithms for the specified task_type in the AlgorithmList

Returns:

Default algorithm for the task

class geti_sdk.data_models.containers.MediaList(initlist=None)

A list containing Intel® Geti™ media entities

property ids: List[str]

Return a list of unique database IDs for all media items in the media list.

property names: List[str]

Return a list of filenames for all media items in the media list.

get_by_id(id_value: str) MediaItem

Return the item with id id_value from the media list.

get_by_filename(filename: str) MediaItem

Return the item with name filename from the media list.

property media_type: Type[MediaTypeVar]

Return the type of the media contained in this list.

static from_rest_list(rest_input: List[Dict[str, Any]], media_type: Type[MediaTypeVar]) MediaList[MediaTypeVar]

Create a MediaList instance from a list of media entities obtained from the Intel® Geti™ /media endpoints.

Parameters:
  • rest_input – List of dictionaries representing media entities in Intel® Geti™

  • media_type – Image or Video, type of the media entities that are to be converted.

Returns:

MediaList holding the media entities contained in rest_input, where each entity is of type media_type

property has_duplicate_filenames: bool

Return True if the media list contains at least two items that have the same filename, False otherwise.

class geti_sdk.data_models.containers.LabelList(data: Sequence[Label] | None = None)

A list containing labels for an Intel® Geti™ inference model.

property has_empty_label: bool

Return True if the list of Labels contains an empty label

get_by_id(id: str) Label

Return the Label object with ID corresponding to id

get_by_name(name: str) Label

Return the Label object named name

classmethod from_json(input_json: List[Dict[str, Any]]) LabelList

Create a LabelList object from json input. Input should be formatted as a list of dictionaries, each representing a single Label

create_scored_label(id_or_name: str, score: float) ScoredLabel

Return a ScoredLabel object corresponding to the label identified by id_or_name, and with an assigned probability score of score

Parameters:
  • id_or_name – ID or name of the Label to assign

  • score – probability score of the label

get_empty_label() Label | None

Return the empty label, if the LabelList contains one. If not, return None

get_non_empty_labels() LabelList

Return all non-empty labels

classmethod from_project(project: Project, task_index: int = 0) LabelList

Create a LabelList object for the ‘project’, corresponding to the trainable task addressed by task_index

Parameters:
  • project – Project for which to get the list of labels

  • task_index – Index of the task for which to get the list of labels. Defaults to 0, i.e. the first trainable task in the project

sort_by_ids(label_ids: List[str])

Sort the labels in the LabelList by their ID, according to the order defined in label_ids

Enumerations

class geti_sdk.data_models.enums.TaskType(value)

Enum representing the different task types in Intel® Geti™ projects.

DETECTION = 'detection'
SEGMENTATION = 'segmentation'
CLASSIFICATION = 'classification'
ANOMALY_CLASSIFICATION = 'anomaly_classification'
ANOMALY_DETECTION = 'anomaly_detection'
ANOMALY_SEGMENTATION = 'anomaly_segmentation'
ANOMALY = 'anomaly'
INSTANCE_SEGMENTATION = 'instance_segmentation'
ROTATED_DETECTION = 'rotated_detection'
DATASET = 'dataset'
CROP = 'crop'
property is_trainable: bool

Return True if a task of this TaskType is trainable, False otherwise.

Returns:

property is_global: bool

Return True if a task of this TaskType produces global labels, False otherwise.

Returns:

property is_local: bool

Return True if a task of this TaskType produces local labels, False otherwise.

Returns:

property is_anomaly: bool

Return True if a task of this TaskType is an anomaly task, False otherwise.

Returns:

property is_segmentation: bool

Return True if a task of this TaskType is a segmentation task, False otherwise.

Returns:

property is_detection: bool

Return True if a task of this TaskType is a detection task, False otherwise.

Returns:

classmethod from_domain(domain)

Instantiate a TaskType from a given Domain.

Parameters:

domain – domain to get the TaskType for

Returns:

TaskType instance corresponding to the domain

class geti_sdk.data_models.enums.MediaType(value)

Enum representing the different media types in GETi.

IMAGE = 'image'
VIDEO = 'video'
VIDEO_FRAME = 'video_frame'
class geti_sdk.data_models.enums.ShapeType(value)

Enum representing the types of shapes available for annotations on the Intel® Geti™ platform.

RECTANGLE = 'RECTANGLE'
ELLIPSE = 'ELLIPSE'
POLYGON = 'POLYGON'
ROTATED_RECTANGLE = 'ROTATED_RECTANGLE'
class geti_sdk.data_models.enums.SubscriptionStatus(value)

Enum representing the status of a subscription on the Intel® Geti™ platform.

ACTIVE = 'ACTIVE'
CANCELLED = 'CANCELLED'
class geti_sdk.data_models.enums.AnnotationKind(value)

Enum representing the different kind of annotation scenes on the Intel® Geti™ platform.

ANNOTATION = 'annotation'
PREDICTION = 'prediction'
class geti_sdk.data_models.enums.AnnotationState(value)

Enum representing the different annotation statuses for media items within an Intel® Geti™ project.

TO_REVISIT = 'to_revisit'
ANNOTATED = 'annotated'
PARTIALLY_ANNOTATED = 'partially_annotated'
NONE = 'none'
class geti_sdk.data_models.enums.PredictionMode(value)

Enum representing the mode used to generate predictions on the Intel® Geti™ platform.

LATEST = 'latest'
AUTO = 'auto'
ONLINE = 'online'
class geti_sdk.data_models.enums.ConfigurationEntityType(value)

Enum representing the different configuration types on the Intel® Geti™ platform.

HYPER_PARAMETER_GROUP = 'HYPER_PARAMETER_GROUP'
COMPONENT_PARAMETERS = 'COMPONENT_PARAMETERS'
class geti_sdk.data_models.enums.Domain(value)

Enum representing the different task domains in Intel® Geti™ projects.

DETECTION = 'DETECTION'
SEGMENTATION = 'SEGMENTATION'
CLASSIFICATION = 'CLASSIFICATION'
ANOMALY_CLASSIFICATION = 'ANOMALY_CLASSIFICATION'
ANOMALY_DETECTION = 'ANOMALY_DETECTION'
ANOMALY_SEGMENTATION = 'ANOMALY_SEGMENTATION'
ANOMALY = 'ANOMALY'
INSTANCE_SEGMENTATION = 'INSTANCE_SEGMENTATION'
ROTATED_DETECTION = 'ROTATED_DETECTION'
classmethod from_task_type(task_type: TaskType) Domain

Return the Domain corresponding to a certain task type.

Parameters:

task_type – TaskType to retrieve the domain for

Returns:

Domain corresponding to task_type

class geti_sdk.data_models.enums.ModelStatus(value)

Enum representing the different statuses that a model can have in GETi.

NOT_READY = 'NOT_READY'
WEIGHTS_INITIALIZED = 'WEIGHTS_INITIALIZED'
SUCCESS = 'SUCCESS'
FAILED = 'FAILED'
NOT_IMPROVED = 'NOT_IMPROVED'
class geti_sdk.data_models.enums.OptimizationType(value)

Enum representing the optimization type for an OptimizedModel in Intel® Geti™.

NNCF = 'NNCF'
POT = 'POT'
MO = 'MO'
ONNX = 'ONNX'
NONE = 'NONE'
class geti_sdk.data_models.enums.JobType(value)

Enum representing the type of a job on the Intel® Geti™ cluster.

UNDEFINED = 'undefined'
TRAIN = 'train'
INFERENCE = 'inference'
RECONSTRUCT_VIDEO = 'reconstruct_video'
EVALUATE = 'evaluate'
OPTIMIZATION = 'optimization'
OPTIMIZE_POT = 'optimize_pot'
OPTIMIZE_NNCF = 'optimize_nncf'
TEST = 'test'
PREPARE_IMPORT_TO_NEW_PROJECT = 'prepare_import_to_new_project'
PERFORM_IMPORT_TO_NEW_PROJECT = 'perform_import_to_new_project'
EXPORT_PROJECT = 'export_project'
IMPORT_PROJECT = 'import_project'
EXPORT_DATASET = 'export_dataset'
class geti_sdk.data_models.enums.JobState(value)

Enum representing the state of a job on the Intel® Geti™ server.

IDLE = 'idle'
RUNNING = 'running'
PAUSED = 'paused'
FINISHED = 'finished'
ERROR = 'error'
FAILED = 'failed'
CANCELLED = 'cancelled'
INACTIVE = 'inactive'
SCHEDULED = 'scheduled'
classmethod active_states() List[JobState]

Return a list of JobState instance which represent jobs that are still active.

Returns:

List of JobState instances

classmethod inactive_states() List[JobState]

Return a list of JobState instance which represent jobs that are inactive, i.e. cancelled, errored or finished successfully.

Returns:

List of JobState instances

class geti_sdk.data_models.enums.DeploymentState(value)

Enum representing the status of a deployment creation process for an Intel® Geti™ project.

NONE = 'NONE'
PREPARING = 'PREPARING'
DONE = 'DONE'
FAILED = 'FAILED'
class geti_sdk.data_models.enums.SubsetPurpose(value)

Enum representing the purpose of a subset of a dataset on the Intel® Geti™ platform.

TRAINING = 'training'
VALIDATION = 'validation'
TESTING = 'testing'