Efficiency of Identification of Blackcurrant Powders Using Classifier Ensembles

In the modern times of technological development, it is important to select adequate methods to support various food and industrial problems, including innovative techniques with the help of artificial intelligence (AI). Effective analysis and the speed of algorithm implementation are key points in assessing the quality of food products. Non-invasive solutions are being sought to achieve high accuracy in the classification and evaluation of various food products. This paper presents various machine learning algorithm architectures to evaluate the efficiency of identifying blackcurrant powders (i.e., blackcurrant concentrate with a density of 67 °Brix and a color coefficient of 2.352 (E520/E420) in combination with the selected carrier) based on information encoded in microscopic images acquired via scanning electron microscopy (SEM). Recognition of blackcurrant powders was performed using texture feature extraction from images aided by the gray-level co-occurrence matrix (GLCM). It was evaluated for quality using individual single classifiers and a metaclassifier based on metrics such as accuracy, precision, recall, and F1-score. The research showed that the metaclassifier, as well as a single random forest (RF) classifier most effectively identified blackcurrant powders based on image texture features. This indicates that ensembles of classifiers in machine learning is an alternative approach to demonstrate better performance than the existing traditional solutions with single neural models. In the future, such solutions could be an important tool to support the assessment of the quality of food products in real time. Moreover, ensembles of classifiers can be used for faster analysis to determine the selection of an adequate machine learning algorithm for a given problem.


Introduction
Along with the development of technology, the view of food quality and safety has changed.The processes of food production, management, distribution, and consumption have evolved significantly over the past few years.These developments resulted from a greater focus on strengthening food quality and safety control systems [1][2][3][4].When looking at recent developments in climate change [5], consumer behavior and preferences [6], and food adulteration problems, it becomes a challenge to ensure food safety for the benefit of human health [7].The successive introduction of more modern solutions in the food industry aimed at improving local food quality control systems affects the improvement of global food safety [8,9].As a result of continued technological advances, especially in the field of artificial intelligence, food quality control seems likely to intensify [9].These changes in both quality and food safety could become an important element in achieving global economic success.The aforementioned artificial intelligence (AI) can make a significant contribution to improving the quality as well as safety of food through, among other things, the online monitoring of food quality at each stage of the process [10].AI can manage food storage collections, using sorting, packaging, and cleaning processes to maintain optimal storage conditions [11,12].AI will work to increase the efficiency of sourcing raw materials by, among other things, optimizing parameters in the process, which will help reduce food waste.The idea of repeatable processes to obtain homogeneous food products for quality uniformity is also increasingly possible with the help of product classification [13], contamination detection [14], and defects, as well as quality assessment of these foods [15][16][17].
In view of the above, the search for effective methods to develop products ensuring quality and safety is crucial given the protection of consumer health.Many traditional analytical methods in food are expensive and time-consuming, e.g., nuclear magnetic resonance (NMR) or Fourier-transform infrared (FTIR) [18].Analytical methods are also used to identify foods based on various attributes including components or organic compounds in a research sample.However, the classification of food products often requires the use of further analytical methods.This contributes to the need for comparative methods that can classify a food product just as quickly and effectively.Machine learning, among others, through image classification, and extracting features from an image, is becoming an alternative tool when evaluating food quality and safety.Therefore, it seems reasonable to look for innovative techniques to ensure fast yet effective food inspection, while minimizing financial and energy expenditure.
Machine learning using algorithms has provided an innovative approach to effectively analyze multidimensional data.Considering the analysis of raw materials and food products, machine learning algorithms can effectively identify important attributes (parameters) of food that can affect its quality [19][20][21][22][23].An interesting tool is ensembles of classifiers due to their optimal estimation of data as a result of product classification [24][25][26].Currently, there are efforts to make data recognition more effective and efficient using artificial intelligence methods.Classifier ensembles represent one method of machine learning in which multiple algorithms are combined to result in better performance than individual models.As a result of tuning hyperparameters for individual models, it is possible to identify these data efficiently, even when they are highly complex.This, in turn, translates into improved model generalization capabilities.When looking at the context discussed by the team of Liu et al., 2021 [27], that machine learning algorithms can have poor efficiency due to attribute selection, it also seems reasonable to tune hyperparameters in models [28].
This study focused on identifying currant powders obtained via the low-temperature drying process due to the different types of carriers.Blackcurrant powders as food products are rich in vitamins, minerals, and antioxidants [29].They contain anthocyanins, which belong to a group of natural colorants of plant origin [30,31].Anthocyanins are powerful antioxidants that contribute to, among other things, reducing the risk of cardiovascular disease and also controlling blood sugar levels to counter diabetes [30].A major advantage of fruit powders is their sustainability during storage.It is due to the method of obtaining powders associated with the reduction in, among other things, water content, which in turn translates into the retention of a large amount of fruit nutrients for a longer period of time [32].For food, the way soft fruits are transported is also a difficulty, leading to their wastage due to sudden spoilage.While recognizing the problem of sourcing food products only seasonally, fruit powders seem to be an alternative solution.
The utilitarian aim was to develop an efficient way to recognize classes of currant powders using advanced machine learning algorithms.We applied artificial intelligence methods using ensembles of classifiers.Considering the authenticity and maintenance of quality as a result of sourcing these food products, the process of identifying different classes of currant powders also becomes important due to their physical and chemical properties [32].This attempt to apply machine learning algorithms will allow efficient (authentic) recognition of properties between different types of currant powders.The different machine learning techniques were tested, obtaining efficient yet optimal compar-isons.The proposed solution based on using ensemble methods of machine learning in a single metaclassifier [33][34][35] to control the quality assessment of food products increases the efficiency of model generalization compared to each of the component algorithms.Machine learning can contribute to improving quality standards, and controlling adulteration, as well as the efficiency of obtaining final products, i.e., blackcurrant powders.

