Coffee beans sorted using multispectral imaging and AI
Researchers in Brazil have developed a real-time selection method performed directly with coffee beans. The method doesn’t require roasting, doesn’t destroy the samples and can be included as a step in the production process.
The process of selecting specialty coffee beans currently entails three kinds of inspection. Two are physical and involve samples of raw and roast coffee; and the third is sensory, involving tasting the drink. In accordance with Specialty Coffee Association of America (SCAA) guidelines, coffee quality is measured on a decimal scale from zero to 100. A specialty coffee must score 80 or more.
Brazilian scientists at the University of São Paulo’s Center for Nuclear Energy in Agriculture (CENA-USP), collaborating with colleagues at Luiz de Queiroz College of Agriculture (ESALQ-USP) and the Computer Center at the Federal University of Pernambuco (UFPE), have now developed a coffee bean selection method based on multispectral imaging and machine learning. Although it relies on expensive equipment, the method doesn’t require roasting and can be performed in real time during the production process. An article about the new method has recently been published in Computers and Electronics in Agriculture.
“Specialty coffees are often selectively harvested, meaning only the ripe red cherries are picked. They’re harvested individually by hand. If a specialty coffee grower harvests green beans, or at any time uses strip picking, manual and/or mechanised, this procedure can result in a standard commercial crop,” said Winston Pinheiro Claro Gomes, first author of the article. Gomes is a PhD candidate in chemistry at CENA-USP, with Wanessa Melchert Mattos and Clíssia Barboza da Silva as thesis advisors.
To discriminate between ‘special’ and ‘traditional’ classes of green coffee beans, an advanced multispectral imaging technique based on reflectance and autofluorescence data was employed in combination with four machine learning algorithms (SVM, RF, XGBoost and CatBoost). Of the four algorithms, SVM showed superior accuracy (0.96) for the test dataset.
Using the images, the machine learning model can classify beans. Specialty beans were seen to be more uniform in shape in the visible spectrum (RGB) images, while standard beans were more intense in the autofluorescence images.
“The model we chose was the one that performed best in distinguishing between specialty and standard coffee beans. In this model, the most important information for the purpose of constructing separation boundaries came from the green fluorescence. We therefore decided to analyse the individual compounds that naturally display green fluorescence and tried to associate some fluorescent compounds that might influence the coffee grading separation process,” Gomes said.
Green fluorescence, a biological marker represented by green light in the visible spectrum, was analysed for 10 phenolic compounds, and the data showed that catechin, caffeine and certain acids (4-hydroxybenzoic acid, sinapic acid and chlorogenic acid) responded intensely after being excited with blue light at 405 nanometres (nm), emitting energy at 500 nm. This autofluorescence data (excitation/emission at 405/500 nm) contributed most to distinguishing green specialty beans from green standard beans.
Next steps, according to Gomes, will entail obtaining samples from each of the SCAA-defined score levels for specialty coffees (no easy task) and classifying the beans according to their scores. “In Brazil, coffees are rated at most 90–92. It’s hard to find any higher than that. Only imported coffee, from Ethiopia, for example, scores 100. In my PhD research, I’m attempting to classify beans on the basis of X-ray images, and I’ve decided to increase the number of samples and the breadth of the analysis by including imported beans,” he said.
Unlocking AI: strategic moves to revolutionise the food sector
As the AI transformation gathers pace, we can expect AI tools to become established in the food...
The development of food GMPs
Good manufacturing practices (GMPs) in the food industry are in place to ensure that the products...
Improving traceability with a warehouse management system
When it comes to supply chain management, advanced technologies are playing a role in optimising...