Summary of Problem

Patterns are everywhere in our lives! More specifically, the clothes we wear or the blankets we use have specific patterns on them. We have plaid shirts, solid shirts, tie-dye shirts, polka-dotted skirts, striped blankets, etc. Although we, as humans, can identify and describe or recreate these patterns with some precision, computers have more difficulty differentiating the subtleties between the patterns. We decided to delve into the world of pattern recognition by using a neural network to solve this problem.

Our Approach

Our general approach for tackling the problem of pattern recognition involved finding images to be processed. The image processing would promote uniformity among the inputs. We would then separate the processed images into testing and training sets, the latter to be used to train our multiple RBMs. We then connected the RBMs to create a DBM, testing it’s accuracy at creating patterns by using the testing set to compare.

Image processing

We have 5 images for each pattern, all retrieved from a quick Google images search. The first step in our image processing was to make the images all uniform size and color. We used GIMP to make all the images gray-scale and 50x50 pixels. If an image was especially large (>250 pixels as length or height), or not square to begin with, we cropped a section of the image that contained the most distinctive parts of the pattern. This was done in order to avoid inappropriate scaling, as well as grainy images or images with especially small-features.

We then fed the gray-scale images into MATLAB and converted them into binary format. We use Otsu’s method to find a good threshold to separate the colors into black and white, and using that, create a 50x50 binary matrix. We also save the classification labels for each image in a matrix. Currently, all the data (3 classes with 5 images each) is being used for testing and training, though we use many copies of each. After some reformatting, the images are saved into .ascii and then .mat files according to their classifications. These .mat files are later used to train the Boltzmann machines.

Neural Network

For our speicific Deep Boltzmann machine, we begin by pre-training three layers of restricted boltzmann machines, the first two with 500 neurons and the last one with 2000. We trained the layers separately on the images we had processed, and watched as the images created images based on the probabilty of a pixel in a patterned image being black or white.

After trianing the three layers of RBMs separately, we use the defining values of the RBMs to classify the training and testing data. The layers are connected through back-propogation, and the training set, followed by the testing set, are inputted to the DBM and the classification rates are analyzed.

Deep Boltzman Machine Diagram

Results

Our results were less than ideal, but not the worst we could have gotten. We did discover, however, that our machine performs better with 2 layers rather than two.

2 layers of RBMs
2 layer, final image


3 layers of RBMs
3 layer, final image


Misclassification rates:

2 layers, Train 2 layers, Test 3 layers, Train 3 layers, Test
Epochs 1-5 33.3% to 43.3% 33.3% to 43.3% 63.3% 63.3%
Epochs 6-10 66.7% to 70% 66.7 to 70% 63.3% to 66.7% 63.3% to 66.7%

Future Work

There is always room for improvement in any project, and ours is no exception. In the future, we would like to do the following:

  • Comment the code, to ensure complete accessibility and understanding!
  • Improve code compatability, considering that many variables are excessively hardcoded and thus cause many errors after one change.
  • Improve code performance, since our accuracy rates are not nearly as postive as with Hinton's MINST data.