Exploring Deep Learning to Predict Coconut Milk Adulteration Using FT-NIR and Micro-NIR Spectroscopy

Accurately identifying adulterants in agriculture and food products is associated with preventing food safety and commercial fraud activities. However, a rapid, accurate, and robust prediction model for adulteration detection is hard to achieve in practice. Therefore, this study aimed to explore deep-learning algorithms as an approach to accurately identify the level of adulterated coconut milk using two types of NIR spectrophotometer, including benchtop FT-NIR and portable Micro-NIR. Coconut milk adulteration samples came from deliberate adulteration with corn flour and tapioca starch in the 1 to 50% range. A total of four types of deep-learning algorithm architecture that were self-modified to a one-dimensional framework were developed and tested to the NIR dataset, including simple CNN, S-AlexNET, ResNET, and GoogleNET. The results confirmed the feasibility of deep-learning algorithms for predicting the degree of coconut milk adulteration by corn flour and tapioca starch using NIR spectra with reliable performance (R2 of 0.886–0.999, RMSE of 0.370–6.108%, and Bias of −0.176–1.481). Furthermore, the ratio of percent deviation (RPD) of all algorithms with all types of NIR spectrophotometers indicates an excellent capability for quantitative predictions for any application (RPD > 8.1) except for case predicting tapioca starch, using FT-NIR by ResNET (RPD < 3.0). This study demonstrated the feasibility of using deep-learning algorithms and NIR spectral data as a rapid, accurate, robust, and non-destructive way to evaluate coconut milk adulterants. Last but not least, Micro-NIR is more promising than FT-NIR in predicting coconut milk adulteration from solid adulterants, and it is portable for in situ measurements in the future.


Introduction
Adulteration in agriculture and food products is an essential safety and control area requiring rapid, accurate, robust, and automated methods for detecting, identifying, and quantifying adulteration, including coconut milk products.Coconut milk is generally extracted from grated coconut meat after pressing or squeezing with or without the addition of water.Coconut milk has been used as a major ingredient in several cuisines, such as curries and desserts [1].There are two common reasons for adulteration in coconut milk products.The first reason is to increase production volume and reduce costs by adding tap water or old coconut water to coconut milk.The second reason is an attempt to boost the apparent carbohydrate content by adding corn flour.
Accurately identifying adulterants is important for controlling coconut milk product adulteration.The main content of coconut milk (moisture, total fat, carbohydrates, protein, and ash) will be changed when mixed with other materials.As reported by Lakshanasomya et al. [2], laboratory testing can measure the total solids and total fat in coconut milk by drying it in a hot air oven or using a vacuum oven, which takes more than 2 h to prepare one sample.Although accurate, this method is time-consuming and requires complicated sample pre-treatments and well-trained technicians, so it cannot be relied on to carry out rapid monitoring.Near-infrared (NIR) and mid-infrared spectroscopy have Sensors 2024, 24, 2362 3 of 23 of studies using the CNN algorithm in NIR-based adulteration detection for agricultural and food products.
To the best of our knowledge, even though coconut milk adulteration was investigated with another adulterant material and another type of spectroscopy [3,6], no study explored deep learning as advanced computational algorithms for quantifying adulterants by two types of NIR spectroscopy, including benchtop FT-NIR and portable Micro-NIR and by two types of solid adulterants, including corn flour and tapioca starch.Therefore, the objective of this study was to bridge the gap between advanced perceptual sensors from NIR spectroscopy and data science by developing and testing the performance of four types of regressor architecture CNN of deep-learning to detect coconut milk adulteration from corn flour and tapioca starch.

Sample Collection
This study comprised two parts.The first part was to detect the level of coconut milk adulteration by corn flour and tapioca starch using a benchtop FT-NIR spectrometer.The second part was to detect coconut milk adulteration levels by corn flour and tapioca starch utilizing a portable Micro-NIR spectrometer.For this purpose, the spectra of two potential adulterants (corn flour and tapioca starch) and coconut milk were collected.The adulterants were purchased from a grocery market around Lat Krabang, Thailand.Adulterant samples were stored at room temperature under clean and dry conditions.Coconut milk is the liquid extracted from mature coconut fruit's endosperm, with no added diluents like water or other materials.Coconut milk was obtained from traditional markets (Lad Krabang, Thailand) on 6 January 2024 and processed on the same day.
The coconut milk samples were adulterated by mixing the identified adulterant in the range of 1-50% (w/w) at different adulteration levels (approximately 1%, 2%, 3%, 4%, 5%, 6%, 7%, 8%, 9%, 10%, 15%, 20%, 30%, 40%, and 50%).The reasons for selecting adulteration levels in this study were as follows.Selecting different mixing levels can help represent various levels of mixing severity.Covering low mixing levels (1%) to high levels (50%) can provide a more complete view of the range of possible mixing situations that will be encountered in practice.Relevance to practical applications where mixing levels with minimum conditions for agriculture and food products are more likely to occur frequently in practical situations in the field so that they have a more significant impact on this study.Also, selecting various mixing levels can help test the model's calibration ability to detect mixing at various severity levels.This can help identify the extent to which the model is reliable in identifying mixing at different levels.
After the coconut milk samples had been intentionally adulterated to the level of conditions specified above, all samples were subsequently preserved in glass bottles at room temperature after being mixed in a glass beaker at a speed of 200 rpm for 1 min and allowed to equilibrate to ±25 • C before scanning.Ten samples were prepared at each level of adulteration and each of adulterant.Therefore, a total of 150 samples were prepared per type of adulterant.The total data analyzed in this study were higher than in the suggestion by Manley [15] that developing regression models, which must have at least more than 100 spectra to obtain a reliable model, has exceeded that.

