apply_dl_model
— Apply a deep-learning-based network on a set of images for inference.
apply_dl_model( : : DLModelHandle, DLSampleBatch, Outputs : DLResultBatch)
apply_dl_model
applies the deep-learning-based network given
by DLModelHandle
on the batch of input images
handed over through the dictionary DLSampleBatch
.
The operator returns the results in the output dictionary
DLResultBatch
.
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
.
This tuple has to contain exactly 'batch_size' dictionaries,
where dictionary refers to a single image.
You can create such a dictionary conveniently using the procedure
gen_dl_samples_from_images
.
The current value of 'batch_size' can be retrieved using
get_dl_model_param
.
Note that the images might have to be preprocessed before feeding them into
the operator 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 get_dl_model_param
.
The procedure preprocess_dl_dataset
provides guidance on how to
implement such a preprocessing stage.
In Outputs
you can specify which output data you want from your
network in the resulting dictionary DLResultBatch
.
Please see the chapter Deep Learning / Model
for more information to the output dictionary DLResultBatch
and its keys.
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:
the model will return the bounding box coordinates as well as the inferred classes and their confidence values resulting from all levels using an empty tuple '[]' .
Outputs
='segmentation_image' :
DLResultBatch
contains an image where each pixel has a value
corresponding to the class
its corresponding pixel has been assigned to.
Outputs
='segmentation_confidence' :
DLResultBatch
contains an image where each pixel has the
confidence value out of the classification of the according pixel.
Outputs
='[]' :
DLResultBatch
contains all output values.
To run this operator, cuDNN and cuBLAS are required when 'runtime'
is set to 'gpu' , see get_dl_model_param
.
For further details, please refer to the “Installation Guide”
,
paragraph “Requirements for Deep Learning”.
DLModelHandle
(input_control) dl_model →
(handle)
Handle of the deep learning model.
DLSampleBatch
(input_control) dict-array →
(handle)
Input data.
Outputs
(input_control) string-array →
(string)
Requested outputs.
Default value: []
List of values: [], 'segmentation_confidence' , 'segmentation_image'
DLResultBatch
(output_control) dict-array →
(handle)
Handle containing result data.
If the parameters are valid, the operator apply_dl_model
returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.
read_dl_model
,
train_dl_model_batch
,
set_dl_model_param
Deep Learning Training