Skip to content

set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlpset_regularization_params_ocr_class_mlpT_set_regularization_params_ocr_class_mlp🔗

説明🔗

set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlpSetRegularizationParamsOcrClassMlpset_regularization_params_ocr_class_mlpT_set_regularization_params_ocr_class_mlp — OCR 識別子の正則化パラメーターを設定する。

書式🔗

set_regularization_params_ocr_class_mlp( ocr_mlp OCRHandle, string GenParamName, number GenParamValue )void SetRegularizationParamsOcrClassMlp( const HTuple& OCRHandle, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.SetRegularizationParamsOcrClassMlp( HTuple OCRHandle, HTuple genParamName, HTuple genParamValue )def set_regularization_params_ocr_class_mlp( ocrhandle: HHandle, gen_param_name: str, gen_param_value: MaybeSequence[Union[float, int]] ) -> None

Herror T_set_regularization_params_ocr_class_mlp( const Htuple OCRHandle, const Htuple GenParamName, const Htuple GenParamValue )

void HOCRMlp::SetRegularizationParamsOcrClassMlp( const HString& GenParamName, const HTuple& GenParamValue ) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp( const HString& GenParamName, double GenParamValue ) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp( const char* GenParamName, double GenParamValue ) const

void HOCRMlp::SetRegularizationParamsOcrClassMlp( const wchar_t* GenParamName, double GenParamValue ) const (Windows only)

void HOCRMlp.SetRegularizationParamsOcrClassMlp( string genParamName, HTuple genParamValue )

void HOCRMlp.SetRegularizationParamsOcrClassMlp( string genParamName, double genParamValue )

説明🔗

set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlp は、 OCRHandleOCRHandleocrhandle で渡された OCR 識別子の正則化パラメーターを設定 します。設定する正規化パラメーターは GenParamNamegenParamNamegen_param_name で指定 します。値は GenParamValuegenParamValuegen_param_value で指定します。

create_class_mlpCreateClassMlp で説明したように、OCR 識別子(つまり、 OCR 識別子の MLP)を正則化して、異なるクラス間の信頼度の変化を滑ら かにし、OCR 識別子がトレーニングデータに過剰適合しないようにするこ とが望ましい場合があります。これを実現するために、 GenParamNamegenParamNamegen_param_name を 'weight_prior'"weight_prior" に設定し、 GenParamValuegenParamValuegen_param_value を 0 より大きい値に設定することで、 trainf_ocr_class_mlpTrainfOcrClassMlp の OCR 識別子のトレーニングに、MLP の 重みが大きい場合(クラス間の急激な変化の主な原因になります)のペナ ルティを追加することができます。さらに、正則化パラメーターも自動的 に決定することができます。詳細については、 set_regularization_params_class_mlpSetRegularizationParamsClassMlp を参照してください。正 則化パラメーターを自動的に決定する必要がある場合は、MLP のパラメー ター NumHiddennumHiddennum_hidden とパラメーター 'num_outer_iterations'"num_outer_iterations" の選択方法について、および、OCR 識 別子のトレーニングの実行時に正則化パラメーターを自動的に決定すると きのメモリと実行時間の密接な関係については、 set_regularization_params_class_mlpSetRegularizationParamsClassMlp のアドバイスを参照して ください。

実行情報🔗

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

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

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

このオペレータは以下の入力パラメータの状態を変更します :

このパラメータの値は外部同期なしには複数スレッド間で共有されません。

パラメーター🔗

OCRHandleOCRHandleocrhandle (input_control, 状態が変更されました) ocr_mlp → (handle)HTuple (HHandle)HOCRMlp, HTuple (IntPtr)HHandleHtuple (handle)

OCR 識別子のハンドル

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

返される正則化パラメーター名

初期値: 'weight_prior'"weight_prior"
値のリスト: 'num_inner_iterations', 'num_outer_iterations', 'weight_prior'"num_inner_iterations", "num_outer_iterations", "weight_prior"

GenParamValuegenParamValuegen_param_value (input_control) number(-array) → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)MaybeSequence[Union[float, int]]Htuple (double / Hlong)

正則化パラメーター値

初期値: 1.01.0
推奨値: 0.01, 0.1, 1.0, 10.0, 100.0, 0, 1, 2, 3, 5, 10, 15, 200.01, 0.1, 1.0, 10.0, 100.0, 0, 1, 2, 3, 5, 10, 15, 20

例🔗

(HDevelop)


* This example shows how to determine the regularization parameters
* automatically without examining the convergence of the
* regularization parameters.
* Create the OCR classifier.
read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, \
                      40, 'none', |CharacterNames|, 42, OCRHandle)
* Set up the automatic determination of the regularization
* parameters.
set_regularization_params_ocr_class_mlp (OCRHandle, 'weight_prior', \
                                         [0.01,0.01,0.01,0.01])
set_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'num_outer_iterations', 10)
* Train the classifier.
trainf_ocr_class_mlp (OCRHandle, 'ocr.trf', 100, 1, 0.01, Error, \
                      ErrorLog)
* Read out the estimate of the number of well-determined
* parameters.
get_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'fraction_well_determined_params', \
                                          FractionParams)
* If FractionParams differs substantially from 1, consider reducing
* NumHidden appropriately and consider performing a preprocessing that
* reduces the number of input variables to the net, i.e., canonical
* variates or principal components.
write_ocr_class_mlp (OCRHandle, 'ocr.omc')
 * This example shows how to determine the regularization parameters
* automatically while examining the convergence of the
* regularization parameters.
* Create the OCR classifier.
read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, \
                      40, 'none', |CharacterNames|, 42, OCRHandle)
* Set up the automatic determination of the regularization
* parameters.
set_regularization_params_ocr_class_mlp (OCRHandle, 'weight_prior', \
                                         [0.01,0.01,0.01,0.01])
set_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'num_outer_iterations', 1)
for OuterIt := 1 to 10 by 1
    * Train the classifier.
    trainf_ocr_class_mlp (OCRHandle, 'ocr.trf', 100, 1, 0.01, Error, \
                          ErrorLog)
    * Read out the regularization parameters
    get_regularization_params_ocr_class_mlp (OCRHandle, \
                                             'weight_prior', \
                                             WeightPrior)
    * Inspect the regularization parameters manually for
    * convergence and exit the loop manually if they have
    * converged.
    * [...]
endfor
* Read out the estimate of the number of well-determined
* parameters.
get_regularization_params_ocr_class_mlp (OCRHandle, \
                                         'fraction_well_determined_params', \
                                          FractionParams)
* If FractionParams differs substantially from 1, consider reducing
* NumHidden appropriately and consider performing a preprocessing that
* reduces the number of input variables to the net, i.e., canonical
* variates or principal components.
write_ocr_class_mlp (OCRHandle, 'ocr.omc')

結果🔗

パラメーターが有効ならば、オペレーター set_regularization_params_ocr_class_mlpSetRegularizationParamsOcrClassMlp は値 2 (H_MSG_TRUE) を返しま す。必要に応じて、例外が発生します。

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

組み合わせ

前処理の候補

create_ocr_class_mlpCreateOcrClassMlp

後処理の候補

get_regularization_params_ocr_class_mlpGetRegularizationParamsOcrClassMlp, trainf_ocr_class_mlpTrainfOcrClassMlp

モジュール🔗

OCR/OCV