NIR Spectroscopy Data Acquisition
NIR spectra were measured using a benchtop FT-NIR spectrometer (Bruker Ltd., Ettlingen, Germany) and a portable Micro-NIR spectrometer (MicroNIR OnSite-W, VIAVI Solutions Inc., Chandler, AZ, USA).Spectra in the 12,500-4000 cm −1 (800-2500 nm) region were recorded using the benchtop FT-NIR (Figure 1a) with an average spectrum of 32 scans into one spectrum at a resolution of 8 cm −1 .Secondly, portable Micro-NIR (Figure 1b) scanned in the spectra range from 908 to 1676 nm (11,013-5967 cm −1 ).The spectral resolution was set to 6.2 nm.The integration time and scan count were 10 ms and 100, respectively.FT-NIR and Micro-NIR were used together to obtain more complete and comprehensive information about NIR spectra of coconut milk samples adulterated with two potential adulterants (corn flour and tapioca starch).
A sample of coconut milk (1 mL) that was intentionally adulterated was taken to test a glass vial with a diameter of 20 mm and a height of 43 mm.After that, an aluminum reflector (with a path length of 0.35 mm) was also put in a test glass vial and placed on top of the benchtop FT-NIR and portable Micro-NIR spectrometer.Scanning was performed triplicated at the same spatial locations for each sample, accumulating 3 scanning ×10 samples ×15 level adulteration.All of the measurements were taken at room temperature (±25 • C).Scanning was performed in absorption mode (log 1/R).
Sensors 2024, 24, x FOR PEER REVIEW 4 of 24 respectively.FT-NIR and Micro-NIR were used together to obtain more complete and comprehensive information about NIR spectra of coconut milk samples adulterated with two potential adulterants (corn flour and tapioca starch).
A sample of coconut milk (1 mL) that was intentionally adulterated was taken to test a glass vial with a diameter of 20 mm and a height of 43 mm.After that, an aluminum reflector (with a path length of 0.35 mm) was also put in a test glass vial and placed on top of the benchtop FT-NIR and portable Micro-NIR spectrometer.Scanning was performed triplicated at the same spatial locations for each sample, accumulating 3 scanning ×10 samples ×15 level adulteration.All of the measurements were taken at room temperature (± 25 °C).Scanning was performed in absorption mode (log 1/R).

Data Handling for Modelling
The whole dataset in this study is 1800 NIR spectra consisting of 900 spectra scanned by benchtop FT-NIR and 900 spectra scanned by portable Micro-NIR.Each NIR spectrum acquired from these two instruments consists of 450 spectra from adulteration coconut milk by corn flour and 450 spectra from adulteration coconut milk by tapioca starch.From the NIR spectra data, each adulteration was split into training and testing subsets.The training data were used to develop a deep-learning model.Then, the models were applied to the test dataset to assess the predictive abilities of the models for predicting the adulteration level of coconut milk by corn flour and tapioca starch.Table 1 summarizes adulteration coconut milk data spectra, including NIR spectra data collected from benchtop FT-NIR and portable Micro-NIR.The number of training (70%) and testing (30%) data used in this study was 315:135 (separated using the random splitting method with a random state of 42).

Data Handling for Modelling
The whole dataset in this study is 1800 NIR spectra consisting of 900 spectra scanned by benchtop FT-NIR and 900 spectra scanned by portable Micro-NIR.Each NIR spectrum acquired from these two instruments consists of 450 spectra from adulteration coconut milk by corn flour and 450 spectra from adulteration coconut milk by tapioca starch.From the NIR spectra data, each adulteration was split into training and testing subsets.The training data were used to develop a deep-learning model.Then, the models were applied to the test dataset to assess the predictive abilities of the models for predicting the adulteration level of coconut milk by corn flour and tapioca starch.Table 1 summarizes adulteration coconut milk data spectra, including NIR spectra data collected from benchtop FT-NIR and portable Micro-NIR.The number of training (70%) and testing (30%) data used in this study was 315:135 (separated using the random splitting method with a random state of 42).

