# Hyperspectral Imaging for the Detection of Bitter Almonds in Sweet Almond Batches
## 3 Results and Discussion
### Identification of Bitter Almonds in Adulterated Sweet Almond Batches  
The results obtained demonstrate the feasibility of using HSI for the discrimination between sweet and bitter almond batches. However, it is important to test the applicability of this technology in the actual situation in the industry, where the aim is not to differentiate between batches of sweet and bitter almonds but to detect the presence of random individual bitter almonds in the processed sweet batches. To identify the presence of bitter almonds in sweet almond batches, the first approach was carried out the validation of the mixtures using for this aim the mean spectrum obtained from each ROI [_Data not shown_]. The predictive capability obtained using this validation strategy was not enough high as only the 40.5% (34/84) of the mixtures (6 M\({}_{5\%}\), 13 M\({}_{10\%}\), 8 M\({}_{15\%}\) and 7 M\({}_{20\%}\)) were detected. It makes sense as, by using the average spectra, some information might be lost due to the heterogeneity of the sample, which is reflected in the individual pixels but not in the mean spectrum calculated. Although it could be expected that the M\({}_{20\%}\) group had had the highest percentage of samples identified as adulterated, it is important to note that, from the total amount of mixture (500 g), only a fraction of approximately 100 g was analysed. Therefore, the percentage of bitter almonds present in the portion analysed may not be equivalent to the percentage included in the whole mixture, even when the sample was homogenised. It highlights the importance of the sampling procedure to acquire representative information of the sample that is going to be analysed [25]. Therefore, to avoid that the sampling process could affect the results obtained and taking into account that the main advantage of the HSI technology is the proportion of information provided from each pixel, it was proceeded to analyse each of the mixtures, not only at a spectral level but also at a spatial level. Firstly, PCA was developed to study the structure of the population. The first three PCs, which accounted for 99.97% of the explained variance, were analysed. Figure 2 shows the scores and the loading plot corresponding to the PC2 (0.21%) as it exhibits the greatest distinction between sweet and bitter almonds that are present in the mixture. The remaining PC images represent other features, but they are not useful for identifying bitter almonds. The image corresponding to PC1 stands out as the almonds with respect to the background and PC3 highlights the features related to the shape and size of the kernels. Figure 2: Score image (**a**) and loading plot (**b**) for the second principal component of the mixtures. The graphical representation of the loadings corresponding to the PC2 was analysed to study the dominant wavelengths, which appear to have higher discrimination power. As can be seen in Figure 2b, again, the most prominent peaks are shown at around 1200 nm, associated with lipids (C-H second overtone) and at 1400 nm, which corresponds not only to the first overtone of the O-H functional groups but also to the R-C\(\equiv\)N stretching [23]. Once it was studied the structure of the population and the most influential bands in the differentiation between sweet and bitter almonds to identify each individual bitter almond present in the sweet almond batches, the pixel-by-pixel validation--or mapping --of the mixtures was carried out. Figure 3 shows four mixtures--one of each percentage of bitter almonds--used for the validation to visualise the classification of each kernel. Some of the mixtures did not have the control almonds to test their correct classification, so they were not validated; therefore, 75 samples (17 M\({}_{5}\), 20 M\({}_{10}\), 20 M\({}_{15}\) and 18 M\({}_{20}\)) from the 84 available were validated. The number of mixtures in which the bitter almonds were correctly identified was 56 (75%).