create_dl_model_detectionT_create_dl_model_detectionCreateDlModelDetectionCreateDlModelDetection (Operator)

Name

create_dl_model_detectionT_create_dl_model_detectionCreateDlModelDetectionCreateDlModelDetection — Create a deep learning network for object detection.

Signature

create_dl_model_detection( : : Backbone, NumClasses, DLModelDetectionParam : DLModelHandle)

Herror T_create_dl_model_detection(const Htuple Backbone, const Htuple NumClasses, const Htuple DLModelDetectionParam, Htuple* DLModelHandle)

void CreateDlModelDetection(const HTuple& Backbone, const HTuple& NumClasses, const HTuple& DLModelDetectionParam, HTuple* DLModelHandle)

void HDlModel::HDlModel(const HString& Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)

void HDlModel::HDlModel(const char* Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)

void HDlModel::HDlModel(const wchar_t* Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)   (Windows only)

void HDlModel::CreateDlModelDetection(const HString& Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)

void HDlModel::CreateDlModelDetection(const char* Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)

void HDlModel::CreateDlModelDetection(const wchar_t* Backbone, Hlong NumClasses, const HDict& DLModelDetectionParam)   (Windows only)

static void HOperatorSet.CreateDlModelDetection(HTuple backbone, HTuple numClasses, HTuple DLModelDetectionParam, out HTuple DLModelHandle)

public HDlModel(string backbone, int numClasses, HDict DLModelDetectionParam)

void HDlModel.CreateDlModelDetection(string backbone, int numClasses, HDict DLModelDetectionParam)

Description

With the operator create_dl_model_detectioncreate_dl_model_detectionCreateDlModelDetectionCreateDlModelDetectionCreateDlModelDetection a deep learning network for object detection is created. See the chapter Deep Learning / Object Detection for further information on object detection based on deep-learning. The handle of this network is returned in DLModelHandleDLModelHandleDLModelHandleDLModelHandleDLModelHandle.

You can specify your model and its architecture over the parameters listed below. To successfully create a detection model, you need to specify its backbone and the number of classes the model shall be able to distinguish. The first information is handed over through the parameter BackboneBackboneBackboneBackbonebackbone which is explained below in the section “Possible Backbones”. The second information is given through the parameter NumClassesNumClassesNumClassesNumClassesnumClasses. Note, this parameter fixes the number of classes the network will distinguish and therewith also the number of entries in 'class_ids'"class_ids""class_ids""class_ids""class_ids".

The values of all other applicable parameters can be specified using the dictionary DLModelDetectionParamDLModelDetectionParamDLModelDetectionParamDLModelDetectionParamDLModelDetectionParam. A list of parameters that can be set is given below in the section “Settable Parameters”. In case a parameter is not specified, the default value is taken to create the model. Note, parameters influencing the network architecture will not be changeable anymore once the network has been created. All the other parameters can still be set or changed using the operator set_dl_model_paramset_dl_model_paramSetDlModelParamSetDlModelParamSetDlModelParam. An overview, how parameters can be set is given in get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam, where also a description of the specific parameters is provided. After creating the object detection model, the typetypetypetypetype will automatically be set to 'detection'"detection""detection""detection""detection".

Possible Backbones

The parameter BackboneBackboneBackboneBackbonebackbone determines the backbone your network will use. See the chapter Deep Learning / Object Detection for more information to the backbone. In short, the backbone consists of a pretrained classifier, from which only the layers generating the feature maps are kept. This implies that you read in a classifier as feature extractor for the subsequent detection network. Hence, there are no fully connected layers anymore in the network.

create_dl_model_detectioncreate_dl_model_detectionCreateDlModelDetectionCreateDlModelDetectionCreateDlModelDetection attaches a feature pyramid on the backbone. This feature pyramid has a minimal number of levels depending on the backbone, given in the list below. The network architectures allow changes concerning the image dimensions, but as for every level the image lengths are halved, the dimensions 'image_width'"image_width""image_width""image_width""image_width" and 'image_height'"image_height""image_height""image_height""image_height" need to be an integer multiple of . Here, is the highest level up to which the feature pyramid is built. For every backbone, has a minimal value (see the list below), which can be increased through the parameter max_levelmax_levelmax_levelmax_levelmaxLevel.

