NIR classification of macadamia kernels

Hi everyone, in this post we are going to show you how to use an NIR spectrometer to perform a preliminary NIR classification of macadamia kernels.

Macadamias are typical Australian nuts, originating from what is today the north New South Wales and central and south eastern Queensland. Some time ago we started a project to assess the ability of modern NIR technology to grade macadamia nuts for quality.

What you are about to read is our preliminary results, suggesting that NIR analysis is able to segregate kernels of different oxidation stages – fresh, stale and rancid kernels – with good accuracy. It seems also that NIR may be able to segregate kernels based on their source cultivar. A disclaimer: These results must be confirmed by measuring a larger number of samples than what we have done here, to draw more general conclusions.

NIR spectral scans of macadamia kernels

OK, here we go. Below is a photo of how the NIR spectra from the kernels were taken. We measured the reflectance spectrum from each kernel. We acquired 10 spectra per kernel, at different positions around the kernel surface. Each spectrum was the average of 100 scans. We used an AOTF spectrometer. AOTF technology is extremely fast as it does not entail mechanical scans; it takes short of 5 seconds to acquire 100 spectra and average them in one reading.

NIR classification of macadamia kernels

Our samples of macadamia kernels were kindly provided by Cropwatch Independent Laboratories. We used four samples, each containing 7-10 kernels. Of these samples two were fresh kernels (from two different cultivars), one was of stale kernels and one was of rancid kernels. In this post we’ll describe how NIR spectra can be used to classify these kernels, that is segregate the kernels according to their quality.

OK, below are three representative spectra of fresh, stale and rancid kernels respectively. Each spectrum shown here is the average of the 10 measurements taken at different positions around the surface of each kernel (and remember, each measurement is already the average of 100 readings, so lots of averaging going on here). You can tell straight away the difference between the fresh kernel and the other ones. The spectra from the stale and the rancid kernels track more closely together instead.

Now the difference between the spectra is less subtle, and definitely more significant for the data analysis algorithm! For a quick stab at the classification of the kernels, we used Principal Component Analysis (PCA). You can check one of our previous posts for an introduction to PCA.

To maximise the specificity of our technique, we run PCA analysis on selected wavelength bands, rather than on the whole spectrum. Taking a look at the reflectance and second derivative spectra, we decided that the band 1200-1400 nm was the ideal candidate to segregate fresh kernels from the rest. The band 1850-2050 nm was instead the most promising to tell between stale and rancid samples.

Principal Component Analysis for classification of macadamia kernels

The score plots (scatter plots), obtained by plotting the scores of all samples for the first principal component PC1 versus the second component PC2, are shown in the next two figures.


The score plot for the 1200-1400 nm band shows how fresh kernels (green and blue dots) are well separated from the rest. On the other hand, stale and rancid kernels (gold and red dots respectively) are partially overlapping. On top of that, this result would also suggest that the fresh kernels from the two different cultivars could also be separated, based on their PC2 value. This could potentially suggest that NIR analysis may be capable of segregating kernels according to their source. Now, this result needs to be taken with a grain of salt: we need a larger number of samples, from different cultivars, to check whether these observations can be generalised.

The score plot for the 1850-2050 nm band is good to separate stale and rancid kernels. Again, since we had only one sample each of stale and rancid, this result needs to be checked with more samples. Variations across cultivar might affect the ability to segregate them using only the two first principal components.

Well, that’s it for today. If you liked this content, please spread the word! If you’d like to receive regular updates on our posts, feel free to sign up for our monthly newsletter!