This tutorial is about how to classify handwritten digit from scratch using SVM classifier.
SVM (Support vector machine) classifier –
Steps involved in handwritten digits classification:
SVM (Support vector machine) classifier –
SVM (Support vector machine) is an efficient classification method for high dimensional feature vector. We use here SVM implementation of python library sci-kit learn. In sci-kit learn, we can specify the kernel function (here, linear). For more detail about kernel functions and SVM refer – SVM Kernels and SVM.
Steps involved in handwritten digits classification:
- Training model:
- Download MNIST database of handwritten digits.
- Extract HOG features for each digit in the dataset.
- Train a Linear SVM using extracted features and labels in the dataset.
- Save the the classifier trained in step 2 to predict digits.
To download the source code go through link
- Testing model:
- Load classifier and input image for prediction as shown in figure below:
- Apply preprocessing to deal with noises in the image.
- Find contours in the preprocessed image.
- Draw rectangles around each contour.
- Find features for each contours.
- Predict digit for each contour using loaded classifier.
To download the source code go through link.
The output image of digits classification for above given input image will be
We can use different classifier instead of SVM e.g. KNN, Decision tree, Naive bays etc. Moreover, we can use CNN (convolutional neural network )also. For demonstration purpose we used basic classifier.
That's all for the scope of this post.
No comments:
Post a Comment