Visualizing the characters in an optical character recognition database

We will now look at how to use neural networks to perform optical character recognition. This refers to the process of identifying handwritten characters in images. We will use the dataset available at http://ai.stanford.edu/~btaskar/ocr. The default file name after downloading is letter.data. To start with, let's see how to interact with the data and visualize it.

How to do it…

  1. Create a new Python file, and import the following packages:
    import os
    import sys
    
    import cv2
    import numpy as np
  2. Define the input file name:
    # Load input data 
    input_file = 'letter.data' 
  3. Define visualization parameters:
    # Define visualization parameters scaling_factor = 10 start_index = 6 end_index = -1 h, ...

Get Python: Real World Machine Learning 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.