Deep-Learning Model Development
For analyzing the NIR datasets with deep-learning models, a unique structure is required to provide suitable training and improve the feature extraction process.The proposed deep-learning regressor model for predicting coconut milk adulteration in this study uses four types of network architecture that are modified to a one-dimensional framework was developed, including simple convolutional neural network (Simple CNN), A-AlexNet, ResNET, and GoogleNET, which are presented in Figure 2. The reason for using simple CNN was based on its effectiveness and efficiency in processing data, which is particularly suitable for relatively simple datasets [5].S-AlexNet was selected as an adaptation of the successful AlexNet architecture, offering a lighter architecture suitable for smaller datasets [16].ResNet was chosen for its ability to address the vanishing gradient problem and enable the training of deeper models, making it suitable for complex datasets requiring deep feature representations [17].GoogleNet was selected for its innovative architecture, particularly the efficient use of inception modules for feature extraction, making it ideal for complex datasets requiring multi-scale feature representations [18].In addition, the original spectral data were preprocessed using standard normal variate (SNV) to obtain input features spectrum to have zero mean and standard deviation of one.The SNV preprocessing effectively reduced specific noise appearing in the spectral data due to the effect of ambient light, the spectrometer used, and the type of lamp [19].
All types of network architecture model deep-learning training procedures in this study were performed using Adam optimizer.In the simple CNN network architecture (Figure 2a), the number of batches, epochs per running, validation split, and learning rate are 128, 1000, 10%, and 5 × 10 −3 , respectively.In the S-AlexNET network architecture (Figure 2b), the number of batches, epoch per running, validation split, and learning rate are 16, 300, 10%, and 10 −5 , respectively.In the ResNET network architecture (Figure 2c), the number of batches, epochs per running, validation split, and learning rate are 160, 1000, 10%, and 10 −5 , respectively.In the GoogleNET network architecture (Figure 2d), the number of batches, epochs per running, validation split, and learning rate are 160, 1000, 10%, and 10 −5 , respectively.The total running time is 11 times with early stopping patience of 200 epochs for simple CNN, ResNET, and GoogleNET and 300 epochs for S-AlexNET.All network architectures use random split validation at the training stage with 10% from the training dataset (10% × 315 = 32) with a random state 42.After that, the best deep-learning regression was evaluated with a testing dataset of as much as 135.
In this study, all of the deep-learning algorithms were programmed on the Jupyter-Lab interface using the open source platform Python version 6.5.4,Keras library version 2.13.1 [20] with TensorFlow version 2.13.0 backend [21].The CPU is Intel (R) core (TM) i9-13900H CPU @ 2.60 Ghz, and the graphics card is NVIDIA Geforce RTX 4060.

Performance Model Evaluation
The performance of models was assessed by the coefficient of determination, rootmean-square error, Bias, and the ratio of percent deviation (RPD), which were calculated by Equations ( 1)-(4).The higher coefficient of determination values and lower root-meansquare error and Bias indicate an accurate model.In food adulteration, spectral modeling follows predicting grain chemical composition content; RPD < 3.0 shows a poor and unreliable model; 3.1 < RPD < 4.9 indicates a fair model (just for screening); 5.0 < RPD < 6.4 shows a good model for quality control; 6.5 < RPD < 8.0 indicates very good model for process control, and RPD > 8.1 indicates an excellent capability of the model for quantitative predictions for any application [22].

Performance Model Evaluation
The performance of models was assessed by the coefficient of determination, rootmean-square error, Bias, and the ratio of percent deviation (RPD), which were calculated by Equations ( 1)-(4).The higher coefficient of determination values and lower root-meansquare error and Bias indicate an accurate model.In food adulteration, spectral modeling follows predicting grain chemical composition content; RPD < 3.0 shows a poor and unreliable model; 3.1 < RPD < 4.9 indicates a fair model (just for screening); 5.0 < RPD < 6.4 shows a good model for quality control; 6.5 < RPD < 8.0 indicates very good model for pro-Sensors 2024, 24, 2362 8 of 23 cess control, and RPD > 8.1 indicates an excellent capability of the model for quantitative predictions for any application [22].
where R 2 is the coefficient of determination; RMSE is root-mean-square error; RPD is a ratio of percent deviation; E i is the existing value for point to-i; P i is the prediction value for point to-i; N is the number of samples, and E is average of existing value.
To interpret the obtained models, this study proposes a method to visualize the regression coefficients of neural networks numerically.This method is modified from Cui and Fearn [8] and can be used for linear predictors.As a black box that maps the input spectrum, the predictor was treated to a single prediction value using Equation (5).The single total weight is calculated using Equation (6) (finite difference approximation) from the main Equation (7).
where w is the average of weight; w i is weight to-i; N is the number of samples; x 1 to x n is the absorbance of feature NIR spectra; b is the intercept, and ε is perturbation coefficient (10 −6 ).

NIR Spectra Features
NIR spectra to detect coconut milk adulteration in this study were acquired using two spectrophotometers, benchtop FT-NIR (450 spectra) and portable Micro-NIR (450 spectra).The original spectrum from the benchtop FT-NIR is presented in Figure 3a,b, and the original spectrum from the portable Micro-NIR is shown in Figure 3c,d.Figure 3a,c shows the FT-NIR and Micro-NIR spectra of coconut milk adulteration by corn flour from 1-50%.Meanwhile, the spectrum of FT-NIR and Micro-NIR of coconut milk adulteration by tapioca starch from 1-50% is shown in Figure 3b,d.The NIR spectrum indicates the presence of organic materials resulting from the interaction of molecular bonds of XH with the incident radiation from coconut milk, corn flour, and tapioca starch.The absorption peak positions appear almost indistinguishable, with only slight differences in absorption between adulteration levels.These bonds are subject to vibrational energy changes, including stretching and bending.The presence of strong water absorbance bands from FT-NIR was observed at around 5176 cm −1 (1932 nm) and 6889 cm −1 (1452 nm) because of the OH combination and its first overtone for both adulterant corn flour and tapioca starch.When utilizing Micro-NIR, strong water absorbance bands were identified around 1447 nm (6911 cm −1 ) as an OH first overtone and 1212 nm (8251 cm −1 ) as the second overtone of CH stretching for both the corn flour and tapioca stretching.
because of the OH combination and its first overtone for both adulterant corn flour and tapioca starch.When utilizing Micro-NIR, strong water absorbance bands were identified around 1447 nm (6911 cm −1 ) as an OH first overtone and 1212 nm (8251 cm −1 ) as the second overtone of CH stretching for both the corn flour and tapioca stretching.

