set_dl_model_layer_weights🔗
説明🔗
set_dl_model_layer_weights — ディープラーニングモデル層の重み(または値)を設定する。
書式🔗
set_dl_model_layer_weights( image Weights, dl_model DLModelHandle, string LayerName, string WeightsType )
説明🔗
オペレータset_dl_model_layer_weights は、モデルDLModelHandleの
指定されたLayerNameにWeightsを設定します。
パラメータ WeightsType は、設定する層値のタイプを決定します。
設定可能な値に関して、get_dl_model_layer_weightsを参照ください。
注意🔗
オペレータset_dl_model_layer_weights はユーザが独自に作成したネットワークにのみ適応できます。
HALCONによって配布されるネットワークの場合、このオペレータは影響を与えません。
実行情報🔗
実行情報
-
マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)
-
マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)
-
並列演算処理には未対応
パラメーター🔗
Weights (input_object) (multichannel-)image(-array) → object (real)
入力する重み
DLModelHandle (input_control) dl_model → (handle)
ディープラーニングモデルのハンドル
LayerName (input_control) string → (string)
重みを設定する層名
WeightsType (input_control) string → (string)
設定する層のタイプ
初期値: 'weights'
値のリスト: 'batchnorm_mean', 'batchnorm_mean_avg', 'batchnorm_variance', 'batchnorm_variance_avg', 'bias', 'weights'
例🔗
(HDevelop)
* Create weights for a convolution layer.
gen_image_const (Weights, 'real', 1, 1)
paint_region (Weights, Weights, Weights, 1, 'fill')
gen_empty_obj (WeightsArray)
for Index := 0 to 10 by 1
concat_obj (WeightsArray, Weights, WeightsArray)
endfor
*
* Input image with rows consisting of 1s to 10s.
gen_image_const (Image, 'real', 10, 10)
for Index := 0 to 9 by 1
gen_rectangle1 (Rectangle, Index, 0, Index, 9)
paint_region (Rectangle, Image, Image, Index + 1, 'fill')
endfor
*
* Create a small model network.
create_dl_layer_input ('image', [10, 2, 1], [], [], ImageNode)
create_dl_layer_convolution (ImageNode, 'conv', 1, 1, 2, 11, 1, 'none', \
'none', [], [], ConvNode)
create_dl_layer_zoom_factor (ConvNode, 'zoom', 2, 2, 'bilinear', 'true', [],\
[], ZoomNode)
create_dl_model (ZoomNode, DLModelHandle)
set_dl_model_param (DLModelHandle, 'runtime', 'cpu')
*
* Set the weights to the convolution layer.
set_dl_model_layer_weights (WeightsArray, DLModelHandle, 'conv', 'weights')
他のオペレーターとの組み合わせ🔗
モジュール🔗
このオペレーターは、動的ライセンスを使用します (「インストールガイド」を参照してください)。次のモジュールのどれが必要かは、オペレーターの特定の使用法によって異なります:
Deep Learning Professional