Skip to content

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

Notifications You must be signed in to change notification settings

budrus123/digit-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

Releases

No releases published

Packages

No packages published

Languages