MarkMoHR / Handwriting Number Classification
A computer vision project, based on cimg library and svm training, to classify handwriting number.
Stars: ✭ 22
Labels
Projects that are alternatives of or similar to Handwriting Number Classification
Machine Learning
⚡机器学习实战(Python3):kNN、决策树、贝叶斯、逻辑回归、SVM、线性回归、树回归
Stars: ✭ 5,601 (+25359.09%)
Mutual labels: svm
Vehicle Detection
Created vehicle detection pipeline with two approaches: (1) deep neural networks (YOLO framework) and (2) support vector machines ( OpenCV + HOG).
Stars: ✭ 462 (+2000%)
Mutual labels: svm
ML-Coursera
This repository contains all the programming exercises in Python for the Coursera course called "Machine Learning" by Adjunct Professor Andrew Ng at Stanford University.
Stars: ✭ 66 (+200%)
Mutual labels: svm
Tensorflow cookbook
Code for Tensorflow Machine Learning Cookbook
Stars: ✭ 5,984 (+27100%)
Mutual labels: svm
Pytorch classification
利用pytorch实现图像分类的一个完整的代码,训练,预测,TTA,模型融合,模型部署,cnn提取特征,svm或者随机森林等进行分类,模型蒸馏,一个完整的代码
Stars: ✭ 395 (+1695.45%)
Mutual labels: svm
Hyperparameter Optimization Of Machine Learning Algorithms
Implementation of hyperparameter optimization/tuning methods for machine learning & deep learning models (easy&clear)
Stars: ✭ 516 (+2245.45%)
Mutual labels: svm
Machine Learning With Python
Python code for common Machine Learning Algorithms
Stars: ✭ 3,334 (+15054.55%)
Mutual labels: svm
Pedestrian detection
通过HOG+SVM训练进行行人检测,行人数据库使用INRIAPerson,程序基于OpenCV实现
Stars: ✭ 253 (+1050%)
Mutual labels: svm
Jsat
Java Statistical Analysis Tool, a Java library for Machine Learning
Stars: ✭ 683 (+3004.55%)
Mutual labels: svm
DSPKM
This is the page for the book Digital Signal Processing with Kernel Methods.
Stars: ✭ 32 (+45.45%)
Mutual labels: svm
Python Ml Course
Curso de Introducción a Machine Learning con Python
Stars: ✭ 442 (+1909.09%)
Mutual labels: svm
Machinelearnjs
Machine Learning library for the web and Node.
Stars: ✭ 498 (+2163.64%)
Mutual labels: svm
Handwriting Number Classification
An computer vision project, based on cimg library and svm training, to classify handwriting number.
1. Project Requirement
1.1 Input
- A photo in which an A4 paper is placed on the desk, with some handwriting numbers on
1.2 Output
- A string of the numbers written on the paper, like "70026548853"
1.3 Intermediate Processes
- Modify the paper in the photo into a standard A4 paper
- Implement the segmentation of the numbers, dividing them into single number
- Use Adaboost or SVM to train a classifier of the handwriting numbers
- Classify the handwriting numbers with the trained classifier
2. Coding Environment & 3rd Party Library
- Windows10 + VS2015
- C++
- cimg library : http://www.cimg.eu/
- opencv (For extracting features of images)
- libsvm (for training, testing and predicting) : http://www.csie.ntu.edu.tw/~cjlin/libsvm/
3. Implementation Procedure
-
Find the 4 vertices of the paper
-
Modify the paper into a standard A4 paper
-
Segmentation of the numbers in order:
- Convert into binary image
- Use vertical histogram to divide the source image into sub-image (each sub-image contains a line of numbers)
- Use horizontal histogram to divide the line-sub-image into several row-sub-images
- Foreach sub-image, implement dilation to thicken the number (and join the broken ones)
- Foreach sub-image, use connected-component_labeling algorithm to divide the single number: https://en.wikipedia.org/wiki/Connected-component_labeling
- Foreach sub-image, save all single number images and a list of their name in .txt
-
Use libsvm to train model and test, and predict the number finally
- Data prepairing:
- convert the mnist(http://yann.lecun.com/exdb/mnist/) binary data into .jpg as well as their labels
- Model training:
- extract the HOG features of each image and construct them into svm format (in **.txt)
- Scale the features(in **.txt) with
svm-scale.exe
(search the windows/ folder) - Train the model with
svm-train.exe
, and get **.model - (Optional) Test the data with
svm-predict.exe
and see the accuracy (modify the training parameter to get the highest accuracy)
- Number predicting:
- read the number images you segmented just now and do prediction with the trained model
- Data prepairing:
4. Result Screenshots
- 4 vertices of the paper & A4 paper modification
-
Segmentation of the numbers:
- Binary image with dilation & Divided Image & Circled single number
- Divided into single numbers in order as well as an image list in .txt
- Prediction:
5. Some key points
5.1 Broken numbers joining
-
Comparison (Before joining & After joining)
-
Implements : use the filters below when doing the dilation during the number segmentation (filterA) (filterB)
- Do the dilation with filterA twice at first, and then filterB once.
- filterB means: when at the white pixel, search up/down one pixel and left/right one pixel. If meeting a black pixel, set the current position to black.
- filterA means: when at the white pixel, search up/down one pixel and left/right two pixel. Count the blacks with the coefficient, -1 or 1 (-1 means subtract one black when meeting a black at left/right side). At last, only if the blacks more than 0, set the current position to black.
- Obviously, filterB is to thicken the number in all directions, leading to the cons that the holes in number 0, 6, 8, 9 with be filled. So I propose another simple but useful filter, the filterA, to deal with such problem. It can be seen that the intensity of a white pixel is much relevant to its horizontal neighbors, which prevent hole filling to some extent. Luckily it works well in my experiments.
6. Code and Algorithm Explanation
-
Segmentation of the numbers & Broken numbers joining :
http://blog.csdn.net/qq_33000225/article/details/73123880 (Chinese version)
-
Prediction: (Waiting......)
7. Problems left
- Some numbers are connected to each other and are segmented together into one image......
- From the predict result above, we see that most of the 7s and 9s are classified into 1......
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].