CONTROL OF THE COFFEE ROASTING STAGE USING ARTIFICIAL VISION TECHNIQUES

Artificial vision techniques were used to evaluate its application in the control of the coffee roasting stage. Coffee samples of Colombia and Castillo varieties were obtained and analyzed by comparing images during the roasting stage. A one-way ANOVA analysis exhibited 94.28% of similarity of the coffee varieties studied; a multivariate analysis showed significant differences (p<0.05) for the time factor and its interaction with the variety factor, no differences were observed (p>0.05) for the coffee varieties. Additionally, a Principal Component, with two components demonstrated 90.77% of the variance by differentiating the samples in the different roasting times. Therefore, the proposed technique could be used in the control of the coffee roasting stage.


INTRODUCTION
Since the late eighties, the introduction of cameras (visible spectrum) in different industrial processes has led to the emergence of control methods, based on the compression of the underlying information in an image using projection techniques on latent structures, known as Multivariate Image Analysis (MIA) (GELADI et al., 2006).
These techniques have been used for more than 20 years in agricultural applications related to robotics, automation, artificial vision and artificial intelligence (GARCÍA-LUNA et al., 2016).Furthermore, these techniques are quite powerful in situations in which images are used to record multitudes of color channels, collected by means of multispectral cameras, in which each channel can contain information of a smaller number of phenomena and therefore, be able to associate the demonstrated color channels with qualities and characteristics of interest to the study (PRATS-MONTALBÁN et al., 2011).Additionally, these techniques are often innovative and precise, 1,3 Centro de investigación Cesurcafé -Universidad Surcolombiana -Neiva -Colombia -jcamilo.sarria@gmail.com,joel.giron@usco.edu.coPractical examples of its application in the control of food processes are: fat classification of Iberian pigs (GIRÓN et al., 2016), analysis in coffee roasting (HERNÁNDEZ et al., 2008), analysis in bread baking (VERDÚ et al., 2017), analysis of shelf life in fish (IVORRA et al., 2013;IVORRA et al., 2016) evaluation of pork meat quality (SUN et al., 2018), among others.Consequently, image analysis techniques demonstrate the effectiveness in predicting the behavior of a product under different conditions.
The expertise of a master roaster in the coffee roasting stage is still utilized, among other artisanal practices in the production of coffee in Colombia.This being said, it is necessary to identify low-cost practices and techniques that enable the processing of coffee to be optimized and controlled, thusly improving the efficiency of production and commercialization.
The analysis techniques that use artificial vision in the visible range provide access to information from which these processes can be background and noise (VALA et al., 2013) based on the parametric background subtraction algorithm (PICCARDI, 2004).From each element of interest (beans) a vector of morphological and color characteristics was extracted.Specifically, the average Red, Green, Blue (RGB) and Hue, Saturation, Value (HSV) coordinates values were obtained from a window around the centroid of each bean (LEE et al., 2017).In addition, the morphology was analyzed by textures of Haralick.Afterwards, information filtering with a conditional loop was performed by means of a dynamic thresholding to eliminate anomalous values (double the standard deviation).Finally, the data of each image was stored in a matrix to execute the statistical analysis.The processing of the images was done with the software MATLAB 8.0 (The Mathworks, USA).

Statistical analysis
'The similarities between images data of Colombia variety and Castillo variety were determined using a Student´s t-test.An analysis of variance (One-way ANOVA) was conducted in the first part of the study to determine whether there were significant differences.Each vector (color coordinates and morphology) was considered as a dependent variable and the variety was the factor.The least significant procedure (LSD) was used to test for the differences between means at a significance level of 5%.Additionally, in the second part of the study, a multifactor ANOVA was carried out for each vector to evaluate the effect of variety and roasting time and their interactions.In order to assess the feasibility of the artificial vision techniques to discriminate between coffee varieties and roasting times and to compress and select the information with the highest variance, a Principal Component Analysis (PCA) method was performed with a matrix of 44 variables obtained from the sensor, 30 for color (15 RGB and 15 HSV) and 14 for morphological features.All variance and multivariate analysis were carried out using Statgraphics centurion XVI program.(Manugistics Inc., Rockville, MD, USA).

RESULTS AND DISCUSSION
The similarity of the images obtained from the varieties studied presented a mean of 94.28%; the color coordinates showed a similarity of 93.33% for the RGB and 92.67 % for the HSV; a greater similarity was evidenced with the components of the shape vector 96.86%.The F-ratio and automated and homogenized.The versatility of these techniques are applicable to the coffee roasting stage given that they allow for the quantification of data related to the changes in color and size that occur due to changes in temperature and time.The objective in this study was to develop and evaluate a procedure based on artificial vision for the control in the coffee roasting stage.

