CObjectDetectionTask¶
- class ikomia.dataprocess.pydataprocess.CObjectDetectionTask¶
Base class for object detection task in Computer Vision. It defines a task with the following properties:
Inputs:
image (
CImageIO)graphics (
CGraphicsInput)
Outputs:
image IO (
CImageIO): by default source image is forwarded.object detection IO (
CObjectDetectionIO)
Derived from
C2dImageTask.Import
from ikomia.dataprocess import CObjectDetectionTask
Methods
__init__(arg1)__init__( (object)self) -> None :
add_object(self, id, class_index, ...)Add detected object result localized in image through regular bounding box.
get_names(self)Get class names.
get_results(self)Get object detection results as a
CObjectDetectionIOinstance.get_image_with_graphics(self)Get visualization image where all extracted information are embedded (graphics items).
read_class_names(self, path)Populate class names from the given text file (one line per class).
set_colors(self, colors)Set colors associated with class names.
set_names(self, names)Set class names.
emit_add_sub_progress_steps(self, count)emit_output_changed(self)emit_step_progress(self)See
emit_step_progress().Overridden methods
end_task_run(self)See
end_task_run().Inherited methods
add_input(self, input)Add new input to the task.
add_output(self, output)Add new output to the task.
apply_graphics_mask(self, origin, processed, ...)Apply the mask generated from graphics to the result image so that only masked areas seems to be processed.
apply_graphics_mask_to_binary(self, origin, ...)Apply the mask generated from graphics to the binary source image.
begin_task_run(self)See
begin_task_run().create_input_graphics_mask(self, index, ...)Generate a binary mask image from the task graphics input at the specified index.
create_graphics_mask(self, width, height, ...)Generate a binary mask image from the given graphics input object.
execute_actions(self, action)Method called when a specific action is requested from the associated widget (see
emit_send_process_action()).forward_input_image(self, input_index, ...)Forward input image at position input_index to output at position output_index.
get_elapsed_time(self)Get the time of the last execution in milliseconds.
get_graphics_mask(self, index)Get the binary mask generated from graphics input at position index.
get_input(self, index)Get input at position index.
get_input_count(self)Get the number of inputs.
get_input_data_type(self, index)Get input data type at position index.
get_inputs(self)Get the whole list of inputs.
get_output(self, index)Get output at position index.
get_output_count(self)Get the number of outputs.
get_output_data_type(self, index)Get output data type at position index.
get_outputs(self)Get the whole list of outputs.
get_parameters(self)Get values of task parameters.
get_progress_steps(self)See
get_progress_steps().global_input_changed(self, is_new_sequence)graphics_changed(self)See
graphics_changed().is_graphics_changed_listening(self)Check whether the task is listening to graphics changed event.
is_mask_available(self, index)Check whether a binary mask from graphics input is available at position index.
parameters_modified(self)Notify that the task parameters have changed.
remove_input(self, index)Remove input at the given position.
run(self)See
run().set_action_flag(self, action, is_enable)Enable or disable the given action.
set_active(self, is_active)See
set_active().set_input(self, input, index)Set input at position index with the given one.
set_input_data_type(self, data_type, index)Set the data type for the input at position index.
set_inputs(self, inputs)Set the whole list of inputs with the given one.
set_output(self, output, index)Set output at position index with the given one.
set_output_color_map(self, index, ...)Bind a display color map to an image output.
set_output_data_type(self, data_type, index)Set the data type for the output at position index.
set_outputs(self, outputs)Set the whole list of outputs with the given one.
set_parameters(self, values)Set values of task parameters.
stop(self)See
stop().update_static_outputs(self)Determine output data type automatically from input data types.
Attributes
nameTask name (must be unique)
typeMain purpose or data type on which the task is dedicated to.
Details
- __init__((object)arg1) None¶
- __init__( (object)self) -> None :
Default constructor
- __init__( (object)self, (str)name) -> None :
Construct CObjectDetectionTask object with the given name.
Args:
name (str): task name, must be unique
- add_object((CObjectDetectionTask)self, (int)id, (int)class_index, (float)confidence, (float)x, (float)y, (float)width, (float)height) None :¶
Add detected object result localized in image through regular bounding box.
Args:
id (int): object identifier
class_index (int): index of the associated class
confidence (float): confidence of the prediction
x (float): left coordinate of object bounding box
y (float): top coordinate of object bounding box
width (float): width of object bounding box
height (float): height of object bounding box
- add_object( (CObjectDetectionTask)self, (int)id, (int)class_index, (float)confidence, (float)cx, (float)cy, (float)width, (float)height, (float)angle) -> None :
Add detected object result localized in image through 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
- get_names((CObjectDetectionTask)self) object :¶
Get class names. Call
read_class_names()to populate names from text file.- Returns:
class names
- Return type:
str list
- get_results((CObjectDetectionTask)self) CObjectDetectionIO :¶
Get object detection results as a
CObjectDetectionIOinstance.- Returns:
object detection results
- Return type:
- get_image_with_graphics((CObjectDetectionTask)self) object :¶
Get visualization image where all extracted information are embedded (graphics items).
- Returns:
visualization image
- Return type:
2D Numpy array
- read_class_names((CObjectDetectionTask)self, (str)path) None :¶
Populate class names from the given text file (one line per class).
- Parameters:
path (str) – path to class names definition file
- set_colors((CObjectDetectionTask)self, (object)colors) None :¶
Set colors associated with class names. The given list must have the same size as names list. If not provided, random colors are generated while populating the name list (
read_class_names()).- Parameters:
list (colors (list of) – r, g, b integer values in range [0, 255])
- set_names((CObjectDetectionTask)self, (object)names) None :¶
Set class names. The function generate associated random colors if none is defined.
- Parameters:
names (list of str)
- emit_add_sub_progress_steps((CObjectDetectionTask)self, (int)count) None :¶
- emit_graphics_context_changed((CObjectDetectionTask)self) None :¶
- emit_output_changed((CObjectDetectionTask)self) None :¶
- emit_step_progress((CObjectDetectionTask)self) None :¶
See
emit_step_progress().
- end_task_run((CObjectDetectionTask)self) None :¶
See
end_task_run().end_task_run( (CObjectDetectionTask)self) -> None