Application Benchtop
Assessing Coffee Bean Roasting Time with Regression Analysis of Hyperspectral Data
By Dr. Alexandre Lussier, Application Engineer - November 21, 2023
Whether precisely monitoring coffee
bean roasting time for the perfect cup of coffee or detecting an emerging algae
bloom on a lake, the spectral sensitivity of Resonon’s hyperspectral cameras can
quickly provide answers to manufacturers and researchers alike.
As remarkable as human vision is, it is based on
only 4 types of sensors on our retina (rods and three types of cones). We
effectively “see” only three colors and our range of sensitivity is
limited to light of wavelengths between 400 and 700 nm. Our eyes can qualitatively
observe coffee beans transforming from greenish to reddish and from light to
dark during the roasting process (see Figure 1), but we are unlikely to make
accurate quantitative assessments by eye.
Precise record-keeping and process
control ensure that coffee roasters repeatedly achieve the perfect roast and
blends for the best cup of coffee. A mistake or fault in the process can lead
to under or over-roasted beans, which translates into wasted time, product, and
money (and possibly a lousy cup of Joe). This study illustrates how the
roasting time of coffee beans can be determined in real-time with
hyperspectral imaging.
Figure 1: Color images of the roasted coffee beans samples used in the study
Application Overview
The hyperspectral imager used
for this study, the Pika® XC2, has 447 spectral channels
spanning the wavelength range of 400 to 1000 nm. This represents a wider range
of wavelengths and a vastly higher spectral resolution than the human eye. The
acquired hyperspectral data were processed with Spectronon™, Resonon’s free
hyperspectral imaging analysis software [download here] to extract precise
quantitative information about the bean roasting time.
We scanned 8 samples of coffee
beans roasted for 0, 2, 4, 6, 8, 10, 12, and 14 minutes, respectively. We used seven
of those scans (all except the 12-minute roasted beans) to train a regression
model for roasting time, reserving the 12-minute roasted beans data to test the
models accuracy.
For those unfamiliar with
regression analysis, it is a statistical technique that quantifies the
relationship between one or more independent variables and a dependent
variable. In this case, the regression model quantifies the relationship
between the average reflectance spectra of a datacube of roasted coffee beans
(the independent variable) with the time those coffee beans were roasted (the
dependent variable). After training, the regression model can predict how long
a batch of coffee beans was roasted based on the average spectral signature of
those beans. Figure 2 shows the average spectral signature for each group of
beans shown in Figure 1.
Fig 2: Average reflectance spectra for coffee beans at different roasting times
Results
After training the regression
model on all the samples except the 12-minute roasted sample, the regression
model was asked to predict how long the 12-minute beans had been roasted. The
model estimated 12.1 minutes.
Even though the bean color varies greatly
within a batch, and even across a single bean, the algorithm can crunch the
data from millions of pixels (which, in this example, each contain 447 color
channels) to extract meaningful information and estimate the roasting time for every
single pixel in the scan. Then, averaging over all pixels in the scan reveals
an accurate prediction of the batch’s roasting time.
This simple study illustrates how non-destructive
measurements with Resonon’s hyperspectral imaging system allow you to gain
valuable insight into processes that are otherwise challenging to monitor.
The sample data used in this study
are available for free at our Downloads site.
Thank
you to our friends at Ghost Town Coffee Roasters for
providing the roasted beans for this study!
Dr. Alexandre Lussier, Application Engineer
Dr. Alexandre Lussier, Application Engineer at Resonon
Alex holds a PhD in physics with expertise in material science, spectroscopy, and education. He has spent half his professional career in academia and half in industry, including work in fuel cells, construction, solar power systems, and fine carpentry.
His personal pursuits include summer and winter human-powered mountain adventures, surfing, and art. Whatever your potential application, he is curious to hear about it.
Contact us
Contact usLearn More
Basics Software
Spectronon™: Free Hyperspectral Imaging SoftwareNovember 7, 2023
Basics Benchtop+ 1 More
Types of Hyperspectral Imaging Systems: Part 1October 18, 2023
Contact Us
Click below and our hyperspectral experts will contact you soon.
Complete Hyperspectral Imaging Solutions
Contact
Resonon Inc.123 Commercial Drive
Bozeman, MT 59715 USA