Sample Collection
The research material consisted of blackcurrant powders obtained through lowtemperature drying.The drying stage of the currant solution process was controlled at a fixed inlet air temperature of 80 • C and an outlet air temperature of 50 • C to maintain the properties of the nutrients [13].The currant solution was the obtained currant concentrate and an appropriate amount of the selected carrier.In the process of realizing the project, concentrated blackcurrant juice (blackcurrant concentrate) with a density of 67 • Brix and a color coefficient of 2.352 (E520/E420) was obtained in the amount of 5 kg from a batch of 250 kg of this product from the company Białuty Sp. z o.o.More details on how to obtain the solution and the properties of the currant concentrate, as well as the carriers, are included in the research study by Przybyl et al., 2023 [29].As part of the spray drying experiments, it was determined that the recognition of fruit powders would take place for the currant solution, which contains only 30% of the carrier.In order to obtain blackcurrant powders with a carrier, those that are indeed common in food were selected, i.e., cellulose (C70), inulin (IN70), maltodextrin (MD70), whey milk Protein (W70), fiber (F70) and gum Arabic (G70) [29].

Data Collection
In the first step of the research work, a data set was prepared based on microscopic images (scanning electron microscopy) of blackcurrant powders.The procedure for the preparation of the microscopic image was based on the information prepared when taking microscopic images involving the raspberry powders Przybyl, 2021 [13].The digital images with a resolution of 2048 × 1576 in .TIFF format of currant powder microparticles were obtained at 500 times magnification at a scale of 100 um (a total of 630 digital images).The dataset (learning set) contained 6 different classes of currant powders.Every class represents the obtained currant powder as a result of low-temperature drying with a specific carrier, and moreover, the same number of images, i.e., 105 microscopic images each in the catalog.The learning set was assigned 6 catalogs corresponding to blackcurrant powders with the selected carrier ID, i.e., class_W70, class_MD70, class_IN70, class_G70, class_F70, and class_C70.

Feature Extraction
in the learning (class_train) and test (class_test) sets, i.e., actual images of blackcurrant powders in the morphological structure, required reading and then the performance of a feature extraction process.In order to carry this out this process, the Canny filter was used.This is the most commonly used operator for revealing edges from an image.This process made it possible to detect microparticles of currant powders with a given media type in the 8-bit secondary image.

