select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtectedSelectFeatureSetTrainfSvmProtectedselect_feature_set_trainf_svm_protectedT_select_feature_set_trainf_svm_protected
Short description
select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtectedSelectFeatureSetTrainfSvmProtectedselect_feature_set_trainf_svm_protectedT_select_feature_set_trainf_svm_protected β Select an optimal combination of features to classify OCR data
from a (protected) training file.
Signature
select_feature_set_trainf_svm_protected( filename.read TrainingFile, string Password, string FeatureList, string SelectionMethod, integer Width, integer Height, string GenParamName, number GenParamValue, out ocr_svm OCRHandle, out string FeatureSet, out real Score )void SelectFeatureSetTrainfSvmProtected( const HTuple& TrainingFile, const HTuple& Password, const HTuple& FeatureList, const HTuple& SelectionMethod, const HTuple& Width, const HTuple& Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* OCRHandle, HTuple* FeatureSet, HTuple* Score )static void HOperatorSet.SelectFeatureSetTrainfSvmProtected( HTuple trainingFile, HTuple password, HTuple featureList, HTuple selectionMethod, HTuple width, HTuple height, HTuple genParamName, HTuple genParamValue, out HTuple OCRHandle, out HTuple featureSet, out HTuple score )def select_feature_set_trainf_svm_protected( training_file: MaybeSequence[str], password: MaybeSequence[str], feature_list: MaybeSequence[str], selection_method: str, width: int, height: int, gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, str, float]] ) -> Tuple[HHandle, Sequence[str], Sequence[float]]
Herror T_select_feature_set_trainf_svm_protected( const Htuple TrainingFile, const Htuple Password, const Htuple FeatureList, const Htuple SelectionMethod, const Htuple Width, const Htuple Height, const Htuple GenParamName, const Htuple GenParamValue, Htuple* OCRHandle, Htuple* FeatureSet, Htuple* Score )
HTuple HOCRSvm::SelectFeatureSetTrainfSvmProtected( const HTuple& TrainingFile, const HTuple& Password, const HTuple& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score )
HTuple HOCRSvm::SelectFeatureSetTrainfSvmProtected( const HString& TrainingFile, const HString& Password, const HString& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score )
HTuple HOCRSvm::SelectFeatureSetTrainfSvmProtected( const char* TrainingFile, const char* Password, const char* FeatureList, const char* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score )
HTuple HOCRSvm::SelectFeatureSetTrainfSvmProtected( const wchar_t* TrainingFile, const wchar_t* Password, const wchar_t* FeatureList, const wchar_t* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score ) (Windows only)
HTuple HOCRSvm.SelectFeatureSetTrainfSvmProtected( HTuple trainingFile, HTuple password, HTuple featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score )
HTuple HOCRSvm.SelectFeatureSetTrainfSvmProtected( string trainingFile, string password, string featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score )
Description
select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtected selects an optimal
combination of features to classify the data given in the training files
TrainingFiletrainingFiletraining_file with a support vector machine (SVM). Its functionality
corresponds to the functionality of select_feature_set_trainf_svmSelectFeatureSetTrainfSvm,
with the addition that select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtected
can process unprotected and protected training files. Protected
training files can be used only with the correct user password
Passwordpasswordpassword. If the number of passwords Passwordpasswordpassword
equals 1, then every input file TrainingFiletrainingFiletraining_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
select_feature_set_trainf_svmSelectFeatureSetTrainfSvm. The concept of protecting OCR
training data in HALCON is described in protect_ocr_trainfProtectOcrTrainf.
Attention
This operator may take considerable time, depending on the size of the
data set in the training file, and the number of features.
Please note, that this operator should not be called, if only a small
set of training data is available. Due to the risk of overfitting the
operator select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtected may deliver a
classifier with a very high score. However, the classifier may perform
poorly when tested.
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Automatically parallelized on internal data level.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Parameters
TrainingFiletrainingFiletraining_file (input_control) filename.read(-array) β (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)
Names of the training files.
Default: ''""
File extension: .trf, .otr
Passwordpasswordpassword (input_control) string(-array) β (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)
Passwords for protected training files.
FeatureListfeatureListfeature_list (input_control) string(-array) β (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)
List of features that should be considered for selection.
Default: ['zoom_factor', 'ratio', 'width', 'height', 'foreground', 'foreground_grid_9', 'foreground_grid_16', 'anisometry', 'compactness', 'convexity', 'moments_region_2nd_invar', 'moments_region_2nd_rel_invar', 'moments_region_3rd_invar', 'moments_central', 'phi', 'num_connect', 'num_holes', 'projection_horizontal', 'projection_vertical', 'projection_horizontal_invar', 'projection_vertical_invar', 'chord_histo', 'num_runs', 'pixel', 'pixel_invar', 'pixel_binary', 'gradient_8dir', 'cooc', 'moments_gray_plane']["zoom_factor", "ratio", "width", "height", "foreground", "foreground_grid_9", "foreground_grid_16", "anisometry", "compactness", "convexity", "moments_region_2nd_invar", "moments_region_2nd_rel_invar", "moments_region_3rd_invar", "moments_central", "phi", "num_connect", "num_holes", "projection_horizontal", "projection_vertical", "projection_horizontal_invar", "projection_vertical_invar", "chord_histo", "num_runs", "pixel", "pixel_invar", "pixel_binary", "gradient_8dir", "cooc", "moments_gray_plane"]
List of values: 'anisometry', 'chord_histo', 'compactness', 'convexity', 'cooc', 'default', 'foreground', 'foreground_grid_16', 'foreground_grid_9', 'gradient_8dir', 'height', 'moments_central', 'moments_gray_plane', 'moments_region_2nd_invar', 'moments_region_2nd_rel_invar', 'moments_region_3rd_invar', 'num_connect', 'num_holes', 'num_runs', 'phi', 'pixel', 'pixel_binary', 'pixel_invar', 'projection_horizontal', 'projection_horizontal_invar', 'projection_vertical', 'projection_vertical_invar', 'ratio', 'width', 'zoom_factor'"anisometry", "chord_histo", "compactness", "convexity", "cooc", "default", "foreground", "foreground_grid_16", "foreground_grid_9", "gradient_8dir", "height", "moments_central", "moments_gray_plane", "moments_region_2nd_invar", "moments_region_2nd_rel_invar", "moments_region_3rd_invar", "num_connect", "num_holes", "num_runs", "phi", "pixel", "pixel_binary", "pixel_invar", "projection_horizontal", "projection_horizontal_invar", "projection_vertical", "projection_vertical_invar", "ratio", "width", "zoom_factor"
SelectionMethodselectionMethodselection_method (input_control) string β (string)HTuple (HString)HTuple (string)strHtuple (char*)
Method to perform the selection.
Default: 'greedy'"greedy"
List of values: 'greedy', 'greedy_oscillating'"greedy", "greedy_oscillating"
Widthwidthwidth (input_control) integer β (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
Width of the rectangle to which the gray values
of the segmented character are zoomed.
Default: 1515
Heightheightheight (input_control) integer β (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
Height of the rectangle to which the gray values
of the segmented character are zoomed.
Default: 1616
GenParamNamegenParamNamegen_param_name (input_control) string-array β (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)
Names of generic parameters to configure the selection
process and the classifier.
Default: [][]
List of values: 'gamma', 'nu'"gamma", "nu"
GenParamValuegenParamValuegen_param_value (input_control) number-array β (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)Sequence[Union[int, str, float]]Htuple (double / Hlong / char*)
Values of generic parameters to configure the selection
process and the classifier.
Default: [][]
Suggested values: 'auto', '0.1', '0.3'"auto", "0.1", "0.3"
OCRHandleOCRHandleocrhandle (output_control) ocr_svm β (handle)HTuple (HHandle)HOCRSvm, HTuple (IntPtr)HHandleHtuple (handle)
Trained OCR-SVM Classifier.
FeatureSetfeatureSetfeature_set (output_control) string-array β (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)
Selected feature set, contains only entries from
FeatureListfeatureListfeature_list.
Scorescorescore (output_control) real-array β (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)
Achieved score using tow-fold cross-validation.
Result
If the parameters are valid, the operator
select_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtected returns the value 2 (H_MSG_TRUE). If
necessary, an exception is raised.
Combinations with other operators
Combinations
Possible predecessors
protect_ocr_trainfProtectOcrTrainf
Alternatives
select_feature_set_trainf_mlp_protectedSelectFeatureSetTrainfMlpProtected
See also
select_feature_set_trainf_svmSelectFeatureSetTrainfSvm, select_feature_set_svmSelectFeatureSetSvm
Module
OCR/OCV