read_dl_modelT_read_dl_modelReadDlModelReadDlModel (Operator)

Name

read_dl_modelT_read_dl_modelReadDlModelReadDlModel — Read a deep learning model from a file.

Signature

read_dl_model( : : FileName : DLModelHandle)

Herror T_read_dl_model(const Htuple FileName, Htuple* DLModelHandle)

void ReadDlModel(const HTuple& FileName, HTuple* DLModelHandle)

void HDlModel::HDlModel(const HString& FileName)

void HDlModel::HDlModel(const char* FileName)

void HDlModel::HDlModel(const wchar_t* FileName)   (Windows only)

void HDlModel::ReadDlModel(const HString& FileName)

void HDlModel::ReadDlModel(const char* FileName)

void HDlModel::ReadDlModel(const wchar_t* FileName)   (Windows only)

static void HOperatorSet.ReadDlModel(HTuple fileName, out HTuple DLModelHandle)

public HDlModel(string fileName)

void HDlModel.ReadDlModel(string fileName)

Description

The operator read_dl_modelread_dl_modelReadDlModelReadDlModelReadDlModel reads a deep learning model written by write_dl_modelwrite_dl_modelWriteDlModelWriteDlModelWriteDlModel. As a result, the handle DLModelHandleDLModelHandleDLModelHandleDLModelHandleDLModelHandle is returned.

The model is loaded from the file FileNameFileNameFileNameFileNamefileName. This file is hereby searched in the directory $HALCONROOT/dl/ as well as in the currently used directory.

Please note that the runtime specific parameter 'gpu'"gpu""gpu""gpu""gpu" of the model is not read from file. Instead it is initialized with its default value (see get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParam).

HALCON provides pretrained neural networks for classification and semantic segmentation. These neural networks are good starting points to train a custom network. They have been pretrained on a large image dataset. Note, that classification networks can only be read by read_dl_classifierread_dl_classifierReadDlClassifierReadDlClassifierReadDlClassifier. Object detection uses pretrained classifiers as base networks. Hence, the operator create_dl_model_detectioncreate_dl_model_detectionCreateDlModelDetectionCreateDlModelDetectionCreateDlModelDetection should be used in combination with pretrained classifier networks for obejct detection tasks.

The provided pretrained neural networks for semantic segmentation are:

'pretrained_dl_segmentation_compact.hdl'"pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl":

This neural network is designed to handle segmentation tasks with detailed structures and uses only few memory and is runtime efficient.

The network architecture allows changes concerning the image dimensions, but requires a minimum 'image_width'"image_width""image_width""image_width""image_width" and 'image_height'"image_height""image_height""image_height""image_height" of 21 pixels.

'pretrained_dl_segmentation_enhanced.hdl'"pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl":

This neural network has more hidden layers than 'pretrained_dl_segmentation_compact.hdl'"pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl" and is therefore better suited for segmentation tasks including more complex scenes.

The network architecture allows changes concerning the image dimensions, but requires a minimum 'image_width'"image_width""image_width""image_width""image_width" and 'image_height'"image_height""image_height""image_height""image_height" of 81 pixels.

For further explanations to deep learning models in HALCON, see the chapter Deep Learning / Model.

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

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

Filename

Default value: 'pretrained_dl_segmentation_compact.hdl' "pretrained_dl_segmentation_compact.hdl" "pretrained_dl_segmentation_compact.hdl" "pretrained_dl_segmentation_compact.hdl" "pretrained_dl_segmentation_compact.hdl"

List of values: 'pretrained_dl_segmentation_compact.hdl'"pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl""pretrained_dl_segmentation_compact.hdl", 'pretrained_dl_segmentation_enhanced.hdl'"pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl""pretrained_dl_segmentation_enhanced.hdl"

File extension: .hdl

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

Handle of the deep learning model.

Result

If the parameters are valid, the operator read_dl_modelread_dl_modelReadDlModelReadDlModelReadDlModel 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

create_dl_model_detectioncreate_dl_model_detectionCreateDlModelDetectionCreateDlModelDetectionCreateDlModelDetection

Module

Deep Learning Training