Adulteration by Corn Flour
The results of the prediction of level adulteration corn flour in coconut milk utilization benchtop FT-NIR on training and testing data sets are presented in Table 2.The coefficient of determination (R 2 ) for all architecture network regressors was decreased from training to testing, which was inversely proportional to Bias and RMSE performance, which have increased from training to testing.As can be seen, all types of architecture networks have excellent performance model capability (RPD > 8.1) that can be expected for predictions of future samples.As for comparing the four architecture networks from the deep-learning regressor, the GoogleNET regressor (best RPD = 20.866)possesses much higher detection accuracy than the other regressor.In other words, this study may organize the performance of regressor analysis order according to its RPD as ResNET < Simple CNN < S-AlexNET < GoogleNET.However, the GoogleNET regressor requires a higher epoch than the others.

Calibration Models Development Base on FT-NIR 3.2.1. Adulteration by Corn Flour
The results of the prediction of level adulteration corn flour in coconut milk utilization benchtop FT-NIR on training and testing data sets are presented in Table 2.The coefficient of determination (R 2 ) for all architecture network regressors was decreased from training to testing, which was inversely proportional to Bias and RMSE performance, which have increased from training to testing.As can be seen, all types of architecture networks have excellent performance model capability (RPD > 8.1) that can be expected for predictions of future samples.As for comparing the four architecture networks from the deep-learning regressor, the GoogleNET regressor (best RPD = 20.866)possesses much higher detection accuracy than the other regressor.In other words, this study may organize the performance of regressor analysis order according to its RPD as ResNET < Simple CNN < S-AlexNET < GoogleNET.However, the GoogleNET regressor requires a higher epoch than the others.

Adulteration by Tapioca Starch
The results of the prediction of level adulteration tapioca starch in coconut milk utilization benchtop FT-NIR on training and testing data sets are presented in Table 3.It is clear that the GoogleNET regressor requires a more increased epoch than the others.The coefficient of determination (R 2 ) for all architecture network regressors was decreased from training to testing, which is conversely proportional to Bias and RMSE performances, which have increased from training to testing.If focused on RPD, all types of architecture networks have excellent performance model capability (RPD > 8.1), except ResNET (RPD < 3), which shows poor and unreliable performance.As for comparing the four architecture networks from the deep-learning regressor, the GoogleNET regressor (best RPD = 21.421)possesses a much higher prediction than the other regressor.If organized in the best possible way (based on RPD), the performance of deep-learning architecture network regressors of this study can be arranged into GoogleNET > S-AlexNET > Simple CNN > ResNET.The regression scatter plots of all architecture networks of deep-learning regression to predict level adulteration tapioca starch in coconut milk utilization FT-NIR are shown in Figure 6.The regression coefficient (slope) for all architecture network regressors decreases from training to testing, except S-AlexNET, which decreases very little (more than three decimal places), so the effect is minimal.Also, the intercept coefficient for all regressors is positive, while Simple CNN is negative for training.Inversely proportional to testing, all regressors are negative except S-AlexNET.The regression scatter plots of all architecture networks of deep-learning regression to predict level adulteration tapioca starch in coconut milk utilization FT-NIR are shown in Figure 6.The regression coefficient (slope) for all architecture network regressors decreases from training to testing, except S-AlexNET, which decreases very little (more than three decimal places), so the effect is minimal.Also, the intercept coefficient for all regressors is positive, while Simple CNN is negative for training.Inversely proportional to testing, all regressors are negative except S-AlexNET.The simple CNN coefficient range for detecting tapioca starch in coconut milk using FT-NIR is 1.8127 to −1.892.Wavenumbers with more than score threshold 50% of the simple CNN coefficient of architecture as many as 51 important features include 7213-7182 cm −1 (1386-1392 nm), 6256-5963 cm −1 (1598-1677 nm), and 5832-5778 cm −1 (1715-1731 nm) (Figure 7a).The simple CNN coefficient range for detecting tapioca starch in coconut milk using FT-NIR is 1.8127 to −1.892.Wavenumbers with more than score threshold 50% of the simple CNN coefficient of architecture as many as 51 important features include 7213-7182 cm −1 (1386-1392 nm), 6256-5963 cm −1 (1598-1677 nm), and 5832-5778 cm −1 (1715-1731 nm) (Figure 7a).

