apply_deep_counting_modelT_apply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model (Operator)

Name

apply_deep_counting_modelT_apply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model — Apply a Deep Counting model on a set of images for inference.

Signature

apply_deep_counting_model(Image : : DeepCountingHandle : Count, DeepCountingResult)

Herror T_apply_deep_counting_model(const Hobject Image, const Htuple DeepCountingHandle, Htuple* Count, Htuple* DeepCountingResult)

void ApplyDeepCountingModel(const HObject& Image, const HTuple& DeepCountingHandle, HTuple* Count, HTuple* DeepCountingResult)

HTuple HDlModelCounting::ApplyDeepCountingModel(const HImage& Image, HDictArray* DeepCountingResult) const

Hlong HDlModelCounting::ApplyDeepCountingModel(const HImage& Image, HDict* DeepCountingResult) const

static void HOperatorSet.ApplyDeepCountingModel(HObject image, HTuple deepCountingHandle, out HTuple count, out HTuple deepCountingResult)

HTuple HDlModelCounting.ApplyDeepCountingModel(HImage image, out HDict[] deepCountingResult)

int HDlModelCounting.ApplyDeepCountingModel(HImage image, out HDict deepCountingResult)

def apply_deep_counting_model(image: HObject, deep_counting_handle: HHandle) -> Tuple[Sequence[int], Sequence[HHandle]]

def apply_deep_counting_model_s(image: HObject, deep_counting_handle: HHandle) -> Tuple[int, HHandle]

Description

apply_deep_counting_modelapply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model applies the Deep Counting model given by DeepCountingHandleDeepCountingHandleDeepCountingHandleDeepCountingHandledeepCountingHandledeep_counting_handle on the tuple of input images ImageImageImageImageimageimage. A tuple with the number of found instances per input image is returned in CountCountCountCountcountcount. Additional information about the counted instances is returned in DeepCountingResultDeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_counting_result, which contains a tuple of dictionaries, again one per input image. Note that templates of the objects to be counted must be set beforehand using prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model. Note that the inference time of apply_deep_counting_modelapply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model depends on the number of defined templates in prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model.

Please see the chapter Matching / Deep Counting for further information.

The procedure dev_display_deep_count_results can be used to visualize the detected instances.

The settings 'min_score'"min_score""min_score""min_score""min_score""min_score" and 'max_overlap'"max_overlap""max_overlap""max_overlap""max_overlap""max_overlap" can be used to set the minimum similarity of the instances to the templates as well as the allowed overlap of instances. Details can be found in get_deep_counting_model_paramget_deep_counting_model_paramGetDeepCountingModelParamGetDeepCountingModelParamGetDeepCountingModelParamget_deep_counting_model_param.

The dictionary returned in DeepCountingResultDeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_counting_result contains additional information about the detected and counted object instances. It contains the following keys, where each key contains a tuple of values, one for each detection. If no instances were detected, i.e. the count is 0, those tuples are empty.

'area'"area""area""area""area""area":

Approximate area of the detected templates in pixels.

'row'"row""row""row""row""row", 'column'"column""column""column""column""column":

Approximate location in row and column coordinates of the instances in the input image.

'score'"score""score""score""score""score":

Similarity score of the detected instances, i.e., their approximate similarity with the most similar template provided to prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model.

'template_index'"template_index""template_index""template_index""template_index""template_index":

Index of the template with the highest similarity to the detected instance. This can be used to find out which templates were counted.

'angle'"angle""angle""angle""angle""angle", 'scale'"scale""scale""scale""scale""scale":

The angle and scale of the template with the highest similarity to the detected instance. If rotational or scale augmentations were enabled during the call of prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model, these values can be used to find out which rotation angle and scale creates a template that is most similar to the detected instance.

Attention

System requirements: To run this operator on GPU (see get_deep_counting_model_paramget_deep_counting_model_paramGetDeepCountingModelParamGetDeepCountingModelParamGetDeepCountingModelParamget_deep_counting_model_param), cuDNN and cuBLAS are required. For further details, please refer to the “Installation Guide”, paragraph “Requirements for Deep Learning and Deep-Learning-Based Methods”. Alternatively, this operator can also be run on CPU.

Execution Information

This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.

Parameters

ImageImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte / real)

Input image.

DeepCountingHandleDeepCountingHandleDeepCountingHandleDeepCountingHandledeepCountingHandledeep_counting_handle (input_control)  deep_counting HDlModelCounting, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the Deep Counting model.

CountCountCountCountcountcount (output_control)  integer(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of counted objects.

DeepCountingResultDeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_counting_result (output_control)  dict(-array) HDict, HTupleSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Tuple of result dictionaries.

Result

If the parameters are valid, the operator apply_deep_counting_modelapply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model returns the value 2 ( H_MSG_TRUE) . If necessary, an exception is raised.

Possible Predecessors

create_deep_counting_modelcreate_deep_counting_modelCreateDeepCountingModelCreateDeepCountingModelCreateDeepCountingModelcreate_deep_counting_model, set_deep_counting_model_paramset_deep_counting_model_paramSetDeepCountingModelParamSetDeepCountingModelParamSetDeepCountingModelParamset_deep_counting_model_param, get_deep_counting_model_paramget_deep_counting_model_paramGetDeepCountingModelParamGetDeepCountingModelParamGetDeepCountingModelParamget_deep_counting_model_param, prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model

See also

prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model

Module

Matching