budrus123 / digit-classifier

Machine learner to classify a single handwritten digit on an image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Digit Classifier Using KNN

CONTENTS OF THIS FILE

  • Introduction
  • Usage

INTRODUCTION

A machine learner using K-Nearest Neighbors method (KNN) to predict a single handwritten digit. The learner uses the scikit-learn digits dataset for training purpose. The project takes a jpg file as input and then this jpg is transformed into a 32x32 bmp image. An example of an input image can be seen below as well as in the examples directory.

number_9

After that, the image is segmented into distinct blocks of 4x4 and the number of on (black) pixels are counted depending on a threshold. An array of 64 values is created to represent each distinct block. This creates our instance vector which is used by the learner to predict the single digit. At the end, the digit prediction is shown to the user.

Usage

$ python main.py <image_name.jpg>

About

Machine learner to classify a single handwritten digit on an image.


Languages

Language:Python 100.0%