Machine Learning Applied to Near-Infrared Spectra for Chicken Meat Classification

Department of Computer Science (DC), State University of Londrina (UEL), 86057-970 Londrina, PR, Brazil Department of Zootechnology, State University of Londrina (UEL), 86057-970 Londrina, PR, Brazil Science Institute of Mathematics and Computers (ICMC), University of São Paulo (USP), 13566-590 São Carlos, SP, Brazil Department of Food Engineering, University of Campinas (Unicamp), 13083-862 Campinas, SP, Brazil Department of Food Science, Federal University of Technology (UTFPR), Londrina 86020-430, PR, Brazil


Introduction
Near-infrared spectroscopy (NIRS) has been used for prediction of physicochemical properties of food, being applied to objective control and monitoring of food quality [1].Also, it is a sustainable alternative as it requires no chemicals that might harm the environment and are hazardous to human beings.e near-infrared spectrum comprises a large set of overtones and combination bands.Selecting a few essential wavelengths related to the response information can reduce significantly the amount of data to be analyzed, providing information for the development of multispectral systems.In this way, multivariate statistical methods could be used for extraction of detailed information of the spectra [2].
Implementation of NIRS as a process analytical technology (PAT) to the food industry involves a multidisciplinary approach in which computational intelligence (CI), particularly machine learning (ML) [3][4][5][6][7][8][9][10], has been investigated.e main advantage of CI is its capacity of handling multiple parameters, facilitating fast and accurate evaluation of samples in an industrial environment [11].
Multilayer perceptron (MLP) neural network was used to correlate Fourier transform infrared (FTIR) spectral data with beef spoilage, with good performance of the classifier with 10 neurons in the hidden layer providing a 90.5% overall correct classification [12].
Argyri et al. [15] explored SVM applied to beef samples under different packaging conditions by spectroscopy and sensory analysis in order to predict fresh, semifresh, and spoiled samples.It was reported that the ML techniques (including artificial neural networks (ANN)) provided improved prediction models with 87.50% accuracy, for the various groups when compared to multivariate statistical methods.Qiao et al. [18] predicted beef eating quality attributes, namely, colour, ultimate pH, and slice shear force (SSF) using spectroscopy methods, achieving prediction results over 96% using SVM on three datasets.
One of the SVM limitations is the selection of the kernel function and its hyperparameters values.SVM cannot identify more than two label (binary classification) data efficiently [19,20].Another disadvantage is complex training for a large training set, as each class must be taught against all data from all other classes [21], thus making SVM application in the meat industry more challenging [13].e disadvantage of approach parametrization also occurs in ANN architecture, which uses empirical experimentation.In addition, a choice of a kernel demands experience on the ANN types, such as backpropagation neural network (BPNN), multilayer perceptron (MLP), or radial basis function (RBF).Hence, both approaches (ANN and SVM) can only handle numerical attributes, which in practical terms demand data preprocessing and normalization.
Decision Tree (DT) induction algorithms allow handling the limitation of a high number of classes (different from traditional SVM kernels), empirical selection, and ANN setup [20].e majority of the DT induction algorithms can handle different types of attributes (numerical/categorical) and even missing values.Additionally, DTs yield accurate multiclass classifiers and improve predictive performance with multiclass problems directly [22].
REPTree is a fast learner DT induction algorithm that builds a Decision Tree based on information gain as the splitting criterion and prunes it by reduced-error pruning [23,24].REPTree is a useful Decision Tree method because of the ability to deal with different scenarios [23].A comparison among different DT and other highly accurate algorithms (e.g., random forest) demonstrated that REPTree obtained the best performance of DT algorithms [25].When compared to J48 and SimpleCart, REPTree achieved the best results regarding the reduced-error pruning [24].A previous work reported the comparison between SVM and REPTree applied to the physical and chemical attributes of chicken meat, namely, pH, WHC, and colour features.e results show that REPTree achieved better results for classification of samples according to quality grades [26].
M5P is another algorithm to build Decision Trees, where leaves are linear models [22].It is useful for wavelength selection and has advantages compared to traditional prediction algorithms, including the ability to deal with both categorical and continuous variables and to handle variables with missing values [27].Zhang et al. [28] presented a comparison among M5P and two linear regressors: ridge linear regression (RLR) and support vector regression (SVR) for multilabel classification focusing on space dimension reduction.
Witten et al. [22] described the Decision Table (DTable) as a type of a classifier for scheme-specific attribute selection.Subramanian et al. [29] described that the DTable is better than DT in the problem-solving task when the number of attributes is large, existing the risk of ambiguities and omission.In [30], it was applied to understand the features in a fault diagnosis scenario owing to facilitate the model design.
Consumption of chicken meat has increased worldwide, with chicken processing industry playing an important economic role.Guaranteeing high-quality chicken meat is essential to keep the supply chain and a major demand from consumers.
Physical and chemical parameters such as colour, water holding capacity (WHC), and pH are often used to classify chicken meat in quality grades, such as pale, soft, and exudative (PSE); dark, firm, and dry (DFD); and normal (N) or pale (P) samples [31].However, these techniques are laborious and time-consuming for the fast-processing lines of the meat processing industry [32].us, novel methods for fast, objective, and reliable meat quality classification are needed.us, the main objective of the current work is to use machine learning approaches on different wavelengths obtained by NIRS spectra, colour (CIE L * a * b * , chroma, and hue), WHC, and pH to classify chicken meat samples according to quality grades.Considering the limitations of some ML approaches, in this work, we perform the quality assessment based on Decision Trees and Decision Table, more precisely: M5P, REPTree, and Decision Table algorithm.In addition, we further extend previous tests [26].In order to compare the selected approaches with current literature, we use an SVM based on training by sequential minimal optimization (SMO) with a normalized PolyKernel, enhanced for multiclass scenarios based on feature subsets using best-first search.To evaluate the supervised ML approaches, the classification of selected wavelengths was based on class labels (PSE, DFD, N, and P).

