14
Building a fast digit recognition solution with Python Stephen Hsu http://about.me/cchhsu 2013.05.24

Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Building a fast digit recognition solution with Python

Stephen Hsu

http://about.me/cchhsu

2013.05.24

Page 2: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

One day ……

Page 3: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

@#$%^

#$%$@$

@#$%@# Sorry,

I was

wrong

Page 4: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10
Page 5: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

My Goodness ….

Page 6: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Image

Recognition

Page 7: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

There is a python

module named

pytesser

Page 8: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10
Page 9: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Tesseract OCR

Introduction

- Open source OCR engine

- Started at the HP labs between 1985 and 1994

- C, C++

- Google used it for document scan project

Training

- Images fonts of Benchmark tools are non-standard.

- Training Process is fun !

Page 10: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Technologies

Common

Windows

Linux

Python 2.7

3rd party APP

jTessBoxEditor

Tesseract OCR

Imaging Process

pytesser

PIL

datetime, time

re

os, sys

csv

glob

Page 11: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Image Pre-Processing

Image Cropping

- Crosshairs

Pixel Interpolation

20M Pixel 99M Pixel

Recognition rate from

42% to 99.99%

Binarization Processing

Lines Recognition

Page 12: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Image Pre-Processing Sample

Original Image Image Cropping Pixel Interpolation

Page 13: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

Extracted Text

then ……..

Parser

In: Number

Out: Structured

number

Store & Convert

In: Structured Number

Out: CSV File

Sample_20130522214241.csv

Page 14: Building a fast digit recognition solution with Python - PyCon · ATTO Help Description R ead 6447 7062 14229 22528 37185 38328 36671 38623 es3S3 38847 85353 go 180 256.0 5120 T 10

END