Skip to content

The MNIST database is a benchmark widely used in image classification algorithm comparison. This repository contains Matlab programs to compare the classification results with different image feature combinations. Classification methods include knn, svm and logistic regression.

Notifications You must be signed in to change notification settings

ShanLu1984/MNIST-Database-Classification

Repository files navigation

MNIST Database Classification

Introduction

Image classification and recognition is an important machine learning task that can be used in variety of applications. Feature engineering is a fundamental step for image classification algorithms. Our second project proposed a new feature for image understanding and classification. Based on the theory of diffusion on graph, we extracted a time series from the graph as a new image feature. The feature is robust to rotation/scaling/mutation of images. We use K-nearest-neighbor (knn), logistic regression and SVM to classify images in MINIST (MNIST: a database of handwritten digits, a standard image retrieval/classification benchmarks) to test the performance of the new feature. The classification error rate with our proposed feature and the combination of other key features of image achieved a decreasing by 5.4% comparing to the results without new feature. Two papers were published in ICIP, 2014 (http://ieeexplore.ieee.org/document/7025411/) and 2016 (http://ieeexplore.ieee.org/document/7532316/). Github: https://github.com/ShanLu1984/MNIST-Database-Classification.

  • About the database: MNIST is a database of handwritten digits, available from this website http://yann.lecun.com/exdb/mnist/. It contains a training group of 60, 000 images and a testing group of 10, 000 images. One property of this dataset is that all the images are hand written digits with standard size and contrast, which is very "similar" already.

  • Tasks:

  1. Compares the classification error rates of the heat content feature and other blockwise similar-size low-level features including the (1) intensity histogram, (2) intensity moments, (3) Gabor coefficients, (4) gray-level co-occurrence matrix (GLCM) and (5) edge directions histogram. The classification algorithm is a k-nearest neighbors (knn) classifier with L2 norm as the distance measure.
  2. Combining three types of features (Intensity, texture and shape). We apply logistic regression and linear kernel support vector machine (SVM) classifiers to execute the classification.
  • Main results: You may refer details and main results from our published paper in 2014 and 2016 in ICIP.
  1. "A complex network based feature extraction for image retrieval" http://www.orie.cornell.edu/orie/research/groups/multheavytail/upload/KLGK2014-081215.pdf
  2. "Image feature extraction based on spectral graph information"

What's inside:

  1. mnistclassify_feature_par.m
  • Main program for MNIST image recognition -- feature generation.
  • Output: MNISTtrain_49_all.mat, MNISTtest_49_all.mat
  1. mnist_classify_knn.m
  • Main program for MNIST image recognition -- knn classification.
  • Output: print test accuracy of different features and these features combined with heat content feature.
  1. mnist_classify_logistic_regression.m
  • Main program for MNIST image recognition --- Logistic regression classification
  • Output: print test error rate for different feature combinations.
  1. mnist_classify_libsvm.m
  • Main program for MNIST image recognition -- SVM classification
  • Output: print test error rate for different feature combinations.
  1. loadMNISTImages.m and loadMNISTLabels.m
  • Load image and corresponding labels in MNIST dataset
  1. graphGenNew.m
  • Used to generate graph from image pixel information
  • Output: inputGraph.D: degree matrix; inputGraph.GL: graph Laplacian; inputGraph.B: boundary nodes; inputGraph.P: transition matrix;
  1. hcMatNew.m
  • Used to generate heat content feature from input graph;
  • Output: hc, heat content vector;
  1. blockGen.m
  • Generate image blocks for feature computing
  • OUtput: inputBlock

How to run:

  1. Download the MNIST database from http://yann.lecun.com/exdb/mnist/.
  2. Download all the programs in the repository. Open Matlab, change the current path to the folder that you put all the codes in, and add all the folders and subfolders in the current folder to the current path.
  3. Open mnistclassify_feature_par.m and run, or type mnistclassify_feature_parin command window.
  4. Open mnist_classify_knn.m and run, or type mnist_classify_knn in command window.
  5. Open mnist_classify_logistic_regression.m and run, or type mnist_classify_logistic_regression in command window.
  6. Open mnist_classify_libsvm.m and run, or type mnist_classify_libsvm in command window.

About

The MNIST database is a benchmark widely used in image classification algorithm comparison. This repository contains Matlab programs to compare the classification results with different image feature combinations. Classification methods include knn, svm and logistic regression.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published