get_prep_info_ocr_class_mlpT_get_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp (Operator)

Name

get_prep_info_ocr_class_mlpT_get_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp — Berechnen des Informationsgehaltes der vorverarbeiteten Merkmalsvektoren eines OCR-Klassifikators.

Signatur

get_prep_info_ocr_class_mlp( : : OCRHandle, TrainingFile, Preprocessing : InformationCont, CumInformationCont)

Herror T_get_prep_info_ocr_class_mlp(const Htuple OCRHandle, const Htuple TrainingFile, const Htuple Preprocessing, Htuple* InformationCont, Htuple* CumInformationCont)

void GetPrepInfoOcrClassMlp(const HTuple& OCRHandle, const HTuple& TrainingFile, const HTuple& Preprocessing, HTuple* InformationCont, HTuple* CumInformationCont)

HTuple HOCRMlp::GetPrepInfoOcrClassMlp(const HTuple& TrainingFile, const HString& Preprocessing, HTuple* CumInformationCont) const

HTuple HOCRMlp::GetPrepInfoOcrClassMlp(const HString& TrainingFile, const HString& Preprocessing, HTuple* CumInformationCont) const

HTuple HOCRMlp::GetPrepInfoOcrClassMlp(const char* TrainingFile, const char* Preprocessing, HTuple* CumInformationCont) const

HTuple HOCRMlp::GetPrepInfoOcrClassMlp(const wchar_t* TrainingFile, const wchar_t* Preprocessing, HTuple* CumInformationCont) const   (Nur Windows)

static void HOperatorSet.GetPrepInfoOcrClassMlp(HTuple OCRHandle, HTuple trainingFile, HTuple preprocessing, out HTuple informationCont, out HTuple cumInformationCont)

HTuple HOCRMlp.GetPrepInfoOcrClassMlp(HTuple trainingFile, string preprocessing, out HTuple cumInformationCont)

HTuple HOCRMlp.GetPrepInfoOcrClassMlp(string trainingFile, string preprocessing, out HTuple cumInformationCont)

Beschreibung

get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp berechnet den Informationsgehalt der mit der durch PreprocessingPreprocessingPreprocessingPreprocessingpreprocessing gegebenen Vorverarbeitung transformierten Komponenten der Trainingsvektoren. PreprocessingPreprocessingPreprocessingPreprocessingpreprocessing kann auf 'principal_components'"principal_components""principal_components""principal_components""principal_components" oder 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates" gesetzt werden. Der OCR-Klassifikator OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle muss mit create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp erzeugt worden sein. Die zugrundeliegenden Vorverarbeitungen sind bei create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp beschrieben. Der Informationsgehalt wird aus die Variation der transformierten Komponenten der Trainingsvektoren berechnet, d.h. er wird rein aufgrund der Trainingsdaten unabhängig von einer Fehlerrate bei einer Klassifikation der Trainingsdaten berechnet. Der Informationsgehalt wird für alle relevanten Komponenten der transformierten Merkmalsvektoren (NumInput für 'principal_components'"principal_components""principal_components""principal_components""principal_components" und min(NumOutput - 1, NumInput) für 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates", siehe create_class_mlpcreate_class_mlpCreateClassMlpCreateClassMlpCreateClassMlp) in InformationContInformationContInformationContInformationContinformationCont zurückgegeben. Der Informationsgehalt wird als eine Zahl zwischen 0 und 1 dargestellt. Ein prozentualer Informationsgehalt kann leicht durch Multiplikation mit 100 berechnet werden. Der kumulierte Informationsgehalt der ersten n Komponenten wird in der n-ten Komponente von CumInformationContCumInformationContCumInformationContCumInformationContcumInformationCont zurückgegeben, d.h. CumInformationContCumInformationContCumInformationContCumInformationContcumInformationCont enthält die Summen der ersten n Elemente von InformationContInformationContInformationContInformationContinformationCont. Um get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp verwenden zu können, müssen Trainingsmuster in den durch TrainingFileTrainingFileTrainingFileTrainingFiletrainingFile angegebenen Trainingsdateien abgespeichert werden (siehe write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainfWriteOcrTrainf).

