org.yccheok.numrecognition
Class NumberNeuralNetworkRecognizer

java.lang.Object
  extended by org.yccheok.numrecognition.NumberNeuralNetworkRecognizer

public class NumberNeuralNetworkRecognizer
extends java.lang.Object

This is the neural network used to perform recognition.


Field Summary
private  NumberImageFeatureFactory featureFactory
          Feature factory for this neural network.
private  FeatureParameter featureParameter
          Feature parameter for this neural network.
private  org.joone.engine.SigmoidLayer hidden
          The hidden layer of neurons.
private  org.joone.engine.SigmoidLayer input
          The input layer of neurons.
(package private)  org.joone.engine.Monitor monitor
          Monitor for this neural network.
private  org.joone.engine.SigmoidLayer output
          The output layer of neurons.
 
Constructor Summary
NumberNeuralNetworkRecognizer(java.lang.String neuralNetworkFileName, NumberImageFeatureFactory featureFactory, FeatureParameter featureParameter)
          Creates a new instance of NumberNeuralNetworkRecognizer with specified neural network file, feature factory and feature parameter.
 
Method Summary
 int getInputRows()
          Returns number of input layer of neurons.
 int recognize(NumberImageProcessor numberImageProcessor)
          Recognize the integer value written inside a given image.
 int recognize(java.lang.String fileName)
          Recognize a single digit value written inside a given image.
 java.lang.String[] recognize(java.lang.String fileName, int maxXDistanceOfNextDigit)
          Recognize multiple digits value written inside a given image.
private  boolean restoreNeuralNetwork(java.lang.String fileName)
          This is a helper method used to restore neural network and it should not be exported (public).
 double[] runNetwork(int numOfInput, double[][] inputArray)
          This is a helper method used to run neural network and it should not be exported (public).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

private org.joone.engine.SigmoidLayer input
The input layer of neurons.


hidden

private org.joone.engine.SigmoidLayer hidden
The hidden layer of neurons.


output

private org.joone.engine.SigmoidLayer output
The output layer of neurons.


featureFactory

private NumberImageFeatureFactory featureFactory
Feature factory for this neural network.


featureParameter

private FeatureParameter featureParameter
Feature parameter for this neural network.


monitor

org.joone.engine.Monitor monitor
Monitor for this neural network.

Constructor Detail

NumberNeuralNetworkRecognizer

public NumberNeuralNetworkRecognizer(java.lang.String neuralNetworkFileName,
                                     NumberImageFeatureFactory featureFactory,
                                     FeatureParameter featureParameter)
Creates a new instance of NumberNeuralNetworkRecognizer with specified neural network file, feature factory and feature parameter.

Parameters:
neuralNetworkFileName - Neural network trained file. It contains a neural network with low error rate.
featureFactory - Feature factory.
featureParameter - Feature parameter.
Method Detail

restoreNeuralNetwork

private boolean restoreNeuralNetwork(java.lang.String fileName)
This is a helper method used to restore neural network and it should not be exported (public).

Parameters:
fileName - File name of the neural network file.
Returns:
true if the neural network file loaded successfully.

getInputRows

public int getInputRows()
Returns number of input layer of neurons.

Returns:
Number of input layer of neurons.

recognize

public int recognize(NumberImageProcessor numberImageProcessor)
Recognize the integer value written inside a given image.

Parameters:
numberImageProcessor - Number image processor.
Returns:
The integer value written inside the number image.

recognize

public java.lang.String[] recognize(java.lang.String fileName,
                                    int maxXDistanceOfNextDigit)
Recognize multiple digits value written inside a given image. The return value will be in array of String.

Parameters:
fileName - Number image file name
maxXDistanceOfNextDigit - Maximum distance among the digits within a single number.
Returns:
Array of String.

recognize

public int recognize(java.lang.String fileName)
Recognize a single digit value written inside a given image.

Parameters:
fileName - Number image file name
Returns:
The integer value written inside the number image.

runNetwork

public double[] runNetwork(int numOfInput,
                           double[][] inputArray)
This is a helper method used to run neural network and it should not be exported (public).

Parameters:
numOfInput - Number of input layer of neurons.
inputArray - Data to be feeded into input layer.
Returns:
Neural network result (value of output layer).