trainf_ocr_class_svm_protectedT_trainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected (算子)
名称
trainf_ocr_class_svm_protectedT_trainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected — 使用(受保护的)训练文件中的数据训练 OCR 分类器。
签名
void TrainfOcrClassSvmProtected(const HTuple& OCRHandle, const HTuple& TrainingFile, const HTuple& Password, const HTuple& Epsilon, const HTuple& TrainMode)
void HOCRSvm::TrainfOcrClassSvmProtected(const HTuple& TrainingFile, const HTuple& Password, double Epsilon, const HTuple& TrainMode) const
void HOCRSvm::TrainfOcrClassSvmProtected(const HString& TrainingFile, const HString& Password, double Epsilon, const HString& TrainMode) const
void HOCRSvm::TrainfOcrClassSvmProtected(const char* TrainingFile, const char* Password, double Epsilon, const char* TrainMode) const
void HOCRSvm::TrainfOcrClassSvmProtected(const wchar_t* TrainingFile, const wchar_t* Password, double Epsilon, const wchar_t* TrainMode) const
(
Windows only)
static void HOperatorSet.TrainfOcrClassSvmProtected(HTuple OCRHandle, HTuple trainingFile, HTuple password, HTuple epsilon, HTuple trainMode)
void HOCRSvm.TrainfOcrClassSvmProtected(HTuple trainingFile, HTuple password, double epsilon, HTuple trainMode)
void HOCRSvm.TrainfOcrClassSvmProtected(string trainingFile, string password, double epsilon, string trainMode)
描述
trainf_ocr_class_svm_protectedtrainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected trains the OCR classifier
OCRHandleOCRHandleOCRHandleOCRHandleOCRHandleocrhandle with the training data stored in the OCR
training files given by TrainingFileTrainingFileTrainingFileTrainingFiletrainingFiletraining_file. Its functionality
corresponds to the functionality of trainf_ocr_class_svmtrainf_ocr_class_svmTrainfOcrClassSvmTrainfOcrClassSvmTrainfOcrClassSvmtrainf_ocr_class_svm,
with the addition that trainf_ocr_class_svm_protectedtrainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected
can process unprotected and protected training files. Protected
training files can be used only with the correct user password
PasswordPasswordPasswordPasswordpasswordpassword. If the number of passwords PasswordPasswordPasswordPasswordpasswordpassword
equals 1, then every input file TrainingFileTrainingFileTrainingFileTrainingFiletrainingFiletraining_file is checked
with that password, otherwise the number of passwords has to be
equal to the number of input files and the input file at position
n is checked with the password at position n. For unprotected
training files the passwords are ignored.
For a more detailed description of the operator's functionality see
trainf_ocr_class_svmtrainf_ocr_class_svmTrainfOcrClassSvmTrainfOcrClassSvmTrainfOcrClassSvmtrainf_ocr_class_svm。The concept of protecting OCR training
data in HALCON is described in protect_ocr_trainfprotect_ocr_trainfProtectOcrTrainfProtectOcrTrainfProtectOcrTrainfprotect_ocr_trainf。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
此算子修改后续输入参数的状态:
在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。
参数
OCRHandleOCRHandleOCRHandleOCRHandleOCRHandleocrhandle (输入控制,状态被修改) ocr_svm → HOCRSvm, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the OCR classifier.
TrainingFileTrainingFileTrainingFileTrainingFiletrainingFiletraining_file (输入控制) filename.read(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Names of the training files.
默认值:
'ocr.trf'
"ocr.trf"
"ocr.trf"
"ocr.trf"
"ocr.trf"
"ocr.trf"
File extension:
.trf, .otr
PasswordPasswordPasswordPasswordpasswordpassword (输入控制) string(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Passwords for protected training files.
EpsilonEpsilonEpsilonEpsilonepsilonepsilon (输入控制) real → HTuplefloatHTupleHtuple (real) (double) (double) (double)
Stop parameter for training.
默认值:
0.001
建议值:
0.00001, 0.0001, 0.001, 0.01, 0.1
TrainModeTrainModeTrainModeTrainModetrainModetrain_mode (输入控制) number → HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Mode of training.
默认值:
'default'
"default"
"default"
"default"
"default"
"default"
值列表:
'add_sv_to_train_set'"add_sv_to_train_set""add_sv_to_train_set""add_sv_to_train_set""add_sv_to_train_set""add_sv_to_train_set", 'default'"default""default""default""default""default"
结果
如果参数有效,算子 trainf_ocr_class_svm_protectedtrainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
trainf_ocr_class_svm_protectedtrainf_ocr_class_svm_protectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedTrainfOcrClassSvmProtectedtrainf_ocr_class_svm_protected may return the error 9211 (Matrix is
not positive definite) if PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing =
'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates""canonical_variates" is used. This typically indicates
that not enough training samples have been stored for each class.
In this case we recommend to change PreprocessingPreprocessingPreprocessingPreprocessingpreprocessingpreprocessing to
'normalization'"normalization""normalization""normalization""normalization""normalization". Another solution can be to add more
training samples.
可能的前趋
create_ocr_class_svmcreate_ocr_class_svmCreateOcrClassSvmCreateOcrClassSvmCreateOcrClassSvmcreate_ocr_class_svm,
write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainfWriteOcrTrainfwrite_ocr_trainf,
append_ocr_trainfappend_ocr_trainfAppendOcrTrainfAppendOcrTrainfAppendOcrTrainfappend_ocr_trainf,
write_ocr_trainf_imagewrite_ocr_trainf_imageWriteOcrTrainfImageWriteOcrTrainfImageWriteOcrTrainfImagewrite_ocr_trainf_image,
protect_ocr_trainfprotect_ocr_trainfProtectOcrTrainfProtectOcrTrainfProtectOcrTrainfprotect_ocr_trainf
可能的后继
do_ocr_single_class_svmdo_ocr_single_class_svmDoOcrSingleClassSvmDoOcrSingleClassSvmDoOcrSingleClassSvmdo_ocr_single_class_svm,
do_ocr_multi_class_svmdo_ocr_multi_class_svmDoOcrMultiClassSvmDoOcrMultiClassSvmDoOcrMultiClassSvmdo_ocr_multi_class_svm,
write_ocr_class_svmwrite_ocr_class_svmWriteOcrClassSvmWriteOcrClassSvmWriteOcrClassSvmwrite_ocr_class_svm
替代
read_ocr_class_svmread_ocr_class_svmReadOcrClassSvmReadOcrClassSvmReadOcrClassSvmread_ocr_class_svm
另见
trainf_ocr_class_svmtrainf_ocr_class_svmTrainfOcrClassSvmTrainfOcrClassSvmTrainfOcrClassSvmtrainf_ocr_class_svm,
train_class_svmtrain_class_svmTrainClassSvmTrainClassSvmTrainClassSvmtrain_class_svm
模块
光学字符识别/光学字符验证