Preparation of Poultry
Samples.Slaughtered chicken breast fillets (pectoralis major muscle) were selected by an experienced analyst to comprise as large variation in quality features as possible.All samples were supplied by local retailer in two batches: n(total) � 158 samples, within 5 h after slaughtering and transported under refrigerated conditions to the Laboratory of Food Science at State University of Londrina, Londrina-PR, Brazil, for further analysis [33].e central part of each sample was carefully trimmed with a surgical scalpel to fit into a sample cell (ring cup) for NIR spectral acquisition.Subsequently, samples were minced using a kitchen chopper for 10 s, and NIR spectra were then acquired for minced meat samples.Near-infrared spectra were collected and analyzed in a near-infrared spectrometer, FOSS NIR Analyzers XDS ™ , in the wavelength range of 400-2500 nm.

Quality of Poultry
Meat.Chicken quality attributes were measured at 48 h postmortem, since it is within this time that most of the biochemical changes in meat take place [34,35].
After a 30 min blooming period, ultimate pH values were measured using a Testo 205 (Testo AG, Lenzkirch, Germany); the average of two measurements was taken for each sample.
Colour features were calculated as the average of four consecutive measurements at random locations of samples using a Minolta colorimeter (CR 400, D65 illuminant, and 10 °observer, Konica Minolta Sensing Inc., Osaka, Japan) after calibration with a standard ceramic tile.Colour was expressed in terms of values for lightness (L * ), redness (a * ), and yellowness (b * ) using the Commission Internationale de l′Eclairage (CIE) colour system [36,37].
Water holding capacity (WHC) was calculated based on meat water loss when pressure is applied on the muscle [38].Cubic pieces of samples weighing 2 g were laid between two filter paper circles placed on acrylic plates, on which a 10 kg weight was put for 5 min, with the samples and then removed from the filter papers, and weighted.Water loss was calculated as the difference between the initial and final weight.Results were expressed as the percentage of drip loss relative to the initial sample weight.

