CObjectDetectionIO#

class ikomia.dataprocess.pydataprocess.CObjectDetectionIO#

Define input or output managing common information extracted by object detection task. Such task are able to automatically detect objects in image and get class label, confidence and bounding box for each one. For each object, information are stored in a CObjectDetection instance. Among others, algorithms like FasterRCNN, RetinaNet and YOLO series are object detection tasks.

Import

from ikomia.dataprocess import CObjectDetectionIO

Methods

__init__(arg1)

__init__( (object)self) -> None :

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

Add detected object with bounding box.

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.

Overridden methods

clear_data(self)

See clear_data().

is_data_available(self)

See is_data_available().

load(self, path)

Load object detection input/output from JSON file.

save(self, path)

Save object 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, (CObjectDetectionIO)arg2) -> None :

Copy constructor

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

Add detected object with bounding box.

Args:

id (int): object identifier

label (str): class label

confidence (double): prediction confidence

box_x (double): left coordinate of object bounding box

box_y (double): top coordinate of object bounding box

box_width (double): width of object bounding box

box_height (double): height of object bounding box

color (int list - rgba): display color

add_object( (CObjectDetectionIO)self, (int)id, (str)label, (float)confidence, (float)cx, (float)cy, (float)width, (float)height, (float)angle, (object)color) -> None :

Add detected object with oriented bounding box.

Args:

id (int): object identifier

label (str): class label

confidence (double): prediction confidence

cx (double): x-coordinate of object bounding box center

cy (double): y-coordinate of object bounding box center

width (double): width of object bounding box

height (double): height of object bounding box

angle (double): angle w.r.t horizontal axis of object bounding box

color (int list - rgba): display color

clear_data((CObjectDetectionIO)self) None :#

See clear_data().

clear_data( (CObjectDetectionIO)self) -> None

get_object_count((CObjectDetectionIO)self) int :#

Get the number of detected objects.

Returns:

object count

Return type:

int

get_object((CObjectDetectionIO)self, (int)index) CObjectDetection :#

Get object information at a given index.

Parameters:

index (int) – object index

Returns:

object information instance

Return type:

CObjectDetection

get_objects((CObjectDetectionIO)self) object :#

Get all detected objects.

Returns:

detected objets

Return type:

CObjectDetection list

init((CObjectDetectionIO)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((CObjectDetectionIO)self) bool :#

See is_data_available().

is_data_available( (CObjectDetectionIO)self) -> bool

load((CObjectDetectionIO)self, (str)path) None :#

Load object detection input/output from JSON file.

Args:

path (str): path to JSON file

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

save((CObjectDetectionIO)self, (str)path) None :#

Save object detection input/output to JSON file.

Args:

path (str): path to JSON file

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

to_json((CObjectDetectionIO)self) str :#

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

Returns:

string: JSON formatted string

to_json( (CObjectDetectionIO)self) -> str

to_json( (CObjectDetectionIO)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( (CObjectDetectionIO)self, (object)options) -> str

from_json((CObjectDetectionIO)self, (str)json_str) None :#

Set input/output data from JSON formatted string.

Args:

str: data as JSON formatted string

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