Previous Next

Hyperspectral Imaging for cocoa beans grading

Accurate quality control of cocoa beans

Fine chocolates require premium cocoa beans, and the development of distinctive flavors requires a blend of different types of cocoa. As one of the most important cash crops, cocoa beans have a total trade valued at more than 9 billion dollars and a high demand for premium quality. During processing and handling, however, cocoa beans may suffer from improper management practices that reduce the final quality. Typical examples include: incorrect fermentation, inadequate drying, and deficient storage. As a result, low-quality cocoa beans with internal mold or infestation result in off-flavors, and over-fermentation, under-fermentation, and slaty beans, give rise to smoky off-flavors, extreme bitterness, and astringency in cocoa liquors.


Figure 1: An RGB image of randomly selected cocoa beans (whole seeds).


The quality assessment of cocoa beans relies on destructive, costly, and labor-intensive methods which are not ideal for large-scale quality control. Cut test is the internationally recognized standard procedure and currently the most widely used assessment method in the market for cocoa trade. Experts expose the cotyledons of cocoa beans by cutting the beans into halves, then visually examine the presence of slaty or white beans, mold, germination, and over- or under-fermentation within a sample batch. This is not a straightforward task, requiring specialized training and expertise, as can be inferred from the similarities between different quality beans shown in figure 2. Furthermore, it relies on random sampling of a small volume assuming that the quality of the batch is homogeneous, which it typically isn’t the case. It is not uncommon that as few as 0.03% of beans are used for the test, and from this assessment a whole batch is graded and traded.


Figure 2: Cocoa beans classified by using cut test and visual inspection: a) Good beans, b) Under-fermented beans, c) Slaty beans, d) Over-fermented bean, e) Germinated bean, f) Moldy bean, and g) White bean


Hyperspectral imaging can be used as a repeatable, non-destructive, and economical solution for cocoa bean quality control in real time, suitable for industrial scale.


Hyperspectral image acquisition of cocoa bean samples was carried out using a HySpex Classic SWIR camera covering the spectral range from 970 to 2500 nm, with a spatial resolution of 250 µm, and a spectral sampling of 5.45 nm. Broadband halogen lamps were used as illumination sources. The samples were scanned using a translation stage positioned directly underneath the camera. The system is scalable for conveyor belt setup or other large-scale industrial configurations


The acquired images were analysed using the Breeze software, from Prediktera. A maximum entropy multiclass classification model was built with the advanced machine learning function in Breeze. Cocoa beans were identified into different classes: good beans, under-fermented beans, slaty beans, and other low-quality beans. The classification was validated by an expert using the cut test methodology. The results from the analysis are shown in Figure 3 and the performance of the classification model applied on an independent test set in is shown in Figure 4.



Figure 3: Classification image of the cocoa bean samples.
Good beans, Under-fermented beans, Slaty beans, Other low-quality beans.


For the most critical classes (good, under-fermented and slaty), a classification accuracy close to 80% can be achieved using hyperspectral data and machine learning analysis techniques without having to cut the beans open. This is a major advantage which can significantly increase the onsite evaluation capabilities for large number of samples, potentially applicable to full batches of cocoa beans.


This technique can also be implemented in automated inspection lines providing real-time evaluation results for sorting and pricing. The classification model can also distinguish other defects such as germination, over-fermentation, mold, and white beans. Using the proposed solution, the analysis of all beans in a batch can provide a more reliable assessment of the overall quality, especially compared to the results traditionally obtained from cut tests using small sample sets from batches of several tons.

A fully automated turnkey solution is available from HySpex and Prediktera to help both cocoa growers and chocolate manufacturers enhance their competitiveness. Are you looking for a better overview of your cocoa bean quality?


Contact us to discuss your application and requirements with our specialists.

Download this application note.