load_dl_model_weights — 将源模型的权重加载到目标模型中。
load_dl_model_weights( : : DLModelHandleSource, DLModelHandleTarget : ChangesByLayer)
算子 load_dl_model_weights loads weights of a source model
DLModelHandleSource into a target model DLModelHandleTarget.
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 DLModelHandleSource must be different from
DLModelHandleTarget, i.e., you cannot use the same model handle as
source and target.
ChangesByLayer 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_param with the parameter
'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.).
算子 load_dl_model_weights is only applicable to self-created
networks. For networks delivered by HALCON, the operator is not working.
DLModelHandleSource (输入控制) dl_model → (handle)
Handle of the source deep learning model.
DLModelHandleTarget (输入控制) dl_model → (handle)
Handle of the target deep learning model.
ChangesByLayer (输出控制) integer(-array) → (integer)
Indicates for every target layer how many weights changed.
如果参数有效,算子 load_dl_model_weights 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
深度学习训练