InformationContInformationContInformationContInformationContinformationCont und CumInformationContCumInformationContCumInformationContCumInformationContcumInformationCont können dazu verwendet werden, um zu entscheiden, wieviele Komponenten der transformierten Merkmalsvektoren relevante Information enthalten. Ein oft verwendetes Kriterium ist z.B. zu verlangen, dass die transformierten Daten x% (z.B. 90%) der Daten enthalten sollten. Dies kann leicht anhand des ersten Wertes von CumInformationContCumInformationContCumInformationContCumInformationContcumInformationCont, der über x% liegt, bestimmt werden. Der so erhaltene Wert kann bei einem neuerlichen Aufruf von create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp als NumComponents verwendet werden. Da zum Aufruf von get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp schon ein Klassifikator mit create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp erzeugt werden muss, also auch ein initialer Wert von NumComponents bei create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp angegeben werden muss, aber bei Verwendung von get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp typischerweise noch nicht bekannt ist, wieviele Komponenten relevant sind, empfiehlt sich folgendes zweistufiges Vorgehen, um NumComponents zu bestimmen: In einem ersten Schritt wird ein Klassifikator mit der maximalen Anzahl von NumComponents (NumInput für 'principal_components'"principal_components""principal_components""principal_components""principal_components" und min(NumOutput - 1, NumInput) für 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates") erzeugt. Dann werden die Trainingsmuster mit write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainfWriteOcrTrainf in einer Datei gespeichert. Anschließend wird mit get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp der Informationsgehalt der Komponenten und somit NumComponents bestimmt. Danach wird ein neuer Klassifikator mit der gewünschten Anzahl Komponenten erzeugt und der Klassifikator mit trainf_ocr_class_mlptrainf_ocr_class_mlpTrainfOcrClassMlpTrainfOcrClassMlpTrainfOcrClassMlp trainiert.

Ausführungsinformationen

Parameter

OCRHandleOCRHandleOCRHandleOCRHandleOCRHandle (input_control)  ocr_mlp HOCRMlp, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle des OCR-Klassifikators.

TrainingFileTrainingFileTrainingFileTrainingFiletrainingFile (input_control)  filename.read(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Name(n) der Trainingsdatei(en).

Defaultwert: 'ocr.trf' "ocr.trf" "ocr.trf" "ocr.trf" "ocr.trf"

Dateiendung: .trf, .otr

PreprocessingPreprocessingPreprocessingPreprocessingpreprocessing (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Art der Vorverarbeitung (Transformation) der Merkmalsvektoren.

Defaultwert: 'principal_components' "principal_components" "principal_components" "principal_components" "principal_components"

Werteliste: 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates", 'principal_components'"principal_components""principal_components""principal_components""principal_components"

InformationContInformationContInformationContInformationContinformationCont (output_control)  real-array HTupleHTupleHtuple (real) (double) (double) (double)

Relativer Informationsgehalt der transformierten Merkmalsvektoren.

CumInformationContCumInformationContCumInformationContCumInformationContcumInformationCont (output_control)  real-array HTupleHTupleHtuple (real) (double) (double) (double)

Kumulierter Informationsgehalt der transformierten Merkmalsvektoren.

Beispiel (HDevelop)

* Create the initial OCR classifier.
read_ocr_trainf_names ('ocr.trf', CharacterNames, CharacterCount)
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, 80, \
                      'canonical_variates', |CharacterNames|, 42, OCRHandle)
* Get the information content of the transformed feature vectors.
get_prep_info_ocr_class_mlp (OCRHandle, 'ocr.trf', 'canonical_variates', \
                             InformationCont, CumInformationCont)
* Determine the number of transformed components.
* NumComp = [...]
* Create the final OCR classifier.
create_ocr_class_mlp (8, 10, 'constant', 'default', CharacterNames, 80, \
                      'canonical_variates', NumComp, 42, OCRHandle)
* Train the final classifier.
trainf_ocr_class_mlp (OCRHandle, 'ocr.trf', 100, 1, 0.01, Error, ErrorLog)
write_ocr_class_mlp (OCRHandle, 'ocr.omc')

Ergebnis

Sind die Parameterwerte korrekt, dann liefert get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp den Wert 2 (H_MSG_TRUE). Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.

Falls get_prep_info_ocr_class_mlpget_prep_info_ocr_class_mlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlpGetPrepInfoOcrClassMlp den Fehler 9211 (Matrix ist nicht positiv definit) bei PreprocessingPreprocessingPreprocessingPreprocessingpreprocessing = 'canonical_variates'"canonical_variates""canonical_variates""canonical_variates""canonical_variates" zurückliefert, bedeutet dies typischerweise, dass für die verschiedenen Klassen zu wenige Trainingsmuster gespeichert worden sind.

Vorgänger

create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp, write_ocr_trainfwrite_ocr_trainfWriteOcrTrainfWriteOcrTrainfWriteOcrTrainf, append_ocr_trainfappend_ocr_trainfAppendOcrTrainfAppendOcrTrainfAppendOcrTrainf, write_ocr_trainf_imagewrite_ocr_trainf_imageWriteOcrTrainfImageWriteOcrTrainfImageWriteOcrTrainfImage

Nachfolger

clear_ocr_class_mlpclear_ocr_class_mlpClearOcrClassMlpClearOcrClassMlpClearOcrClassMlp, create_ocr_class_mlpcreate_ocr_class_mlpCreateOcrClassMlpCreateOcrClassMlpCreateOcrClassMlp

Modul

OCR/OCV