load_dl_model_weightsT_load_dl_model_weightsLoadDlModelWeightsLoadDlModelWeightsload_dl_model_weights (Operator)

Name

load_dl_model_weightsT_load_dl_model_weightsLoadDlModelWeightsLoadDlModelWeightsload_dl_model_weights — Load the weights of a source model into a target model.

Signature

load_dl_model_weights( : : DLModelHandleSource, DLModelHandleTarget : ChangesByLayer)

Herror T_load_dl_model_weights(const Htuple DLModelHandleSource, const Htuple DLModelHandleTarget, Htuple* ChangesByLayer)

void LoadDlModelWeights(const HTuple& DLModelHandleSource, const HTuple& DLModelHandleTarget, HTuple* ChangesByLayer)

HTuple HDlModel::LoadDlModelWeights(const HDlModel& DLModelHandleTarget) const

static void HOperatorSet.LoadDlModelWeights(HTuple DLModelHandleSource, HTuple DLModelHandleTarget, out HTuple changesByLayer)

HTuple HDlModel.LoadDlModelWeights(HDlModel DLModelHandleTarget)

def load_dl_model_weights(dlmodel_handle_source: HHandle, dlmodel_handle_target: HHandle) -> Sequence[int]

def load_dl_model_weights_s(dlmodel_handle_source: HHandle, dlmodel_handle_target: HHandle) -> int

Description

The operator load_dl_model_weightsload_dl_model_weightsLoadDlModelWeightsLoadDlModelWeightsLoadDlModelWeightsload_dl_model_weights loads weights of a source model DLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourcedlmodel_handle_source into a target model DLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetdlmodel_handle_target. Thereby applies for every layer in the target model: Its weights are only changed if there is a layer in the source model having the same name and the same weight-shape. Note that DLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourcedlmodel_handle_source must be different from DLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetdlmodel_handle_target, i.e., you cannot use the same model handle as source and target.

ChangesByLayerChangesByLayerChangesByLayerChangesByLayerchangesByLayerchanges_by_layer is a tuple indicating for every target layer how many weights changed. Its entries are sorted by ascending layer IDs. The layer IDs can be queried via the operator get_dl_model_paramget_dl_model_paramGetDlModelParamGetDlModelParamGetDlModelParamget_dl_model_param with the parameter 'summary'"summary""summary""summary""summary""summary".

Note, that 'weights' means all weights and biases for all layers which can have such values (e.g., convolutional layer, batch normalization layer, etc.).

Attention

The operator load_dl_model_weightsload_dl_model_weightsLoadDlModelWeightsLoadDlModelWeightsLoadDlModelWeightsload_dl_model_weights is only applicable to self-created networks. For networks delivered by HALCON, the operator is not working.

Execution Information

Parameters

DLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourceDLModelHandleSourcedlmodel_handle_source (input_control)  dl_model HDlModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the source deep learning model.

DLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetDLModelHandleTargetdlmodel_handle_target (input_control)  dl_model HDlModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the target deep learning model.

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

Indicates for every target layer how many weights changed.

Result

If the parameters are valid, the operator load_dl_model_weightsload_dl_model_weightsLoadDlModelWeightsLoadDlModelWeightsLoadDlModelWeightsload_dl_model_weights returns the value TRUE. If necessary, an exception is raised.

Module

Deep Learning Training