Wavelength Selection.
In order to achieve an efficient dimensionality reduction, correlation-based feature selection (CFS) was applied to remove irrelevant and redundant information from the spectra.
is method is based on a degree of dependence or predictability of a wavelength with another, indicating the best subset of features for classification.Yu et al. [39] described that CFS exploits bestfirst search based on some correlation measurement that evaluates the appropriateness of a subset by the individual predictive ability of each feature and the degree of correlation between them.It was also applied a Decision Table, REPTree, and M5P classifiers that have an inherent characteristic of attribute selection, reducing dimensionality, and providing a classification model, were applied [40].
e first step of feature selection was to identify the relevant technological (pH, WHC, and colour) attributes assessed by classification in categories PSE, P, N, and DFD.
e referenced quality attributes were processed by CFS, and the best subset was obtained (Figure 1).
After identification of the best subset merit, wavelength selection was performed focusing on attributes of the best subset.Considering an imbalanced dataset, a resampling method was applied to obtain a uniform class distribution.us, the best subset was calculated in different scenarios: balanced and imbalanced dataset to validate the best subset obtained.
In order to obtain a unique set of attributes, named as C a , a merge of best subset attributes of raw (original subset), A n , and the resampled subset, B m , was performed.e second step was the application of algorithms CFS, Decision Table, REPTree, and M5P to describe the correlation between C a and wavelengths, individually.Finally, the second merge among best wavelengths for each a results in the final wavelengths that were used as a sample descriptor in the classification task.CFS, Decision Table, REPTree, and M5P had different sets of wavelengths.Descriptors were referred as W CFS , W DTable , W RepT , and W M5P .SVM, as SMO support vector machine based on polynomial kernel [41,42], was applied in W CFS , all wavelengths, and traditional parameters to establish a comparison with traditional ML approaches because SVM has no dimension reduction properties.

Classifier Evaluation. Wavelength selection was compared by coefficient of correlation (CC), mean absolute error (MAE), and root mean squared error (RMSE).
e first illustrates a quantitative value of the relationship between the subset of wavelengths, W, and the most significant traditional attributes found, C a .MAE measures the average magnitude of the relationship between C a and W. Finally, RMSE is a quadratic scoring of the average magnitude of the error.In other words, the greater difference between MAE and RMSE illustrates more significant variance in individual errors of samples.A similar value of RMSE and MAE means that all the errors present the same magnitude.
e accuracy of the model for quality classification was assessed by confusion matrices as the final output from 10fold cross-validation (CV) over 30 repetitions.
is was adopted because it was used as a four-class dataset (namely, PSE, DFD, P, and N) without overlapping.Confusion matrices represent appropriate evaluation criteria to select the most suitable classifiers (REPTree, M5P, and Decision Table ).
True positive (TP) and true negative (TN) mean that a sample was correctly recognized, and it is the desired result.False positive (FP) and false negative (FN) occur when the ML approach, incorrectly, classifies a sample assigning a wrong class.
e average per-class effectiveness of a classifier was measured by average accuracy.
e average per-class agreement of the data class labels with those of classifiers was estimated by Precision, and the average per-class effectiveness of a classifier to identify class labels was estimated by Recall.F-Measure is the harmonic mean of Precision and Recall and allows us to determine if one algorithm is superior to another as a particular goal.e results were also summarized in a critical difference (CD) diagram, as previously proposed in [43].

Wavelength Subset Selection.
As Table 1 indicates, pH and L * present a gradient distribution along with the classes addressed.All the samples matched the quality criteria used, supporting the classification into one of the four possible classes.
e poultry dataset consisted of 158 samples, comprising 24, 86, 41, and 7 samples of classes PSE, P, N, or DFD, respectively.Step 1 (Figure 1) consisted in the application of CFS in order to find the best subset of attributes based on subset merit.e selected attributes were A n � pH, L *   with Merit s � 0.816.e same approach was performed on the balanced dataset to corroborate the subset found.
e balanced dataset was created using a technique of resampling that removes the sample of maximal classes, namely, PSE [24], P (86), and N [41].After resampling, the balanced dataset was composed of 12, 7, 6, and 6 samples of PSE, P, N, and DFD, respectively.e selected attributes were pH and L * that  Step 2 was performed using CFS, DTable, REPTree, and M5P algorithm to identify the most relevant wavelengths for C 1 � pH and C 2 � L * , as shown in Table 2.
CFS evaluation was based on Merit and was not compared to the others, which were evaluated by coefficient of correlation and error rates.Independent of measurement, the higher correlation (or Merit) was obtained by selected wavelengths to perform L * prediction.
M5P algorithm identified 12 wavelengths for pH description and obtained 0.80 as a coefficient of correlation, obtaining the higher pH correlation value and lower error (MAE and RMSE).Based on these 12 wavelengths, M5P was capable of reducing to only linear model (Appendix A.1), without designing a tree.
For L * , M5P algorithm achieved the highest correlation (0.95) and lower error values (Figure 2).us, the combination of wavelengths identified by M5P comprises W M5P , used for further classification.
Considering 1880 nm, REPTree and M5P found a similar amplitude value of 2.29 as a threshold to obtain a classification (Figures 2 and 3).It is possible to observe that REPTree applied the second verification using 626 nm or 460 nm to achieve the final result (Figure 3).For pH, the REPTree model creates a tree (Figure 7) based on 6 wavelengths, not observed in M5P selection.However, even M5P containing a lower number of nodes achieves superior correlation results, justified by the use of linear models to identify a class in the leaf node.
A significant result regarding wavelength reduction was observed in Decision Table, which reduces L * identification to only one wavelength, 442 nm (Table 3).Using 442 nm and a Decision Table, a coefficient of correlation of 0.91 by 10 rules was obtained.For pH, Decision Table algorithm obtained 37 rules based on 5 wavelengths, as shown in Table 7.
Among the selected wavelengths, it was observed that 608 nm, which is related to the red colour in the visible spectrum, was into the best subsets for W CFS , W DTable , and W M5P for pH identification.Independently of the algorithm, pH required more wavelengths than L * , an average of 6 wavelengths against 3.5, respectively.
Most of the wavelengths identified are closely related to the yellow-red colour in the visible spectrum (570-750 nm), Journal of Spectroscopy which is the main range where chicken meat colour varies.
Regarding the NIR spectrum, the main wavelengths identified were 968 nm, which is related to the O-H stretching associated to water, 1354 nm, associated to C-H stretching, and 1880 nm, associated to O-H stretching [44].

