select_feature_set_trainf_svmT_select_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm (Operator)
Name
select_feature_set_trainf_svmT_select_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm
— Wählt die optimalen Merkmale für ein bestimmtes OCR-Klassifikationsproblem
aus.
Signatur
void SelectFeatureSetTrainfSvm(const HTuple& TrainingFile, 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::SelectFeatureSetTrainfSvm(const HTuple& TrainingFile, const HTuple& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score)
HTuple HOCRSvm::SelectFeatureSetTrainfSvm(const HString& TrainingFile, const HString& FeatureList, const HString& SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score)
HTuple HOCRSvm::SelectFeatureSetTrainfSvm(const char* TrainingFile, const char* FeatureList, const char* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score)
HTuple HOCRSvm::SelectFeatureSetTrainfSvm(const wchar_t* TrainingFile, const wchar_t* FeatureList, const wchar_t* SelectionMethod, Hlong Width, Hlong Height, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* Score)
(Nur Windows)
static void HOperatorSet.SelectFeatureSetTrainfSvm(HTuple trainingFile, HTuple featureList, HTuple selectionMethod, HTuple width, HTuple height, HTuple genParamName, HTuple genParamValue, out HTuple OCRHandle, out HTuple featureSet, out HTuple score)
HTuple HOCRSvm.SelectFeatureSetTrainfSvm(HTuple trainingFile, HTuple featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score)
HTuple HOCRSvm.SelectFeatureSetTrainfSvm(string trainingFile, string featureList, string selectionMethod, int width, int height, HTuple genParamName, HTuple genParamValue, out HTuple score)
Beschreibung
select_feature_set_trainf_svmselect_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm
wählt die optimalen Merkmale für
ein bestimmtes OCR-Klassifikationsproblem aus.
Die Daten für das OCR-Klassifikationsproblem werden mit der Trainingsdatei
TrainingFileTrainingFileTrainingFileTrainingFiletrainingFile
ausgewählt. Als Klassifikator wird eine
Support-Vektor-Maschine (SVM) verwendet.
Es wird eine Untermenge aller angegebenen OCR-Merkmale gewählt.
Alle zu untersuchenden Merkmale werden in FeatureListFeatureListFeatureListFeatureListfeatureList
spezifiziert.
Die Liste der möglichen OCR-Merkmale wird in der Dokumentation von
create_ocr_class_svmcreate_ocr_class_svmCreateOcrClassSvmCreateOcrClassSvmCreateOcrClassSvm
näher erläutert.
Die letztendlich ausgewählte Merkmalsuntermenge wird in FeatureSetFeatureSetFeatureSetFeatureSetfeatureSet
zurückgegeben.
select_feature_set_trainf_svmselect_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm
ist auf OCR-Klassifikationsprobleme
spezialisiert und unterstützt nur Merkmale, die in der Auswahlliste stehen.
Für andere Merkmale bietet sich somit die Nutzung des generellen Operators
select_feature_set_svmselect_feature_set_svmSelectFeatureSetSvmSelectFeatureSetSvmSelectFeatureSetSvm
an.
Für den Selektionsprozess können in SelectionMethodSelectionMethodSelectionMethodSelectionMethodselectionMethod
zwei
verschiedene Methoden ausgewählt werden: entweder die Greedy-Variante
'greedy'"greedy""greedy""greedy""greedy" (das momentan erfolgversprechendste Merkmal wird
zur Auswahl hinzugefügt) oder die dynamisch oszillierende Suche
'greedy_oscillating'"greedy_oscillating""greedy_oscillating""greedy_oscillating""greedy_oscillating" (Das momentan erfolgversprechendste Merkmal
wird zur Auswahl hinzugefügt. Danach wird getestet ob eines
der hinzugefügten Merkmale entbehrlich ist.).
Während 'greedy'"greedy""greedy""greedy""greedy" schneller terminiert,
kann 'greedy_oscillating'"greedy_oscillating""greedy_oscillating""greedy_oscillating""greedy_oscillating" bessere Ergebnisse erzielen wenn
viele Trainingsdaten vorliegen.
Als Optimierungskriterium dient die Klassifikationsrate, die mit einem
zwei-fachen Kreuzvalidierungsverfahren ermittelt wird. Die beste erreichte
Klassifikationsrate wird in ScoreScoreScoreScorescore
zurückgegeben.
OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle
gibt einen Klassifikator zurück, der mit der
entsprechenden Merkmalsauswahl parametrisiert und trainiert wurde.
Die Parameter 'nu'"nu""nu""nu""nu" und 'gamma'"gamma""gamma""gamma""gamma", die für das SVM benötigt
werden, können über die generischen Parameter GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
und
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
entweder direkt auf einen Wert oder auf
'auto'"auto""auto""auto""auto" gesetzt werden.
Wenn 'auto'"auto""auto""auto""auto" ausgewählt ist, wird für den entsprechenden Wert auch
eine Optimierung durchgeführt.
Diese automatische Schätzung kann die Ausführung der Merkmalsauswahl
signifikant verlangsamen, was bei größeren Datensätzen zu Rechenzeiten im
Bereich von Stunden führen kann.
Eine genauere Erklärung des Parameters 'nu'"nu""nu""nu""nu" und
des Kernelparameter des RBF-Kernels 'gamma'"gamma""gamma""gamma""gamma"
(RBF = radial basis function) findet sich in der
Beschreibung von create_class_svmcreate_class_svmCreateClassSvmCreateClassSvmCreateClassSvm
.
Achtung
Die Laufzeit dieses Operators kann mit größeren Datensätzen und einer
längeren Merkmalsliste unter Umständen sehr lang sein.
Es ist zu beachten, dass dieser Operator nicht aufgerufen werden sollte,
wenn für das Training nur ein kleiner Datensatz verfügbar ist.
Auf Grund des Risikos der Überanpassung kann der Operator
select_feature_set_trainf_svmselect_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm
zwar einerseits einen Klassifikator
mit sehr hohem Score liefern. Andererseits weist der Klassifikator
jedoch eine schlechte Erkennungsrate auf, wenn dieser getestet wird.
Ausführungsinformationen
- Multithreading-Typ: reentrant (läuft parallel zu nicht-exklusiven Operatoren).
- Multithreading-Bereich: global (kann von jedem Thread aufgerufen werden).
- Automatisch parallelisiert auf interner Datenebene.
Dieser Operator liefert ein Handle zurück. Es ist zu beachten, dass der Zustand einer Instanz dieses Handletyps durch bestimmte Operatoren geändert werden kann, obwohl das Handle als Eingabeparameter in diesen Operatoren verwendet wird.
Parameter
TrainingFileTrainingFileTrainingFileTrainingFiletrainingFile
(input_control) filename.read(-array) →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Namen der Trainingsdateien.
Defaultwert:
''
""
""
""
""
Dateiendung: .trf
, .otr
FeatureListFeatureListFeatureListFeatureListfeatureList
(input_control) string(-array) →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Merkmale, die zur Klassifikation verwendet werden können.
Defaultwert:
['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"]
["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"]
["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"]
Werteliste: 'anisometry'"anisometry""anisometry""anisometry""anisometry", 'chord_histo'"chord_histo""chord_histo""chord_histo""chord_histo", 'compactness'"compactness""compactness""compactness""compactness", 'convexity'"convexity""convexity""convexity""convexity", 'cooc'"cooc""cooc""cooc""cooc", 'default'"default""default""default""default", 'foreground'"foreground""foreground""foreground""foreground", 'foreground_grid_16'"foreground_grid_16""foreground_grid_16""foreground_grid_16""foreground_grid_16", 'foreground_grid_9'"foreground_grid_9""foreground_grid_9""foreground_grid_9""foreground_grid_9", 'gradient_8dir'"gradient_8dir""gradient_8dir""gradient_8dir""gradient_8dir", 'height'"height""height""height""height", 'moments_central'"moments_central""moments_central""moments_central""moments_central", 'moments_gray_plane'"moments_gray_plane""moments_gray_plane""moments_gray_plane""moments_gray_plane", 'moments_region_2nd_invar'"moments_region_2nd_invar""moments_region_2nd_invar""moments_region_2nd_invar""moments_region_2nd_invar", 'moments_region_2nd_rel_invar'"moments_region_2nd_rel_invar""moments_region_2nd_rel_invar""moments_region_2nd_rel_invar""moments_region_2nd_rel_invar", 'moments_region_3rd_invar'"moments_region_3rd_invar""moments_region_3rd_invar""moments_region_3rd_invar""moments_region_3rd_invar", 'num_connect'"num_connect""num_connect""num_connect""num_connect", 'num_holes'"num_holes""num_holes""num_holes""num_holes", 'num_runs'"num_runs""num_runs""num_runs""num_runs", 'phi'"phi""phi""phi""phi", 'pixel'"pixel""pixel""pixel""pixel", 'pixel_binary'"pixel_binary""pixel_binary""pixel_binary""pixel_binary", 'pixel_invar'"pixel_invar""pixel_invar""pixel_invar""pixel_invar", 'projection_horizontal'"projection_horizontal""projection_horizontal""projection_horizontal""projection_horizontal", 'projection_horizontal_invar'"projection_horizontal_invar""projection_horizontal_invar""projection_horizontal_invar""projection_horizontal_invar", 'projection_vertical'"projection_vertical""projection_vertical""projection_vertical""projection_vertical", 'projection_vertical_invar'"projection_vertical_invar""projection_vertical_invar""projection_vertical_invar""projection_vertical_invar", 'ratio'"ratio""ratio""ratio""ratio", 'width'"width""width""width""width", 'zoom_factor'"zoom_factor""zoom_factor""zoom_factor""zoom_factor"
SelectionMethodSelectionMethodSelectionMethodSelectionMethodselectionMethod
(input_control) string →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Methode zur Auswahl der Merkmale.
Defaultwert:
'greedy'
"greedy"
"greedy"
"greedy"
"greedy"
Werteliste: 'greedy'"greedy""greedy""greedy""greedy", 'greedy_oscillating'"greedy_oscillating""greedy_oscillating""greedy_oscillating""greedy_oscillating"
WidthWidthWidthWidthwidth
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Breite des Rechtecks, auf die die Grauwerte des
segmentierten Zeichens skaliert werden.
Defaultwert: 15
HeightHeightHeightHeightheight
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Höhe des Rechtecks, auf die die Grauwerte des
segmentierten Zeichens skaliert werden.
Defaultwert: 16
GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
(input_control) string-array →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Namen von (optionalen) Parametern für
die Steuerung des Verhaltens verwendeten
des SVMs.
Defaultwert: []
Werteliste: 'gamma'"gamma""gamma""gamma""gamma", 'nu'"nu""nu""nu""nu"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
(input_control) number-array →
HTupleHTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)
Zu den optionalen generischen
Parametern gehörende Werte.
Defaultwert: []
Wertevorschläge: 'auto'"auto""auto""auto""auto", '0.1'"0.1""0.1""0.1""0.1", '0.3'"0.3""0.3""0.3""0.3"
OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle
(output_control) ocr_svm →
HOCRSvm, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Mit den selektierten Merkmalen trainierter
SVM-Klassifikator.
FeatureSetFeatureSetFeatureSetFeatureSetfeatureSet
(output_control) string-array →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Ausgewählten Merkmale.
ScoreScoreScoreScorescore
(output_control) real-array →
HTupleHTupleHtuple (real) (double) (double) (double)
Klassifikationsrate, die mit dem ausgewählten
Merkmalssatz erreicht wurde.
Ergebnis
Sind die Parameterwerte korrekt, dann liefert
select_feature_set_trainf_svmselect_feature_set_trainf_svmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvmSelectFeatureSetTrainfSvm
den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird
eine Fehlerbehandlung durchgeführt.
Alternativen
select_feature_set_trainf_mlpselect_feature_set_trainf_mlpSelectFeatureSetTrainfMlpSelectFeatureSetTrainfMlpSelectFeatureSetTrainfMlp
,
select_feature_set_trainf_knnselect_feature_set_trainf_knnSelectFeatureSetTrainfKnnSelectFeatureSetTrainfKnnSelectFeatureSetTrainfKnn
,
select_feature_set_trainf_mlp_protectedselect_feature_set_trainf_mlp_protectedSelectFeatureSetTrainfMlpProtectedSelectFeatureSetTrainfMlpProtectedSelectFeatureSetTrainfMlpProtected
Siehe auch
select_feature_set_trainf_svm_protectedselect_feature_set_trainf_svm_protectedSelectFeatureSetTrainfSvmProtectedSelectFeatureSetTrainfSvmProtectedSelectFeatureSetTrainfSvmProtected
,
select_feature_set_svmselect_feature_set_svmSelectFeatureSetSvmSelectFeatureSetSvmSelectFeatureSetSvm
Modul
OCR/OCV