Operator Reference

apply_deep_counting_modelT_apply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model (Operator)

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_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model applies the Deep Counting model given by DeepCountingHandleDeepCountingHandleDeepCountingHandledeepCountingHandledeep_counting_handle on the tuple of input images ImageImageImageimageimage. A tuple with the number of found instances per input image is returned in CountCountCountcountcount. Additional information about the counted instances is returned in DeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_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_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model. Note that the inference time of apply_deep_counting_modelapply_deep_counting_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model depends on the number of defined templates in prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_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" and '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_paramGetDeepCountingModelParamGetDeepCountingModelParamget_deep_counting_model_param.

The dictionary returned in DeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_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":

Approximate area of the detected templates in pixels.

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

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

'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_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model.

'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", '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_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_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

Deep Counting does not take into account whether an image has a reduced domain.

System requirements: To run this operator on GPU (see get_deep_counting_model_paramget_deep_counting_model_paramGetDeepCountingModelParamGetDeepCountingModelParamget_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

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on internal data level.

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

ImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte / real)

Input image.

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

Handle of the Deep Counting model.

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

Number of counted objects.

DeepCountingResultDeepCountingResultDeepCountingResultdeepCountingResultdeep_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_modelApplyDeepCountingModelApplyDeepCountingModelapply_deep_counting_model returns the value 2 ( H_MSG_TRUE) . If necessary, an exception is raised.

Possible Predecessors

create_deep_counting_modelcreate_deep_counting_modelCreateDeepCountingModelCreateDeepCountingModelcreate_deep_counting_model, set_deep_counting_model_paramset_deep_counting_model_paramSetDeepCountingModelParamSetDeepCountingModelParamset_deep_counting_model_param, get_deep_counting_model_paramget_deep_counting_model_paramGetDeepCountingModelParamGetDeepCountingModelParamget_deep_counting_model_param, prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model

See also

prepare_deep_counting_modelprepare_deep_counting_modelPrepareDeepCountingModelPrepareDeepCountingModelprepare_deep_counting_model

Module

Matching