Poultry Quality Classification.
To compare the algorithms, SVM was induced over W CFS and full-wavelengths dataset; DTable over W DTable and W M5P ; and REPTree over W RepT , full wavelengths, and traditional parameters, as shown in Table 4.After 30 repetitions, the standard deviation of weighted average was about 0.006 (DTable), 0.009 (Decision Table over M5P selection), 0.017 (REPTree), and 0.004 (SVM) for data presented in Table 4.
e standard deviation of the experiments presented in Table 5 was about 0.008 for REPTree and 0.007 for SVM.Finally, the standard deviation of experiments highlighted in Table 6 was about 0.002, 0.008, and 0.007 for SVM, REPTree, and REPTree over pH and L, respectively.
Considering the approaches that handle the selected wavelengths, REPTree achieved the best results with higher precision (0.740).When compared to SVM, the other algorithms provided better results for multiclass evaluation. is was observed for PSE and DFD samples, where the values for parameters TP, FP, Precision, and F-Measure were zero, meaning that none of these samples was correctly classified.However, P and N samples achieved good results of TP by SVM, as well as F-Measure.However, the poor results observed for PSE and DFD corroborate previous investigations [13,[19][20][21], highlighting the limitation on a multiclass scenario.
e ability to overcome this limitation was observed for REPTree. is algorithm was superior to SVM but was not feasible for multiclass identification based on W DTable .It is possible to see in Table 4 that DTable obtained a zero value in measurements for PSE samples.Better results of DTable was on W M5P , which achieved the lower FP rate on PSE samples.In general, it was observed that REPTree was the best approach, followed by DTable on M5P subset.Pure DTable and SVM on the CFS subset presented limitations on the multiclass scenario currently investigated.
It was observed that DFD and PSE were the classes with the smaller number of samples misclassified by SVM and DTable.ere were fewer DFD samples (7) compared to P samples (86).To investigate the balancing effect over SVM, DTable, and DTs, the same experiments on the balanced dataset were performed, and the results obtained were similar.SVM and DTable algorithms are limited to handle a multiclass scenario, thus being better for binary problems.
SVM and REPTree were compared to support the hypothesis of high dimensionality influence on classification accuracy.e results of SVM applied to the full wavelengths dataset are presented in Table 5.
e same behavior of limitation on multiclass scenarios (recognition of PSE and DFD was deficient) and lower results in SVM precision (0.531) were performed.
REPTree achieved good results, based on full wavelengths: TP of 0.778, FP of 0.199, precision of 0.747, recall of 0.778, and F-Measure of 0.741 as observed in Table 5. Figure 3: Decision Tree of wavelengths that are correlated to L * prediction using REPTree, as shown in Table 2. REPTree provided slightly superior results over the wavelengths subset when using all wavelengths, with a difference of 0.006 of F-Measure.

Comparison between NIR and Traditional Attributes.
REPTree was applied on traditional parameters for classification of samples, achieving better results in comparison to NIR wavelengths.It achieved the higher value of TP and the lower value of FP with an F-Measure of 0.981.e results obtained for REPTree applied on traditional parameters are similar, once REPTree in both cases selects only pH and L * to construct the regression tree (Table 6). is fact is based on the strategy of Decision Tree being based on the most informative features computed by information gain/ratio.In other models, REPTree algorithm identifies pH, and L * is sufficient to solve the classification problem.It is possible to see in Table 6 that SVM algorithm over traditional parameters shows the same behavior of previous experiments, which could not handle the multiclass problem with robustness, obtaining 0.621 average precision.CFS was applied on the best subset (3.1) to observe the SVM algorithm over a subset of traditional parameters.An average precision of 0.626, similar to results based on all traditional parameters, was obtained.An advantage of wavelength selection is the complexity reduction of Decision Tree generated.It is possible to observe a 2 − level DTcomposed by four nodes (wavelengths), simpler than Decision Tree created by whole wavelengths (Figure 4).In this case, the Decision Tree created had four levels with ten nodes, a more complex solution as shown in Figure 5. is figure is an example of a tree designed, and once we perform 30 repetitions to evaluate the precision of the method, in other words, the wavelengths amplitudes can change for each model, but the wavelength selected was the same.
e complexity can be exemplified by the number of paths to reach the leaves of the tree.Based on DT presented in Figure 4, it was possible to classify PSE, DFD, and N samples with just one path for each class.In Figure 5, only DFD provided this observation.For instance, PSE has three different paths from the root to the leaf of classification.In order to compare the results obtained, Friedman's statistical test [43] with a significance level at α � 0.05 was applied.e null hypothesis here states that the performances of the induced classifiers are equivalent regarding the averaged accuracy per class.Any time the null hypothesis was rejected, the Nemenyi post hoc test was applied, stating that the performance of two different algorithms is significantly different whether the corresponding average ranks differ by at least a critical difference (CD) value.When multiple classifiers are compared in this way, the results can be represented graphically with a simple critical difference (CD) diagram.
Figure 6 shows the results of the statistical tests.us, according to the results, no significant differences were observed when comparing REPTree method to SVM (with the best subset by CFS) and DTable (over M5P selected wavelengths).SVM without wavelength selection was the worst method overall, while the DTable was the best one.
is suggests that the DTable method is the best approach, but this algorithm cannot handle PSE samples.SVM based on CFS presented the same problem for PSE and DFD.us, REPTree model is a feasible choice (Figure 4).
Based on the methodology applied in the current work, it was possible to observe that ML approaches could have a substantial impact on spectral data analysis.Differently from traditional applications of SVM and ANN, which require several parametrizations and create a "black box" output model, the results presented show the potential of Decision   e wavelengths detected as optimal for classification task are in the visible range of the spectra which allow the creation of simple acquisition devices.is equipment could substitute the use of colorimeter, pH meter, texture meter, and WHC evaluation environment.Another advantage is the alternative of traditional NIRS equipment, where a simple device limited to a few wavelengths could achieve similar analysis.On the contrary, a pH meter associated with a colorimeter could provide satisfactory results with similar accuracy to NIR, by using proper data processing techniques.In addition, it is common practice to measure pH in the meat processing industry, as it affects several other attributes (i.e., colour and WHC).Predicting the pH could be an alternative to compare the model accuracy to the measured value of this attribute.In addition, for industrial processing lines, it could represent a fast method for a huge number of samples.

Conclusion
Poultry meat quality assessment is possible based on spectral analysis considering few selected NIR wavelengths.All wavelengths are in the visible range of the spectra which allow the creation of simple acquisition devices based on low-cost components.

On the contrary, the use of Decision Table and Decision
Trees induction algorithms to avoid complex configurations or necessity of expertise on a particular technique was proposed.SVM and DTable presented limitations when applied to multiclass scenarios.DT models (REPTree) obtained superior results of performance while achieving a comprehensive model that describes the optimal wavelengths.
found B m � pH, L *   with Merit s � 0.870.e range of pH values in the database was 5.62 and 6.43, with an average of 5.95 and standard deviation of 0.15.Luminosity values L * feature subset selection (CFS) { pH, L * , a * , b * , a * /b *

Figure 4 :
Figure 4: Example of Decision Tree of W RepT for poultry classification created by the REPTree algorithm.
* prediction, by using selected wavelengths, as shown in Table2.

Table 3 :
Decision Table for L * identification based only on 442 nm.
Table and Decision Tree as an alternative to performing a multivariate spectral subset selection, in addition to constructing accurate and visual prediction models.e step of attribute selection contributed to a best wavelengths comprehension, diminishing dimensionality of