Skip to content

set_dl_model_layer_weightsSetDlModelLayerWeightsSetDlModelLayerWeightsset_dl_model_layer_weightsT_set_dl_model_layer_weights🔗

説明🔗

set_dl_model_layer_weightsSetDlModelLayerWeightsSetDlModelLayerWeightsset_dl_model_layer_weightsT_set_dl_model_layer_weights — ディープラーニングモデル層の重み(または値)を設定する。

書式🔗

set_dl_model_layer_weights( image Weights, dl_model DLModelHandle, string LayerName, string WeightsType )void SetDlModelLayerWeights( const HObject& Weights, const HTuple& DLModelHandle, const HTuple& LayerName, const HTuple& WeightsType )static void HOperatorSet.SetDlModelLayerWeights( HObject weights, HTuple DLModelHandle, HTuple layerName, HTuple weightsType )def set_dl_model_layer_weights( weights: HObject, dlmodel_handle: HHandle, layer_name: str, weights_type: str ) -> None

Herror T_set_dl_model_layer_weights( const Hobject Weights, const Htuple DLModelHandle, const Htuple LayerName, const Htuple WeightsType )

void HDlModel::SetDlModelLayerWeights( const HImage& Weights, const HString& LayerName, const HString& WeightsType ) const

void HDlModel::SetDlModelLayerWeights( const HImage& Weights, const char* LayerName, const char* WeightsType ) const

void HDlModel::SetDlModelLayerWeights( const HImage& Weights, const wchar_t* LayerName, const wchar_t* WeightsType ) const (Windows only)

void HDlModel.SetDlModelLayerWeights( HImage weights, string layerName, string weightsType )

説明🔗

オペレータset_dl_model_layer_weightsSetDlModelLayerWeights は、モデルDLModelHandleDLModelHandledlmodel_handleの 指定されたLayerNamelayerNamelayer_nameにWeightsweightsweightsを設定します。

パラメータ WeightsTypeweightsTypeweights_type は、設定する層値のタイプを決定します。 設定可能な値に関して、get_dl_model_layer_weightsGetDlModelLayerWeightsを参照ください。

注意🔗

オペレータset_dl_model_layer_weightsSetDlModelLayerWeights はユーザが独自に作成したネットワークにのみ適応できます。 HALCONによって配布されるネットワークの場合、このオペレータは影響を与えません。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • 並列演算処理には未対応

パラメーター🔗

Weightsweightsweights (input_object) (multichannel-)image(-array) → object (real)HObject (real)HImage (real)HObject (real)Hobject (real)

入力する重み

DLModelHandleDLModelHandledlmodel_handle (input_control) dl_model → (handle)HTuple (HHandle)HDlModel, HTuple (IntPtr)HHandleHtuple (handle)

ディープラーニングモデルのハンドル

LayerNamelayerNamelayer_name (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

重みを設定する層名

WeightsTypeweightsTypeweights_type (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

設定する層のタイプ

初期値: 'weights'"weights"
値のリスト: 'batchnorm_mean', 'batchnorm_mean_avg', 'batchnorm_variance', 'batchnorm_variance_avg', 'bias', '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')

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

create_dl_modelCreateDlModel, get_dl_model_layer_weightsGetDlModelLayerWeights

後処理の候補

get_dl_model_layer_weightsGetDlModelLayerWeights

モジュール🔗

このオペレーターは、動的ライセンスを使用します (「インストールガイド」を参照してください)。次のモジュールのどれが必要かは、オペレーターの特定の使用法によって異なります:

Deep Learning Professional