CKeypointsIO

class ikomia.dataprocess.pydataprocess.CKeypointsIO

Define input or output managing common information extracted by keypoints detection task. Such task are able to automatically detect objects in image and get keypoints for each one. For each object, information is stored in a CObjectKeypoints instance. Links between points is also a required information and is stored in a CKeypointLink instance. Among others, algorithms like pose estimation are keypoints detection tasks.

Import

from ikomia.dataprocess import CKeypointsIO

Methods

__init__(arg1)

__init__( (object)self) -> None :

add_object(self, id, label, confidence, ...)

Add detected object and associated keypoints.

get_keypoint_links(self)

Get the global connection scheme of detected keypoints.

get_keypoint_names(self)

Get keypoint names.

get_object_count(self)

Get the number of detected objects.

get_object(self, index)

Get object information at a given index.

get_objects(self)

Get all detected objects.

init(self, task_name, ref_image_index)

Initialisation step to set associated task (name) and reference image.

set_keypoint_links(self, links)

Set the global connection scheme of detected keypoints.

set_keypoint_names(self, names)

Set keypoint names.

Overridden methods

clear_data(self)

See clear_data().

is_data_available(self)

See is_data_available().

load(self, path)

Load object keypoints detection input/output from JSON file.

save(self, path)

Save object keypoints detection input/output to JSON file.

to_json(self)

Return input/output data in JSON formatted string (compact mode).

from_json(self, json_str)

Set input/output data from JSON formatted string.

Inherited methods

copy_static_data(self, io)

Copy the static data from the given input or ouput.

get_unit_element_count(self)

Get the number of unit elements in terms of processing scheme.

Attributes

auto_save

Auto-save status

data_type

I/O data type

dim_count

Number of dimensions

description

Custom description to explain input/output type and use

displayable

Displayable status (Ikomia Studio)

name

I/O name

source_file_path

Path to the source file used as workflow input (if any)

Details

__init__((object)arg1) None
__init__( (object)self) -> None :

Default constructor

__init__( (object)arg1, (CKeypointsIO)arg2) -> None :

Copy constructor

add_object((CKeypointsIO)self, (int)id, (str)label, (float)confidence, (float)box_x, (float)box_y, (float)box_width, (float)box_height, (object)keypoints, (object)color) None :

Add detected object and associated keypoints.

Parameters:
  • id (int) – object identifier

  • label (str) – object class label

  • confidence (double) – prediction confidence

  • x (double) – left coordinate of object bounding box

  • y (double) – top coordinate of object bounding box

  • width (double) – width of object bounding box

  • height (double) – height of object bounding box

  • keypoints (list of tuple) – keypoints as list of pairs (index, CPointF)

  • color (int list - rgba) – display color

clear_data((CKeypointsIO)self) None :

See clear_data().

clear_data( (CKeypointsIO)self) -> None

from_json((CKeypointsIO)self, (str)json_str) None :

Set input/output data from JSON formatted string.

Args:

str: data as JSON formatted string

from_json( (CKeypointsIO)self, (str)json_str) -> None

Get the global connection scheme of detected keypoints. It consists in a list of links between points with the following information: starting point index, ending point index, link label and link color. Keypoints list order is very important: there is a strict equivalence between prediction keypoints index, name index and connection scheme.

Returns:

CKeypointLink list

get_keypoint_names((CKeypointsIO)self) object :

Get keypoint names. Each keypoint is associated with a label. Order in this list is very important: there is a strict equivalence between prediction keypoints index, name index and connection scheme.

Returns:

keypoint names

Return type:

str list

get_object_count((CKeypointsIO)self) int :

Get the number of detected objects.

Returns:

object count

Return type:

int

get_object((CKeypointsIO)self, (int)index) CObjectKeypoints :

Get object information at a given index.

Parameters:

index (int) – object index

Returns:

object information instance

Return type:

CObjectKeypoints

get_objects((CKeypointsIO)self) object :

Get all detected objects.

Returns:

detected objets

Return type:

CObjectKeypoints list

init((CKeypointsIO)self, (str)task_name, (int)ref_image_index) None :

Initialisation step to set associated task (name) and reference image. The reference image is the task output index where the graphics information (label, box) will be displayed as an overlay layer.

Parameters:
  • task_name (str) – task that contains the output

  • ref_image_index (int) – zero-based index of the output containing the reference image

is_data_available((CKeypointsIO)self) bool :

See is_data_available().

is_data_available( (CKeypointsIO)self) -> bool

load((CKeypointsIO)self, (str)path) None :

Load object keypoints detection input/output from JSON file.

Args:

path (str): path to JSON file

load( (CKeypointsIO)self, (str)path) -> None

save((CKeypointsIO)self, (str)path) None :

Save object keypoints detection input/output to JSON file.

Args:

path (str): path to JSON file

save( (CKeypointsIO)self, (str)path) -> None

Set the global connection scheme of detected keypoints. It consists in a list of links between points with the following information: starting point index, ending point index, link label and link color. Keypoints index are given with respect to prediction model and names structures.

Parameters:

links (CKeypointLink list)

set_keypoint_names((CKeypointsIO)self, (object)names) None :

Set keypoint names. Each keypoint is associated with a label. Moreover, order in this list is very important as there must have a strict equivalence between prediction keypoints index, name index and connection scheme.

Parameters:

names (list of str)

to_json((CKeypointsIO)self) str :

Return input/output data in JSON formatted string (compact mode).

Returns:

string: JSON formatted string

to_json( (CKeypointsIO)self) -> str

to_json( (CKeypointsIO)self, (object)options) -> str :

Return input/output data in JSON formatted string. JSON format options can be set, possible values are:

  • [‘json_format’, ‘compact’] (default)

  • [‘json_format’, ‘indented’]

Args:

list of str: format-specific options encoded as pairs [option_name, option_value]

Returns:

string: JSON formatted string

to_json( (CKeypointsIO)self, (object)options) -> str