Calibration Models Development Base on Micro-NIR 3.3.1. Adulteration by Corn Flour
The performances of the different network architectures to predict the level of adulteration of coconut milk by corn flour using Micro-NIR during training and testing are summarized in Table 4.The GoogleNET regressor needs a more significant number of epochs compared to the other regressors.The ResNET regressor is the one that provided the best results (same R 2 with GoogleNET regressor but with the lowest RMSE) during training.The GoogleNET regressor possesses a much higher coefficient of determination (R 2 ) and lowest RMSE than the other regressor in the test set.This is confirmed by the RPD parameter for the GoogleNET regressor, which has excellent performance model capability (RPD = 31.094).In simpler terms, this study may also arrange the performance of regressor order according to its RPD as Simple CNN < ResNET < S-AlexNET < GoogleNET.All predictive performances from deep-learning regressors in scatter plots to predict the level adulteration of corn flour in coconut milk operating Micro-NIR are shown in Figure 8.The regression coefficient (slope) for S-AlexNET and ResNET regressors decreased from training to testing.Meanwhile, Simple CNN tends to be stable, and GoogleNET overlooks the increase.The intercept coefficient for all regressors, both in training and testing, is positive except for the GoogleNET regressor in the testing stages.
the best results (same R 2 with GoogleNET regressor but with the lowest RMSE) during training.The GoogleNET regressor possesses a much higher coefficient of determination (R 2 ) and lowest RMSE than the other regressor in the test set.This is confirmed by the RPD parameter for the GoogleNET regressor, which has excellent performance model capability (RPD = 31.094).In simpler terms, this study may also arrange the performance of regressor order according to its RPD as Simple CNN < ResNET < S-AlexNET < GoogleNET.All predictive performances from deep-learning regressors in scatter plots to predict the level adulteration of corn flour in coconut milk operating Micro-NIR are shown in Figure 8.The regression coefficient (slope) for S-AlexNET and ResNET regressors decreased from training to testing.Meanwhile, Simple CNN tends to be stable, and Goog-leNET overlooks the increase.The intercept coefficient for all regressors, both in training and testing, is positive except for the GoogleNET regressor in the testing stages.The range of the simple CNN coefficient from coconut milk adulteration by corn flour using Micro-NIR is between 24.486 and −29.476 (Figure 9a).The wavelengths that have more than score threshold 50% in the range of simple CNN coefficient of architecture (seven wavelengths) are 921 nm (10858 cm −1 ), 1206-1212 nm (8292-8251 cm −1 ), 1224 nm (8170 cm −1 ), 1385 nm (7220 cm −1 ), 1391 nm (7189 cm −1 ), and 1410 nm (7092 cm −1 ).The range of the simple CNN coefficient from coconut milk adulteration by corn flour using Micro-NIR is between 24.486 and −29.476 (Figure 9a).The wavelengths that have more than score threshold 50% in the range of simple CNN coefficient of architecture (seven wavelengths) are 921 nm (10858 cm −1 ), 1206-1212 nm (8292-8251 cm −1 ), 1224 nm (8170 cm −1 ), 1385 nm (7220 cm −1 ), 1391 nm (7189 cm −1 ), and 1410 nm (7092 cm −1 ).

Adulteration by Tapioca Starch
Results of the prediction for the adulteration degree of corn flour in coconut milk using Micro-NIR, as seen in the training and testing data sets, are displayed in Table 5.The coefficient of determination (R 2 ) for all architecture network regressors is a teeny change from training to testing.The RMSE performance decreased for simple CNN and S-AlexNET while increasing for ResNET and GoogleNET from training to testing.However, Bias performance for simple CNN and ResNET decreased during training to testing, and S-AlexNET and GoogleNET increased during training to testing.Regarding RPD, all architecture networks demonstrate excellent performance model capability (RPD > 8.1), with the best coming from ResNET (RPD = 39.349).To elaborate, this study may organize the best performance of regressor analysis order according to its RPD as ResNET > S-AlexNET > GoogleNET > Simple CNN with GoogleNET regressor requires a higher epoch than others.The regression scatter plots for predicting the adulteration level of tapioca starch in coconut milk using Micro-NIR with various deep-learning architecture networks are depicted in Figure 10.The regression coefficient (slope) for all architecture network regressors increases during training to testing except GoogleNET, which decreases very little (more than three decimal places), so the effect is minimal.Also, all regressors' intercept coefficients are positive during training and testing, while GoogleNET is negative for both training and testing.
change from training to testing.The RMSE performance decreased for simple CNN and S-AlexNET while increasing for ResNET and GoogleNET from training to testing.However, Bias performance for simple CNN and ResNET decreased during training to testing, and S-AlexNET and GoogleNET increased during training to testing.Regarding RPD, all architecture networks demonstrate excellent performance model capability (RPD > 8.1), with the best coming from ResNET (RPD = 39.349).To elaborate, this study may organize the best performance of regressor analysis order according to its RPD as ResNET > S-AlexNET > GoogleNET > Simple CNN with GoogleNET regressor requires a higher epoch than others.The regression scatter plots for predicting the adulteration level of tapioca starch in coconut milk using Micro-NIR with various deep-learning architecture networks are depicted in Figure 10.The regression coefficient (slope) for all architecture network regressors increases during training to testing except GoogleNET, which decreases very little (more than three decimal places), so the effect is minimal.Also, all regressors' intercept coefficients are positive during training and testing, while GoogleNET is negative for both training and testing.The simple CNN coefficient range for detecting tapioca starch in coconut milk using Micro-NIR is from 25.180 to −32.352.Wavelengths with more than score threshold 50% of the simple CNN coefficient of architecture with as many as 13 importance features include The simple CNN coefficient range for detecting tapioca starch in coconut milk using Micro-NIR is from 25.180 to −32.352.Wavelengths with more than score threshold 50% of the simple CNN coefficient of architecture with as many as 13 importance features include 908 nm (11013 cm −1 ), 1385 nm (7220 cm −1 ), 1391 nm (7189 cm −1 ), 1404 nm (7123 cm −1 ), 1410 nm (7092 cm −1 ), 1614-1651 nm (6196-6057 cm −1 ), and 1670 nm (5988 cm −1 ) (Figure 11a).

