Category Archives: Machine Learning

C++ Code For Reading CIFAR-10 Dataset

The CIFAR-10 dataset can be found HERE. It is a very popular multi-channel image dataset for classifier training, as a simplify version of CIFAR-100, it is easier to use for newbies. Here’s a C++ version code for reading this dataset from .bin files into OpenCV matrices.

Also posted in OpenCV | Tagged , | 2 Responses

Convolutional Neural Networks II

Since the last CNN post, I was working on a new version of CNN, which support multi-layers Conv and Pooling process, I’d like to share some experience here. VECTOR VS HASH TABLE You can see in the last post, I used vector of Mat in convolution steps, it works well when we only have one […]

Also posted in Algorithm, OpenCV | Tagged , , , | 63 Responses

Convolutional Neural Networks

WHAT IS CNN A Convolutional Neural Network (CNN) is comprised of one or more convolutional layers, pooling layers and then followed by one or more fully connected layers as in a standard neural network. The architecture of a CNN is designed to take advantage of the 2D structure of an input image (or other 2D input […]

Also posted in Algorithm, OpenCV | Tagged , , , , | 41 Responses

A Fake Convolutional Neural Network

This is the early version of my CNN, at that time, I incorrectly thought that I can just use some randomly chosen Gabor filters to do the convolution, so I wrote this.  Actually, the test result is not bad for simple datasets such as MNIST, I think it’s just a fake CNN, but a nice […]

Also posted in Algorithm | Tagged , | 4 Responses

A Simple Deep Network

During this spring break, I worked on building a simple deep network, which has two parts, sparse autoencoder and softmax regression. The method is exactly the same as the “Building Deep Networks for Classification” part in UFLDL tutorial. For better understanding it, I re-implemented it using C++ and OpenCV.  GENERAL OUTLINE Read dataset (including training data […]

Also posted in Algorithm, OpenCV | Tagged , , , , , , , , | 37 Responses

[UFLDL Exercise] Convolution and Pooling

I’m learning Prof. Andrew Ng’s Unsupervised Feature Learning and Deep Learning tutorial, This is the 8th exercise, which is a simple ConvNet with Pooling process. I’ll not go through the detail of the material. More details about this exercise can be found HERE. I’ll try to implement it using C++ and OpenCV if I have time next week.

Also posted in Algorithm | Tagged , , , , , | 1 Response

Softmax Regression (with OpenCV)

This is the same algorithm with the previous SOFTMAX REGRESSION post. Because I’m going to try to build deeper neural networks for images, so as a review of OpenCV programming, I rewrote the Softmax regression code using OpenCV mat, instead of Armadillo. I used Matlab, Octave, Armadillo a lot these days, it is kind of […]

Also posted in Algorithm, OpenCV | Tagged , , , , | 3 Responses

[UFLDL Exercise] Implement deep networks for digit classification

I’m learning Prof. Andrew Ng’s Unsupervised Feature Learning and Deep Learning tutorial, This is the 6th exercise, which is a combination of Sparse Autoencoder and Softmax regression algorithm, and fine-tuning algorithm. It builds a 2-hidden layers sparse autoencoder net and one layer Softmax regression, we first train this network layer by layer, from left to right, then […]

Also posted in Algorithm | Tagged , , , , , , , | 3 Responses

C++ code for reading MNIST dataset

Here’s a code for reading MNIST dataset in C++, the dataset can be found HERE, and the file format is as well. Using this code, you can read MNIST dataset into a double vector, or an OpenCV Mat, or Armadillo mat. Feel free to use it for any purpose. (part of this code is stolen from […]

Also posted in OpenCV | Tagged , , , , | 5 Responses

[UFLDL Exercise] Self-Taught Learning

I’m learning Prof. Andrew Ng’s Unsupervised Feature Learning and Deep Learning tutorial, This is the 5th exercise, which is a combination of Sparse Autoencoder and Softmax regression algorithm. It uses the features trained by sparse autoencoder as training input of Softmax regression, and builds a classifier which have more accuracy than regular softmax regression. I’ll not go through […]

Also posted in Algorithm | Tagged , , , , | 2 Responses