# Pop Can Image Recognition Using Orthogonal Partial Least Squares Discriminant Analysis (OPLS-DA)

In 2002, I took a computational intelligence class from NC State University (ECE 592Z), which I completed as a distance-education course. One of our projects was to train a neural network to recognize different pop can images. The instructor gave us a training set of images, but our grade was based on how many images our neural net could identify from a set of images that it had never seen. It was a fun project, but it was a pain to get the neural network to converge.

Since Thanksgiving, I’ve been spending most of my free time learning everything I can about partial least squares regression. I purchased and read about half of “Multivariate and Megavariate Data Analysis Advanced Applications and Method Extensions (Part II)” by Umetrics Academy. I was intrigued by the chapter on image analysis, and wondered if it could be used to recognize the pop cans I used for my neural network project.

I dug up the set of 189 images. They were all small (90×150 px) gray scale images, a sample of which are shown below.

Notice that each image is in a slightly different position and has a varying amount of noise.

The key to using PLS for image analysis is to represent the image as a single vector of information. This is done using a wavelet transformation. I tried to figure out how to do this on my own in Matlab, but wasn’t able to figure out how to get the output of the wavelet transformation into an appropriate 1-dimensional format. Fortunately, Umetrics has a free utility that does this, called SIMCA Codec.

Once the data from the 89 images was imported into SIMCA-P+ (v.12.01), the analysis was incredibly. I selected the orthogonal partial least squares discriminate analysis option, and the output gave 5 validated latent variables. (Note, I also did the analysis using the non-orthogonal PLS method, but the results were not as crisp.) The images below show the images clusters (one color for each type of pop can) plotted against latent variables 1, 2, and 3, and then again using latent variables 1, 2, and 5.

These graphs show a clear distinction of each of the pop can types in latent variable space. In SIMCA-P+, you are able to rotate these graphs in 3D. It was much easier to see the clean split between each of the groups by doing this. In other words, the analysis can clearly recognize which images are of what type of pop.

I continue to be impressed with the power and flexibility of partial least squares analysis. It’s been well worth the time and effort to learn the concepts and how to put it to use in practice. I’ve got some fun projects in mind as to where to go next!