Discussion
This study explored the feasibility of using deep learning to create a rapid, accurate, and robust prediction model to predict adulteration levels of coconut milk by corn flour and tapioca starch using FT-NIR and Micro-NIR spectroscopy.Presently, the non-destructive testing of adulteration in agriculture and food products by NIR spectrometer based on laboratory conditions has been widely introduced.However, the procedures and development of the calibration model under which it can be applied are still limited.The use of deep learning can be a good solution to such problems.Additionally, compared with the results of this study's use of deep learning, for example, coffee adulteration prediction [4], adulteration in infant formula [12], cow milk fat content adulteration by water [13], and minced beef adulteration [14], we also obtained equally superior prediction results.Furthermore, the operation of the NIR spectrophotometer is simpler and easier to promote.This article presents a novel deep-learning regression method for quantitative NIR spectrum analysis.This method utilizes four network architectures: Simple convolutional neural network (Simple CNN); S-AlexNET; ResNET; and GoogleNET.However, as is known, a robust NIR model for adulteration detection is hard to achieve due to multiple variation factors, such as different brands and batches of product, the simultaneous existence of several adulterants, temperature, humidity, and spectral drift of light sources, making it hard to obtain stable applications in practice.Therefore, more advanced modeling investigations should be carried out and prepared to evaluate and improve the robustness of the proposed method for the future.However, the limitations of the proposed method should also be further considered and improved.For example, the deep-learning method is much more time-consuming in training than the traditional method and the regular machine-learning algorithm.Therefore, some adulteration studies in food and agriculture products are based on NIR spectroscopy run deep-learning algorithms on graphics processing units (GPU), such as the assurance of tea quality by Yang et al. [17] and detection of adulteration of minced beef by Weng et al. [14].However, thanks to the fast development of deep-learning hardware, for instance, graphics processing unit (GPU), associative processing unit (APU), tensor processing unit (TPU), and quantum processing unit (QPU), the testing time for the proposed network is acceptable.
As can be observed from Figure 2, the spectral profiles of the degree of coconut milk adulterants by corn flour and tapioca starch were similar and characterized by few substantial differences in peak positions and curve trends.In general, for all the sample adulterants, a few characteristic overlapping peaks contributed by the presence of the main content of coconut milk and adulterant material, including fat, protein, moisture, ash, and carbohydrates.Samples with more adulterant material caused the peak absorbance level to decrease, both for adulteration by corn flour and tapioca starch.This corresponds to the difference in moisture content between coconut milk and adulterant, which causes the free moisture content in the coconut milk to be absorbed by the admixture agent to reach an equilibrium point.As a result, coconut milk that has been adulterated more with a solid adulterant material has a lower absorption spectral ability.This is in line with the report by Malvandi et al. [23], who stated in their study that peak values and their corresponding wavelengths in the NIR region changed as the moisture content altered.Büning-Pfaue [24] emphasized that the strength and weakness of this absorption band come from the strong effect of hydrogen bonds on organic monomers, ions, and polymers in the sample.The presence of content in adulteration coconut milk samples was observed at the main peaks of the following wavebands, both FT-NIR and Micro-NIR: 1210 nm (8262 cm −1 ) related predominantly to CH bond stretching with the second overtone; 1453 nm (6881 cm −1 ) to the first overtone of OH stretching bonds attributed to starch and water; 1728 nm (5786 cm −1 ) and 1764 nm (5670 cm −1 ) to the resonance bands of CH bond stretching with the first overtone; and 1929 nm (5184 cm −1 ) to the CH bonds stretching with the second overtone [25][26][27].
The performance criteria for the prediction model using deep learning in this study were evaluated based on predicting grain chemical composition content.A study by Chu et al. [22] examined the regression model's capacity to classify RPD in the following manner: less than 3 as a poor or unreliable model, 3.1-4.9as a fair model, 5.0-6.4 as a good model, 6.5-8.0 as a very good model and more than 8.1 as an excellent model.When comparing the RPD results for the prediction degree of adulteration of coconut milk with corn flour using all the network architectures, it was observed that Micro-NIR was superior to using FT-NIR (for all network architectures).At the same time, all the network architectures were considered excellent models.For tapioca starch in coconut milk case, Micro-NIR performed better than FT-NIR based on RPD among the spectrophotometer to predict the degree of adulteration (Table 6).Subsequently, only ResNET has lower RPD and weak performance (FT-NIR data set) among the network architectures.Regarding the comparison between FT-NIR and Micro-NIR, the models developed for the prediction of coconut milk by adulterant material corn flour and tapioca starch seem to give comparable results using the FT-NIR.The performance of FT-NIR slightly reduced RPD, perhaps due to some factors, including a lack of explanatory variables and collinearity, but fortunately, the RPD obtained is still higher than eight [28,29].In chemometrics, a limited number of samples with high-dimensional data of features pose common problems like data overfitting and multicollinearity and do not show the main features that are more dominant in the data.Selection of the most important features can lead to the dominant variables in a high-dimensional dataset.In case studies on NIR spectra, this can be represented in many methods, one being by expressing slope coefficients or regression coefficients.According to a study from Palermo et al. [30], regression coefficients can be used to select appropriate predictors according to the magnitude of their absolute values.Even according to a study by Wold et al. [31], in classical chemometric analysis using partial least squares (PLS), small regression coefficients can be ignored as an unimportant term to find the most prominent features and correlate them with the chemical assignment of some structure and bond vibration in the NIR spectroscopy.Additionally, compared with the results of previous research using this approach in analysis in NIR spectroscopy, for example, extra virgin olive oil adulteration prediction by PLS regressor [32], adulteration in quinoa flour by PLS regressor [33], aged-rice adulteration by competitive adaptive reweighted sampling (CARS) combined with PLS regressor [34], and adulterants of notoginseng powder by CARS-PLS regressor [35].However, in applying advanced chemometrics using machine learning and deep learning, it is still a challenge to demonstrate coefficients that can represent important features.
The regression coefficients from deep-learning algorithms used in this study can be represented using weight coefficients.Even though it is not strictly identical to the regression coefficients in classical chemometric analysis using PLS, at least the weight coefficients of each deep-learning network architecture can indicate variables for each response that are more important than others.Regression coefficients for the case of deep-learning regressors were first introduced by Cui and Fearn [8] and tested on three NIR datasets, including the wheat flour dataset, wheat flour dataset, and protein content dataset.In their study, they randomly draw a few spectra from the dataset and plot the corresponding regression coefficients.This is understandable because deep learning is a non-linear approach, so each spectrum will have its own regression coefficient value, different from the PLS regression coefficient, which has the same value for all sample spectra.However, in this study, because the aim of showing the coefficients of weight of each deeplearning network architecture is to find the dominant features in high-dimensional data, we use all training data spectra.Next, we average the weight coefficients of all the training data spectra, which are called regression coefficients for each deep-learning network architecture.In this study, we apply a threshold score of 50% of the maximum and minimum peaks in the regression coefficient, as shown in Figures 5, 7, 9 and 11.This approach is similar to the system applied in the variable importance in projection (VIP) approach from PLS regression, which applies a threshold score rule that can be data specific, ranging between 0.83 and 1.21 [33,36].
This study analyzed important wavelengths by deep learning and found that not all important wavelengths will be the same for all deep-learning network architectures.In addition, even though the FT-NIR wavelength range covers the wavelength range in Micro-NIR, the important wavelength will not be precisely the same for both.However, in the case of FT-NIR and Micro-NIR instruments, it was still found that some important waves overlapped between them.In the case of corn flour, waves 7421 cm −1 (1348 nm) and 7167-7190 cm −1 (1395-1391 nm) were found in FT-NIR, and 1342-1348 nm (7452-7418 cm −1 ) and 1391 nm (7189 cm −1 ) were found in Micro-NIR.In the case of tapioca starch, the waves at 7213-7221 cm −1 (1386-1385 nm) were found in FT-NIR and 1379-1385 nm (7252-7220 cm −1 ) in Micro-NIR.This may be caused by the nature of each regressor, which in the convolutional layer stage can transform the spectra to fit in the following regression scheme.In other words, the regressor from deep learning has carried out automatic preprocessing, as reported by Cui and Fearn [8].This causes the final shape of each spectrum before the "flatten" to the "dense fully connected" stage to differ according to the output variable.This difference will eventually result in differences in important wavelengths for each deep-learning network architecture.Even though they are different, several wavelengths from all deep-learning network architectures are still the same.