Texture Analysis
In the next step, an algorithm was developed to go from an image to a data vector.The aim of the activity was to prepare the image as a data vector for image analysis using representative features.In this step, the image texture for blackcurrant powder recognition was applied by using the well-known gray-level co-occurrence matrix (GLCM) [36], and the features energy, entropy, correlation, dissimilarity, homogeneity, and contrast were determined from the image for each case in the learning set [37][38][39][40].The GLCM features allow for the description of the texture of a selected part of the image with several numerical values.Using the GLCM matrix, the relationship between the pixel space and the gray level of the matrix can be described, allowing the texture features to be determined and calculating how often a pair of pixels with certain values occur over the gray band of the image (Przybyl et al., 2018) [36].The GLCM effectively extracts pixel fragments step by step to analyze the frequency of pixel pairs over the gray band of an image.Methods for calculating GLCM features were proposed in the work of Haralick et al. 1973 [41-43].Their implementation in the analysis of an image as a bitmap is possible, among others, using the Python language (Python ver.3.9) and the sci-kit image library.Individual GLCM discriminants are calculated according to the following formulas [14,[42][43][44]: Dissimilarity : Homogeneity : Energy : Correlation : Entropy :

Classifier Ensembles
In the next phase of the research problem, 35 classifiers were used to identify blackcurrant powders.In machine learning, different classifiers were tuned due to their hyperparameters [45][46][47] in order to find the most effective model for identifying currant powders.One of the 35 classifiers was a metaclassifier, which was used to improve the accuracy of classified data for comparison with single classifiers.The single machine learning algorithms used were decision trees (DF), random forest (RF), adaptive boosting (AdaBoost), bootstrap aggregating (bagging), stochastic gradient descent classifier (SGDClassifier), RidgeClassifier, perceptron, multilayer perceptron (MLPPerceptron), and GaussianProcessClassfier.DFs partition data into subgroups using specific decision conditions (hyperparameters) [48].RF is one of the machine learning methods that uses multiple decision trees for classification [49][50][51].The benefit of RF with respect to DF, seems to be the matching of each tree in RF to a different set of data, causing an increase in classification efficiency and thus controlling over-fitting of this model for the data.AdaBoost has focused on adaptive error matching of classifiers, increasing precision, especially for those weak classifiers [52][53][54].The bagging algorithm can quickly generate multiple copies of the same classifier while learning different subsets of data and generalizing the model [55,56].SGDClassifier applies a gradient optimization technique, minimizing loss functions [57].It can be a very flexible yet effective model, especially in the classification aspect.Another algorithm is RidgeClassifier based on ridge regression [58].This model was characterized by a high need for data control in optimizing the results, among other things.Another algorithm that was used to identify powders is GausianProcessClassfier [59].GausianPro-cessClassfier is a probabilistic type model used to estimate the probability distribution of data in a set.The model can be characterized by the fact that it offers flexibility in adapting to the learning data, especially when the data are irregular or complex due to their case complexity.Recent algorithms are perceptron-and MLPClassifier-type models [3,[60][61][62].These are classifiers based on the perceptron structure, which consists of 3 layers (input, hidden, and output) and gains from the greatest tuning of hyperparameters.
As a result, the set of classifiers for currant powder recognition consisted of 34 individual different classifiers, which differed, among other things, in the type of algorithm and choice of hyperparameters when initializing each model, and 1 metaclassifier.Table 1 presents the structure of each of these classifiers.Table 1 defines the hyperparameter tuning steps for each algorithm.Hyperparameters in MLPClassifier neural networks specify input variables such as the number of hidden layers, the number of neurons in each hidden layer, the activation function, the optimization algorithm, and the loss function.In the case of applying hyperparameters to decision trees, the key element in the structure was the max-depth hyperparameter, which denoted the max-depth, i.e., the number of levels into which the tree can branch [63].This is the main hyperparameter, among others, affecting the optimization of the model to avoid so-called overfitting [64].In random forest, among the many hyperparameters, those that affect both the evaluation of the quality of the model and the control against overfitting of the algorithm were selected.As in decision trees, the level of branching was determined using the max-depth hyperparameter.In addition, the hyperparameters n_esitmators responsible for improving the model's classification accuracy and criterion = gini were included to assess measures of the model's quality [65,66].In the case of SGDClassifier, an additional hyperparameter affecting the optimization of the algorithm was the penalty parameter.The penalty hyperparameter assisted in the process of model tuning (optimization during learning) refers to the type of penalty set on erroneously specified cases in the test set [67].The purpose of regularization is to prevent model overfitting.The max-iter hyperparameter indicates at which epoch the model learning process should end [68].The perceptron-type algorithm uses the tol = 1 × 10 −3 hyperparameter, which is responsible for the tolerance to the error (tol) made on the test set.The smaller the tol value, the greater the chance of obtaining a more effective model accuracy result.The last algorithm in the set of classifiers is MetaClassifier.MetaClassifier is a combination of 3 individual classifiers such as logistic regression, bagging, and random forest.

Model Training and Testing
In this phase, the division of the data into a learning set and a test set was carried out.The division of the learning set to the test set was carried out in a ratio of 75:25.The choice of learning method, e.g., training and testing, translates into the fact that the data are divided into two sets of training and testing in a ratio of 75% to 25%.In Python, according to the specifics of the issue, it is performed using the train_test_test method, the so-called split sets.In the training and testing method, the process of selecting data randomly is carried out, i.e., the indexes of the learning cases are shuffled in a random order in order not to affect specific learning cases (i.e., with a given index) when learning models.It is important that data partitioning is carried out via normalization or standardization so as not to obtain bad model quality metrics (model performance).In this work using Python, features were normalized using the StandardScaler tool.In the next step, the process of teaching ensembles of classifiers was carried out.As part of the activity, a metaclassifier was added to compare the effectiveness of recognizing currant powders.
As part of the validation of the test set, learning quality indicators were presented by accuracy, precision, recall, and F1-score.A confusion matrix was used for the prediction of the acquired data.The learning process was performed using Python ver 3.9.

Results and Discussion
When designing the algorithms for the use of ensembles of classifiers, the architecture of each model was determined (Table 1), with the help of which the classification of blackcurrant powders with different types of carriers was applied.The results of the learning were presented with the quality indicators precision, recall, accuracy, and F1-score considering the criterion of image texture parameters using the GLCM (Tables 2-7).As a result of the machine learning process, a learning quality criterion of more than 0.7 was established for the models.This means that out of 35 classifiers (Figures 1-6), only single classifiers and a metaclassifier were selected that scored higher than the criterion.From the aspect of machine learning, confusion matrices are an important tool when evaluating the performance of classifiers.They allow a complete analysis of the prediction results on the test set and assist in the analysis of identifying the number of correct and incorrect classifications for each class, reflecting the performance of individual models [69].Figure S1 shows the confusion matrices for all 35 algorithms.Relating to the performance quality criterion for the Entropy attribute, recognizing individual currant powders with different media unambiguously the metaclassifier along with the single bagging classifier showed 100% predictability for each of the 6 classes of currant powders.Each of the 35 cases were predicted as individual classes from 0-5 (presented in Figures S1-S6).A comparison of other single classifiers included Bagging_100, for which a hyperparameter n_estimators of 100 was added, suggesting to the algorithm that if the number of estimators was increased, the generalization ability would improve.As a result, The research on the recognition of different types of blackcurrant powders using different classification algorithms showed that the random forest algorithm was the most effective single classifier.In the context of the used carriers to distinguish currant powders, this algorithm achieved the best results.Coefficients of precision and recall, as well as F1-score, are key efficiency metrics of the extracted classifiers.It turned out that also for the random forest algorithm, all of these metrics were the highest.That means that this algorithm achieved the highest ability to accurately recognize currant powders.The high level of precision explains that random forest has a small number of false positives, while the high recall shows a high ability to detect most existing learning cases.It is worth noting that other algorithms also showed fairly high performance in recognizing fruit powders, including bagging and decision tree, among others.These aforementioned machine learning methods were also effective in recognizing currant powders, and this translates into also using them for various approaches in support of fruit powder analysis.In the result of machine learning for comparison, Tables 2-7 for individual image texture characteristics using the GLCM matrix showed the of the metaclassifier as well, which was equally effective in identifying currant powders.The metaclassifier achieved the highest result when identifying currant powders where the image attribute was entropy (Figure 1) and homogeneity (Figure 6) coefficients.In the case of contrast (Figure 3), correlation (Figure 4), and dissimilarity (Figure 5) attributes, RF_gini was the most effective single classifier.The last attribute in the GLCM related to the energy index (Figure 2) showed the highest recognition efficiency with the Bagging_100 model.In Tables 2-7, it can be observed that the metaclassifier mostly has the highest precision rate with respect to all other single classifiers.This means that effective methods were selected at the data preprocessing stage for currant powders, appropriate machine learning algorithms were selected to obtain an effective metaclassifier, and good tuning of hyperparameters was achieved, obtaining optimal accuracy rates as a result of the learning process.
From the aspect of machine learning, confusion matrices are an important tool when evaluating the performance of classifiers.They allow a complete analysis of the prediction results on the test set and assist in the analysis of identifying the number of correct and incorrect classifications for each class, reflecting the performance of individual models [69].Figure S1 shows the confusion matrices for all 35 algorithms.Relating to the performance quality criterion for the Entropy attribute, recognizing individual currant powders with different media unambiguously the metaclassifier along with the single bagging classifier showed 100% predictability for each of the 6 classes of currant powders.Each of the 35 cases were predicted as individual classes from 0-5 (presented in Figures S1-S6).A comparison of other single classifiers included Bagging_100, for which a hyperparameter n_estimators of 100 was added, suggesting to the algorithm that if the number of estimators was increased, the generalization ability would improve.As a result, the algorithm successfully classified classes except for class 2, which was predicted almost perfectly (32 out of 35 cases); the remaining cases were falsely recognized and assigned to class 1 and class 4. When analyzing the entropy parameter of the currant powder image for decision tree algorithms (DT0 and DT_best), classes 1, 3, and 5 were perfectly classified.However, when increasing the branching level for decision trees (DT5), the measure of learning accuracy deteriorates (Table 1).In the case of random forests, there is an inverse relationship of the obtained results of learning quality which translates into the results of prediction and the degree of recognition of cases for each class of currant powders.The greater the degree of branching (depth level) of random forests, the worse the accuracy in identifying results.When looking at other algorithms and the selection of hyperparameters when initializing models such as MLPClassifier, perceptron, and SGDClassfiier clearly failed in identifying individual classes of currant powders, falsely assigning all cases, usually for one class only.This confirms the difficulty of identifying multi-decisions as opposed to binary classification.The algorithms associated with AdaBoost, SVM, and GausianProcessClassfier attempted to identify individual classes only no longer as successfully as those presented in Table 1.Their accuracy rate was well below the quality criterion set for individual models.
In order to interpret the other confusion matrix (Figure S2) considering the second image texture attribute, i.e., energy (Table 3), it was observed that the confusion values are not as high as in the case of powder recognition using the entropy attribute (Table 1) but are significantly comparable to the homogeneity (Table 7) and contrast (Table 4) attributes.This is due to the fact that the metaclassifier acquired a precision quality index of 0.85 ± 0.01.Dissimilarity and correlation attributes in the case of the metaclassifier reached a much worse value.
Analyzing the contrast, dissimilarity, and correlation attributes, RF7_gini turned out to be the most effective algorithm.This model was tuned with two hyperparameters.The first one was used to generalize the model by determining the depth level (max-depth = 7) of random forests, and the second one was allowed to assess the quality of the model using the gini criterion as a criterion for the effectiveness of more precise recognition of currant powders.The confusion matrices (Figures S3-S5) for contrast, correlation, and dissimilarity do not assess the effectiveness of the algorithms in recognizing currant powders so perfectly.However, it is still possible to predict individual cases with some estimation error for currant powders and assign them as falsely recognized classes.
When predicting confusion matrices (Figure S6), due to the homogeneity attribute, there is similarity to the entropy attribute, which translates into recognition efficiency for these currant classes.The most effective models for these attributes were metaclassifier, bagging, and Bagging_100.Nevertheless, there is a certain relationship distinguishing these attributes.If currant powders were recognized with the random forest algorithm, it more effectively identified the entropy attribute than homogeneity.Attribute homogeneity grouping classification accuracy showed that decision trees are treated as the weakest algorithms.In contrast, the opposite was true for the entropy attribute.The worst results were obtained with random forest knowing that these are still classification results much higher than with homogeneity.
In the literature and research experiments, it can be shown that GLCM-based attributes are an effective tool for analyzing images, including food images.In a recent study, attributes including entropy were shown to be one of the key features for identifying cereal grains during a seeding trial with different operating speeds of a seed sowing machine [14].In other research on strawberry powders, the uniqueness of attribute recognition using the GLCM was also demonstrated [36].On the other hand, in the analysis of defects in infested rapeseed grains with the GLCM, the relationships between test classes were analyzed just as effectively [70].When assessing the quality, condition, and color parameters of dried sweet potatoes based on images (indirectly through the GLCM matrix), it was also quite successful in assessing the relationships between different classes [71].When confronted with operations on different food matrices using THE GLCM, attribute sensitivity was also noted, which may depend on the degree of structure of the object pattern and the distance between image pixels.It was also noted that modern techniques based on machine and deep learning were more effective in solving problems than what was achieved using traditional techniques.In this research applying blackcurrant powder recognition, it seemed important to select the method for the data used, i.e., microscopic images.The application of a metaclassifier proved to be the most effective model for identifying blackcurrant powders.The ensembles of classifiers extracting single classifiers, i.e., random forest, decision tree, or bagging have become a better solution than the existing neural modeling tools [47,55,58,63,72].But the important thing is that the choice of method depends on the specific task at hand and the number of cases in the learning set.

Conclusions
In this research, we identified fruit powders with different types of carriers contained in the blackcurrant concentrate.Image texture discriminators based on the GLCM matrix distinguished the quality classes of blackcurrant powders.
The most effective classification models for fruit powders turned out to be random forest and metaclassifier algorithms.Using the metaclassifier architecture, it was possible to determine 100% classification accuracy for the entropy coefficient, 85% classification accuracy for the homogeneity coefficient, 83% classification accuracy for the energy and contrast coefficients, 77% classification accuracy for the dissimilarity coefficient, and 70% classification accuracy for the correlation coefficient.In comparison, the single random forest classifier achieved significantly approximate values for individual image texture coefficients.The application of image texture and machine learning algorithms proved to be an effective method for identifying currant powders.In fact, this merits further research

Figure 1 .
Figure 1.Classifier accuracy rate on the test and learning set for the individual GLCM attributes-ENTROPY.

Figure 2 .
Figure 2. Classifier accuracy rate on the test and learning set for the individual GLCM attributes-ENERGY.

Figure 2 .Figure 3 .
Figure 2. Classifier accuracy rate on the test and learning set for the individual GLCM attributes-ENERGY.

Figure 4 .
Figure 4. Classifier accuracy rate on the test and learning set for the individual GLCM attributes-COOREALTION.

Figure 3 .
Figure 3. Classifier accuracy rate on the test and learning set for individual GLCM attributes-CONTRAST.

Figure 3 .
Figure 3. Classifier accuracy rate on the test and learning set for individual GLCM attributes-CONTRAST.

Figure 4 .
Figure 4. Classifier accuracy rate on the test and learning set for the individual GLCM attributes-COOREALTION.

Figure 4 .
Figure 4. Classifier accuracy rate on the test and learning set for the individual GLCM attributes-COOREALTION.

Figure 6 .
Figure 6.Classifier accuracy rate on the test and learning set for the individual GLCM attributes-HOMOGENEITY.

Figure 6 .
Figure 6.Classifier accuracy rate on the test and learning set for the individual GLCM attributes-HOMOGENEITY.

Table 1 .
The structure of hyperparameters in tuning algorithms for ensembles of classifiers.

Table 2 .
Results of learning classifiers on the test set for the individual attributes of GLCM-ENTROPY.

Table 3 .
Results of learning classifiers on the test set for the individual attributes of GLCM-ENERGY.

Table 4 .
Results of learning classifiers on the test set for the individual attributes of GLCM-CONTRAST.

Table 5 .
Results of learning classifiers on the test set for the individual attributes of GLCM-COORELATION.

Table 6 .
Results of learning classifiers on the test set for the individual attributes of GLCM-DISSIMILARITY.

Table 7 .
Results of learning classifiers on the test set for the individual attributes of GLCM-HOMOGENEITY.

Table 3 .
Results of learning classifiers on the test set for the individual attributes of GLCM-ENERGY.
Figure 1.Classifier accuracy rate on the test and learning set for the individual GLCM attributes-ENTROPY.

Table 4 .
Results of learning classifiers on the test set for the individual attributes of GLCM-CONTRAST.

Table 5 .
Results of learning classifiers on the test set for the individual attributes of GLCM-COORELATION.

Table 5 .
Results of learning classifiers on the test set for the individual attributes of GLCM-COORELATION.