Building an optical character recognizer using neural networks
This section describes the neural network based optical character identification scheme.
How to do it...
- Import the following packages:
import numpy as np import neurolab as nl
- Read the input file:
in_file = 'words.data'
- Consider 20 data points to build the neural network based system:
# Number of datapoints to load from the input file num_of_datapoints = 20
- Represent the distinct characters:
original_labels = 'omandig' # Number of distinct characters num_of_charect = len(original_labels)
- Use 90% of data for training the neural network and the remaining 10% for testing:
train_param = int(0.9 * num_of_datapoints) test_param = num_of_datapoints - train_param
- Define the dataset extraction parameters:
s_index = 6 e_index = -1
- Build the dataset:
information = [] labels = [] with open(in_file, 'r') as f: for line in f.readlines(): # Split the line tabwise list_of_values = line.split('t')
- Implement an error check to confirm...