Conclusions
Deep learning as a novel approach to predict the level of adulteration of coconut milk was successfully developed and tested based on spectra from benchtop FT-NIR and portable Micro-NIR.Models based on FT-NIR spectroscopy to be able to predict the adulteration level of corn flour in coconut milk (1-50%) can be generated using architecture network regressor from deep learning (Simple CNN, S-AlexNET, ResNET, GoogleNET) in the performance ranges of R 2 , RMSE, and Bias at their training from 0.996 to 0.999, from 0.370 to 0.958%, and from −0.027 to 0.120, respectively.Next, R 2 , RMSE, Bias, and RPD at the testing stage are from 0.992 to 0.998, 0.686 to 1.256%, from −0.012 to 0.176, and from 11.429 to 20.866, respectively.Even though it is still as good, the performance based on the FT-NIR prediction model is still lower than that of Micro-NIR with the same regressor network architecture from deep learning.Performance ranges R 2 , RMSE, and Bias at their training using Micro-NIR are from 0.998 to 0.999, from 0.363 to 0.706%, and from −0.053 to −0.183, respectively.At the testing stage, R 2 , RMSE, Bias, and RPD are from 0.998 to 0.999, from 0.463 to 0.597%, from −0.023 to 0.123, and from 23.981 to 31.094, respectively.
Relatively similar to the case of the model to predict tapioca starch adulteration in coconut milk, the performance based on the Micro-NIR dataset is better than using FT-NIR with the same regressor network architecture from deep learning.Performance ranges at their training (R 2 , RMSE, Bias) and testing (R 2 , RMSE, Bias, RPD) using Micro-NIR are from 0.998 to 1.000, from 0.298 to 0.637%, from −0.029 to −0.111, from 0.998 to 0.999, from 0.370 to 0.611%, from −0.035 to −0.068, and from 23.521 to 39.349, respectively.Meanwhile, performance ranges at their training (R 2 , RMSE, Bias) and testing (R 2 , RMSE, Bias, RPD) using FT-NIR are from 0.892 to 0.999, from 0.482 to 5.850%, from −0.035 to 1.017, from 0.886 to 0.998, from 0.670 to 6.108%, from −0.202 to 1.481, and from 2.958 to 21.421, respectively.
In closing, the prediction results demonstrated that the proposed architecture from the deep-learning method yielded superior regression performance for the FT-NIR and Micro-NIR to predict the level of adulterants (corn flour and tapioca starch) in coconut milk.While finding that the optimal deep-learning architecture is complex and computationally expensive, implementation and training are straightforward once found.Furthermore, developing deep-learning architectures and applying them are two different study matters that should not be confused.This study also indicated that deep learning for NIR spectroscopy data is less dependent on preprocessing than the classical chemometrics method and still can achieve excellent performance.

