As good as it looks: from eating strawberries to detecting species.

We said it before and we'll say it again: people eat with their eyes. Nobody would eat rotten fruit or moldy meat. This is something you had to learn, unfortunately by trial and error. Your brain and your eyes are your partners when it comes to food, they analyse and provide patterns. Over the years, you've learnt what can be eaten and what you should avoid. NIR spectroscopy can help you see what your eyes can't see, but it also needs data and analysis to find patterns.

Let’s start with a simple example from your everyday life. After a hard day at work, you deserve a nice late afternoon snack. So on your way home you stop for some delicious strawberries. At the shop, you take a good look at which strawberries look the freshest. This is especially important, since the last time you had some strawberries that were bruised, and even one with a bit of mold on it! Then you go home and enjoy your treat.

It might not sound like it, but in this scenario you’ve already used spectroscopy. When looking for mold or defects, you often look at the color of the food. Strawberries should be nicely red. Any brown or white spots immediately catch your attention. However, what we see as a single color is actually the combination of a wide range of different colors.

Visible light consists of an entire range (or spectrum) of colors and everything we see is a combination of these colors. You can often see this after a rainy day, when sunlight is split into all the colors of the rainbow. Whether something seems to be red, brown or pink is then determined by the ratio of all these colors.

So when you look at the strawberry, your eyes are actually analyzing the visible light spectrum and using that to determine food quality. This process is not straightforward and depends on an interplay of food knowledge, environmental factors and human experience. For example, you don’t mind a goat cheese being white or a muffin being brown.

Unlike our human eyes, modern technology is not limited to visible light. This is very useful, because these ‘invisible colors’ can tell us a lot about the material that we’re looking at. Because X-rays interact more strongly with bones than with meat, doctors use them to look inside the body and to discover fractures.

Similarly, the near-infrared (NIR) spectrum can help us understand the chemical composition of materials. As the name suggests, it is a region that lies close to the visible color red. This spectrum strongly interacts with many organic compounds. These organic compounds come in many shapes and sizes, ranging from compounds in plastics to proteins in food.

As a result, we can use NIR to measure the chemical composition and structure of many samples. Think about applications such as measuring nutritional values, spotting bruises, validating the cold chain, detecting unwanted substances and even identifying species. As long as there is an impact on the organic sample, there is a high chance that NIR can detect it.

One of the biggest advantages of NIR spectroscopy lies in the fact that it only requires light. As a result these experiments can be performed in (near) real-time, even without damaging the samples. Recent technological advances were able to scale down the measurement devices, so that handheld devices became a reality. Now it is becoming possible for a food professional to select a sample, pick up their NIR spectrometer and verify the quality of the food.

There is however one drawback that we have ignored so far. This lays in making the jump from spectra to actual predictions. We will need to develop a model that understands how spectra for example relate to protein content. This is similar to how a child can learn the difference between good and stale fruit by a combination of experience and imitation of adults. This is not an easy task and it can even be hard for adults.

Teaching a computer model how to make these decisions requires advanced machine learning techniques, combined with much domain knowledge. An additional challenge lies in gathering a good amount of examples that you can use in the learning process. It is important that these examples cover many different situations, so that your model is not confused by new and unseen situations. No matter how advanced your learning algorithms are, a sound experimental design remains just as important to guarantee success.

By combining NIR spectroscopy with machine learning, we can check that what we eat is actually as good as it looks.