C# Class Ocronet.Dynamic.Interfaces.IRecognizeLine

A generic interface for text line recognition.
Inheritance: IComponent, IDisposable
Exibir arquivo Open project: nickun/OCRonet

Public Methods

Method Description
AddTrainingLine ( Intarray segmentation, Bytearray image_grayscale, string transcription ) : bool

Train on a text line, given a segmentation. This is analogous to addTrainingLine(bytearray,nustring) except that it takes the "ground truth" line segmentation.

AddTrainingLine ( Bytearray image, string transcription ) : void

Train on a text line. Usage is: call addTrainingLine with training data, then call finishTraining The state of the object is undefined between calling addTrainingLine and finishTraining, and it is an error to call recognizeLine before finishTraining completes. This allows both batch and incemental training. NB: you might train on length 1 strings for single character training and might train on words if line alignment is not working (well, for some training data)

Align ( string chars, Intarray seg, Floatarray costs, Bytearray image, IGenericFst transcription ) : void

Align a lattice with a transcription.

Dispose ( ) : void

Clean up here.

Epoch ( int n ) : void

Notify the recognizer of the start of a new epoch (i.e., if n>0, then we have seen the data before).

FinishTraining ( ) : void

Finish training, possibly making complex calculations. Call this when training is done and the system should switch back to recognition; this method may take a long time to complete.

RecognizeLine ( IGenericFst result, Bytearray image ) : double

Recognize a text line and return a lattice representing the recognition alternatives.

RecognizeLine ( Intarray segmentation, IGenericFst result, Bytearray image ) : double

This is a weird, optional method that exposes character segmentation for those line recognizers that have it segmentation contains colored pixels, and a transition in the transducer of the form * --- 1/eps --> * --- 2/a --> * means that pixels with color 1 and 2 together form the letter "a"

RecognizeLineSeg ( IGenericFst result, Intarray segmentation, Bytearray image ) : double

recognize a line with or without a given segmentation if useit is set to true, the given segmentation is just displayed in loggers, but not used, the segmenter computes the segmentation and the recognition uses its output if useit is set to false, the segmenter is still launched for the loggers, but the given segmentation is really used for the recognition

StartTraining ( string type = "adaptation" ) : void

Start training of the given type.

Method Details

AddTrainingLine() public method

Train on a text line, given a segmentation. This is analogous to addTrainingLine(bytearray,nustring) except that it takes the "ground truth" line segmentation.
public AddTrainingLine ( Intarray segmentation, Bytearray image_grayscale, string transcription ) : bool
segmentation Intarray
image_grayscale Bytearray
transcription string
return bool

AddTrainingLine() public method

Train on a text line. Usage is: call addTrainingLine with training data, then call finishTraining The state of the object is undefined between calling addTrainingLine and finishTraining, and it is an error to call recognizeLine before finishTraining completes. This allows both batch and incemental training. NB: you might train on length 1 strings for single character training and might train on words if line alignment is not working (well, for some training data)
public AddTrainingLine ( Bytearray image, string transcription ) : void
image Bytearray
transcription string
return void

Align() public method

Align a lattice with a transcription.
public Align ( string chars, Intarray seg, Floatarray costs, Bytearray image, IGenericFst transcription ) : void
chars string Characters along the best path. /// Currently, every character in chars must have a corresponding /// region in seg and the characters must be in reading order. /// Eventually, chars may contain characters (e.g., spaces) that /// do not correspond to any region. Note that chars may not /// correspond to any string allowed/suggested by the transcription.
seg Intarray Aligned segmentation, colors correspond to chars (starting at 1)
costs Floatarray Costs corresponding to chars
image Bytearray Input grayscale image
transcription IGenericFst The "ground truth" lattice to align
return void

Dispose() public method

Clean up here.
public Dispose ( ) : void
return void

Epoch() public method

Notify the recognizer of the start of a new epoch (i.e., if n>0, then we have seen the data before).
public Epoch ( int n ) : void
n int
return void

FinishTraining() public method

Finish training, possibly making complex calculations. Call this when training is done and the system should switch back to recognition; this method may take a long time to complete.
public FinishTraining ( ) : void
return void

RecognizeLine() public abstract method

Recognize a text line and return a lattice representing the recognition alternatives.
public abstract RecognizeLine ( IGenericFst result, Bytearray image ) : double
result IGenericFst
image Bytearray
return double

RecognizeLine() public method

This is a weird, optional method that exposes character segmentation for those line recognizers that have it segmentation contains colored pixels, and a transition in the transducer of the form * --- 1/eps --> * --- 2/a --> * means that pixels with color 1 and 2 together form the letter "a"
public RecognizeLine ( Intarray segmentation, IGenericFst result, Bytearray image ) : double
segmentation Intarray
result IGenericFst
image Bytearray
return double

RecognizeLineSeg() public method

recognize a line with or without a given segmentation if useit is set to true, the given segmentation is just displayed in loggers, but not used, the segmenter computes the segmentation and the recognition uses its output if useit is set to false, the segmenter is still launched for the loggers, but the given segmentation is really used for the recognition
public RecognizeLineSeg ( IGenericFst result, Intarray segmentation, Bytearray image ) : double
result IGenericFst
segmentation Intarray
image Bytearray
return double

StartTraining() public method

Start training of the given type.
public StartTraining ( string type = "adaptation" ) : void
type string /// "adaptation" means temporary adaptation of the classifier /// to all the lines between startTraining and finishTraining /// other types of training are recognizer-dependent ///
return void