MATERIALS AND METHODS
20 kg of coffee (Coffea arabica) Castillo and Colombia varieties were harvested at an altitude of 1600 m.a.s.l., only beans with an intense red coloration were collected.The samples were deposited in polystyrene containers with cooling gels to avoid early fermentation and later were transported to CESURCAFÉ at the Universidad Surcolombiana (Neiva, Huila, Colombia) to perform the wet fermentation and drying process.In both varieties, the fermentation began with a pH value of 5.79 ± 0.013 until reaching a value of 4.56 ± 0.105.Subsequently, the drying process was carried out and the moisture content of the sample was reduced to 11.2% ± 0.04 and 11.0% ± 0.06 for the Colombia and Castillo varieties respectively.
'The hulling process was carried out in a laboratory hulling machine (ING-C-200, Ingesec, Bogotá, Colombia), followed by the selection of non-defective coffee beans in accordance with the provisions of the Specialty Coffee Association of America (SCAA, 2009).The coffee beans were passed through a number 13 sieve of 5 mm diameter to eliminate smaller beans.The roasting process was done in a Quantik roaster (TC-150R, Quantik, Colombia); two levels of roasting were defined, medium roast and dark roast, according to luminosity (L * ) measurements, similar to commercially available coffee samples (Craig et al., 2017), the roaster was set to sample entry temperature of 180 °C.For image acquisition, a Canon T3 digital camera (Tokyo, Japan) with 12 megapixels of resolution was adapted.The parameters of focal length, exposure time and white balance were set with an indirect lighting of 7.5 W dichroic LED lamps with 620 Lm (Lumek, Germany).To capture the images, Petri dishes containing the samples were placed 40 cm from the objective, 288 images were obtained in total, 6 images for each sample of 150 g of coffee and 24 captures for each time of roasting.For image analysis, it was developed an algorithm that segmented each captured raw image to eliminate P-values of the RGB coordinates obtained from the Colombia and Castillo varieties are shown in Table1, the values of the RGB coordinates only presented significant difference (p<0.05) for the maximum green variable.The constant variables in all the images were eliminated.Therefore, information of the minimum blue channel was not included in the analysis; ANOVA data for HVS and morphology information are not shown.
Figure 1 shows the interaction between the factors time and variety for a variable analyzed in this study (Hue mean) of the HVS coordinates.Differences were observed in the first minutes of roasting, and the effect of temperature decreased differences caused by the mucilage residues, similar results were reported by other authors (LEE et al., 2017); the response was not significant (p>0.05) for the varieties, while the roasting time values presented significant differences (p<0.05).This analysis showed similar results for all the parameters studied which justifies the application of the algorithm in different coffee varieties.
At each time, changes in color and shape of the beans were observed.In the roasting stage, these changes relate to the development of properties such as flavor, aroma and color (HERNÁNDEZ et al., 2008).
Figure 2 shows the scores plot in the plane of the first and second principal components (PCs) for the roasting stage, which together account for 94.22% of the total variability.Additionally, the value for each of the components established by the analysis is presented.From the third component, there are no significant increases for the variance, but 95.97% of the variability of the samples is noticed.
The analysis showed a good grouping of the samples in the study.The first component differentiated the coffee beans up to three minutes of roasting.In this time interval the beans still exhibited green colors and do not presented variation in volume.The second component separated the samples into four well-defined groups in which different sizes and color levels of roast were differed.At four minutes of roasting, when the internal temperature of the bean was 170 °C (Figure 3), the samples generated a group between the green color and the brown color and as the roasting process continued they got darker until reached minute seven when the temperature was approximately 220 °C (Figure 3).
At this time, the samples exhibited more homogeneous characteristics in both color RGB and HVS coordinates and shape morphology analyzed by textures of Haralick.Based on the results obtained, a robust classification algorithm capable of discriminating the roasting times can be performed.With different times ( 1 ( ). 2 ( ). 3 ( ). 4 ( ). 5 ( ). 6 ( ).

CONCLUSION
The application of artificial vision techniques allowed the automatic and objective differentiation of coffee samples according to the roasting time.The coffee varieties used in the trial were not a factor of discrimination.Future studies with other varieties are necessary in order to generate a classification tool applicable to any variety of coffee for the control of the roasting stage.

FIGURE 1 -
FIGURE 1 -Interactions between factors coffee variety and roasting time for one of the evaluated variables, mean hue.

FIGURE 3 -
FIGURE 3 -Roasting times and the temperature at which the beans came out of the roaster.

TABLE 1 -
F-ratio values and P-value obtained in a one-way ANOVA of the RGB color coordinates.