apply_dl_model — Apply a deep-learning-based network on a set of images for inference.
apply_dl_model applies the deep-learning-based network given
DLModelHandle on the batch of input images
handed over through the tuple of dictionaries
The operator returns
DLResultBatch, a tuple with a result
DLResult for every input image.
Please see the chapter Deep Learning / Model for more information on the concept and the dictionaries of the deep learning model in HALCON.
In order to apply the network on images, you have to hand them over
through a tuple of dictionaries
DLSampleBatch, where a dictionary
refers to a single image. You can create such a dictionary conveniently
using the procedure
gen_dl_samples_from_images. The tuple
DLSampleBatch can contain an arbitrary number of
dictionaries. The operator
apply_dl_model always processes
a batch with up to 'batch_size' images simultaneously.
In case the tuple contains more images,
over the necessary number of batches internally. For a
DLSampleBatch with less than 'batch_size' images,
the tuple is padded to a full batch which means that the time required
to process a
DLSampleBatch is independent of whether the
batch is filled up or just consists of a single image. This also means
that if fewer images than 'batch_size' are processed in one
operator call, the network still requires the same amount of memory as
for a full batch. The current value of 'batch_size' can be
Note that the images might have to be preprocessed before feeding them into
apply_dl_model in order to fulfill the network
requirements. You can retrieve the current requirements of your network,
such as e.g., the image dimensions, using
preprocess_dl_dataset provides guidance on how to
implement such a preprocessing stage.
The results are returned in
DLResultBatch, a tuple with a
DLResult for every input image.
Please see the chapter Deep Learning / Model
for more information to the output dictionaries in
and their keys.
Outputs you can specify, which output data is returned in
Outputs can be a single string, a tuple of strings, or
an empty tuple with which you retrieve all possible outputs.
The values depend on the model type of your network:
contains an image where each pixel has the score of the according input
image pixel. Additionally it contains a score for the entire image.
DLResult contains a
tuple with confidence values in descending order and tuples with the
class names and class IDs sorted accordingly.
the bounding box coordinates as well as the inferred classes and their
confidence values resulting from all levels.
'[bboxhead + level + _predicton, classhead + level + _prediction]',
where 'level' stands for the selected level which lies
between 'min_level' and 'max_level':
DLResult contains the bounding box coordinates as well
as the inferred classes and their confidence values resulting from
DLResult contains an image where each pixel has a value
corresponding to the class
its corresponding pixel has been assigned to.
DLResult contains an image where each pixel has the
confidence value out of the classification of the according pixel.
DLResult contains all output values.
To run this operator, cuDNN and cuBLAS are required when 'runtime'
is set to 'gpu', see
For further details, please refer to the
paragraph “Requirements for Deep Learning”.
This operator supports cancelling timeouts and interrupts.
This operator supports breaking timeouts and interrupts.
Handle of the deep learning model.
Default value: 
List of values: , 'bboxhead2_prediction', 'classhead2_prediction', 'segmentation_confidence', 'segmentation_image'
Handle containing result data.
If the parameters are valid, the operator
returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
Deep Learning Inference