Building an Optical Character Recognition engine

Now that we have learned how to work with this data, let's build an optical character recognition system using artificial neural networks.

Create a new python file and import the following packages:

import numpy as np 
import neurolab as nl 

Define the input file:

# Define the input file 
input_file = 'letter.data' 

Define the number of datapoints that will be loaded:

# Define the number of datapoints to  
# be loaded from the input file 
num_datapoints = 50 

Define the string containing all the distinct characters:

# String containing all the distinct characters 
orig_labels = 'omandig' 

Extract the number of distinct classes:

# Compute the number of distinct characters 
num_orig_labels = len(orig_labels) 

Define ...

Get Artificial Intelligence with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.