My task is to classify a digit based on a small image containing one digit only. The font type and size is the same across the training/test dataset, but the position of the digit in the image might be different (possible translations, no rotations).

Since the constraint on the type of input is substantial, I presume there exists a simple classifier that can achieve a good performance in this scenario, and thus ideally I would like not to use CNNs here. Can you think of any simple classifier which should handle this task properly?

My first approach involved building a KNNs classifier, hoping that having examples of each digit at multiple vertical positions (in the image) in the training dataset would make the classifier robust to vertical translations. It turned out that KNN does not achieve a good performance at all. The KNN model I used was the default sklearn.neighbors.KNeighborsClassifier with minkowski metric (the performance was measured for multiple value of n_neighbors).

Then I read a comment by user20160, where he claims that:

There are certainly domain-specific tricks than can make classifiers more suitable for digit recognition. Some of these tricks work by increasing invariance to particular transformations that one would expect in handwritten digits (e.g. translation, rotation, scaling, deformation). For example, the digit '0' should mean the same thing, even if it's shifted to the left and warped a little bit. Some of the tricks are specific to the family of classifiers. For example, this kind of invariance can be had using certain SVM kernels, spatial transformer layers in neural nets, or probably an invariant distance metric for K nearest neighbors. Other tricks can be used with many classifiers. For example, the dataset can be augmented with many transformed copies of the digits, which can help the classifier learn the proper invariance.

If SVMs are good for this task, what kernel should be used for the model to be shift invariant? Or should I try methods different than SVMs?

Below you can see the examples of digits that I would like to classify.

enter image description here enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.