HALCON provides the following pretrained classifiers you can read in as backbone:

'pretrained_dl_classifier_compact.hdl'"pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl":

This neural network is designed to be memory and runtime efficient.

This backbone expects the images to be of the type 'real'"real""real""real""real". Additionally, the backbone is designed for certain image properties. The corresponding values can be retrieved with get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam. Here we list the default values with which the classifier has been trained:

'image_width': 224

'image_height': 224

'image_num_channels': 3

'image_range_min': -127

'image_range_max': 128

The feature pyramid built on this backbone goes at least up to level 4.

'pretrained_dl_classifier_enhanced.hdl'"pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl":

This neural network has more hidden layers than 'pretrained_dl_classifier_compact.hdl'"pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl" and is therefore assumed to be better suited for more complex tasks. But this comes at the cost of being more time and memory demanding.

This network expects the images to be of the type 'real'"real""real""real""real". Additionally, the backbone is designed for certain image properties. The corresponding values can be retrieved with get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam. Here we list the default values with which the classifier has been trained:

'image_width': 224

'image_height': 224

'image_num_channels': 3

'image_range_min': -127

'image_range_max': 128

The feature pyramid built on this backbone goes at least up to level 5.

'pretrained_dl_classifier_resnet50.hdl'"pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl":

As the network 'pretrained_dl_classifier_enhanced.hdl'"pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl", this network is suited for more complex tasks. But its structure differs, bringing the advantage of making the training more stable and being internally more robust.

This network expects the images to be of the type 'real'"real""real""real""real". Additionally, the backbone is designed for certain image properties. The corresponding values can be retrieved with get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam. Here we list the default values with which the classifier has been trained:

'image_width': 224

'image_height': 224

'image_num_channels': 3

'image_range_min': -127

'image_range_max': 128

The feature pyramid built on this backbone goes at least up to level 5.

Settable Parameters

Parameters you can set for your model when creating it using create_dl_model_detectioncreate_dl_model_detectionCreateDlModelDetectionCreateDlModelDetectionCreateDlModelDetection (see get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam for explanations):

Attention

To successfully set 'gpu'"gpu""gpu""gpu""gpu" parameters, cuDNN and cuBLAS are required, i.e., to set the parameter GenParamNameGenParamNameGenParamNameGenParamNamegenParamName 'runtime'"runtime""runtime""runtime""runtime" to 'gpu'"gpu""gpu""gpu""gpu". For further details, please refer to the “Installation Guide”, paragraph “Requirements for Deep Learning”.

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

BackboneBackboneBackboneBackbonebackbone (input_control)  filename.read HTupleHTupleHtuple (string) (string) (HString) (char*)

Deep learning classifier, used as backbone network.

Default value: 'pretrained_dl_classifier_compact.hdl' "pretrained_dl_classifier_compact.hdl" "pretrained_dl_classifier_compact.hdl" "pretrained_dl_classifier_compact.hdl" "pretrained_dl_classifier_compact.hdl"

List of values: 'pretrained_dl_classifier_compact.hdl'"pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl""pretrained_dl_classifier_compact.hdl", 'pretrained_dl_classifier_enhanced.hdl'"pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl""pretrained_dl_classifier_enhanced.hdl", 'pretrained_dl_classifier_resnet50.hdl'"pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl""pretrained_dl_classifier_resnet50.hdl"

File extension: .hdl

NumClassesNumClassesNumClassesNumClassesnumClasses (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of classes.

Default value: 3

DLModelDetectionParamDLModelDetectionParamDLModelDetectionParamDLModelDetectionParamDLModelDetectionParam (input_control)  dict HDict, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Parameters for the object detection model.

Default value: []

DLModelHandleDLModelHandleDLModelHandleDLModelHandleDLModelHandle (output_control)  dl_model HDlModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Deep learning model for object detection.

Result

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

Possible Successors

set_dl_model_paramset_dl_model_paramSetDlModelParamSetDlModelParamSetDlModelParam, get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam, apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelApplyDlModel, train_dl_model_batchtrain_dl_model_batchTrainDlModelBatchTrainDlModelBatchTrainDlModelBatch

Alternatives

read_dl_modelread_dl_modelReadDlModelReadDlModelReadDlModel

Module

Deep Learning Training