O'Reilly logo

Artificial Intelligence with Python by Prateek Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required