Figure 1 .
Figure 1.Detection conditions for scanning NIR data by (a) FT-NIR and (b) Micro-NIR.

Figure 1 .
Figure 1.Detection conditions for scanning NIR data by (a) FT-NIR and (b) Micro-NIR.

Figure 3 .
Figure 3.The original NIR spectroscopy data.Spectra by benchtop FT-NIR from coconut milk adulteration by (a) corn flour and (b) tapioca starch.Spectra by portable Micro-NIR for coconut milk adulteration by (c) corn flour and (d) tapioca starch.

Figure 3 .
Figure 3.The original NIR spectroscopy data.Spectra by benchtop FT-NIR from coconut milk adulteration by (a) corn flour and (b) tapioca starch.Spectra by portable Micro-NIR for coconut milk adulteration by (c) corn flour and (d) tapioca starch.

Figure 5 .
Figure 5.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration coconut milk by corn flour using FT-NIR.(a) Simple CNN; (b) S-AlexNET; (c) Res-NET; and (d) GoogleNET.Feature importance.

Figure 5 .
Figure 5.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration coconut milk by corn flour using FT-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration

Figure 7 .
Figure 7.Comparison of the regression coefficients of the four deep-learning calibration approaches to adulteration of coconut milk by tapioca starch using FT-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.Feature importance.

Figure 7 .
Figure 7.Comparison of the regression coefficients of the four deep-learning calibration approaches to adulteration of coconut milk by tapioca starch using FT-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration

Sensors 2024 , 24 Figure 9 .
Figure 9.Comparison of the regression coefficients of the four deep-learning calibration approaches of coconut milk adulteration by corn flour using Micro-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.Feature importance.

Figure 9 .
Figure 9.Comparison of the regression coefficients of the four deep-learning calibration approaches of coconut milk adulteration by corn flour using Micro-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration coconut milk by tapioca starch using Micro-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.Feature importance.

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration coconut milk by tapioca starch using Micro-NIR.(a) Simple CNN; (b) S-AlexNET; (c) ResNET; and (d) GoogleNET.

Figure 11 .
Figure 11.Comparison of the regression coefficients of the four deep-learning calibration approaches of adulteration

Table 1 .
Summary statistics of data for developing a deep-learning model.
m, number of features; n, number of samples; SD, standard deviation.

Table 1 .
Summary statistics of data for developing a deep-learning model.
m, number of features; n, number of samples; SD, standard deviation.

Table 2 .
Regression model performance to predict corn flour in coconut milk utilizing FT-NIR.

Table 3 .
Regression model performance to predict tapioca starch in coconut milk utilizing FT-NIR.

Table 3 .
Regression model performance to predict tapioca starch in coconut milk utilizing FT-NIR.

Table 4 .
Regression model performance to predict corn flour in coconut milk utilizing Micro-NIR.

Table 4 .
Regression model performance to predict corn flour in coconut milk utilizing Micro-NIR.

Table 5 .
Regression model performance to predict tapioca starch in coconut milk using Micro-NIR.

Table 5 .
Regression model performance to predict tapioca starch in coconut milk using Micro-NIR.

Table 6 .
Summary of the performance of FT-NIR and Micro-NIR.