Detection of Anthocyanins in Potatoes Using Micro-Hyperspectral Images Based on Convolutional Neural Networks

The color potato has the function of both a food and vegetable. The color potato not only contains various amino acids and trace elements needed by the human body but also contains anthocyanins. Anthocyanins have many functions, such as antioxidation, inflammation inhibition, vision improvement, and cancer prevention, so colored potatoes are deeply loved by consumers and have good market prospects. However, at present, the detection of anthocyanin content in color potatoes mainly depends on chemical methods, which are time-consuming and laborious, so it is necessary to study a fast and accurate detection method. In this study, microscopic hyperspectral equipment was used to collect the spectral information of the outer skin and inner skin of potatoes. The original spectrum, pretreatment spectrum, and characteristic spectrum variables of the outer skin and inner skin were predicted by the convolution neural network (CNN) algorithm and partial least squares regression (PLS) algorithm, respectively, and the performance of the model was evaluated by the prediction set correlation coefficient (Rp), prediction set root mean square error (RMSEP), correction set correlation coefficient (Rc), correction set root mean square error (RMSEC), and residual prediction deviation (RPD). The results revealed that the inner skin Raw + CNN model constructed under raw spectral data is optimal with Rc = 0.9508, RMSEC = 0.0374%, Rp = 0.9461, RMSEP = 0.2361% and RPD = 4.4933. The inner skin Savitzky-Golay (SG) + Detrend (DET) + CNN model constructed from pre-processed spectral data is optimal with Rc = 0.9499, RMSEC = 0.0359%, Rp = 0.9439, RMSEP = 0.2384%, RPD = 4.6516. The inner skin DET + competitive adaptive reweighted sampling (CARS) +CNN model constructed from the feature-based spectral data was optimal with Rc = 0.9527, RMSEC = 0.0708%, Rp = 0.9457, RMSEP = 0.2711%, and RPD = 4.1623. It can be seen that the Rp, RMSEP, Rc, RMSEC, and RPD values for modeling the spectral information of the inner skin were higher than those of the outer skin under the three different spectral data. The prediction accuracy of the model built by the CNN algorithm was better than the conventional algorithm PLS, the application of the CNN algorithm in inner skin can achieve accurate prediction of anthocyanin content in potato.


Introduction
Colorful potatoes are rich in flavonoids with antioxidant properties such as anthocyanins, which have bright colors and are responsible for the color of fruits, vegetables, flowers, and plants [1].Studies have shown that anthocyanins not only impart bright colors to plants but also resist ultraviolet rays, diseases, insect pests, and low temperatures [2][3][4].In terms of nutrition and health care, anthocyanins are natural and powerful free radical Foods 2024, 13, 2096 2 of 19 scavengers [5] that have various physiological functions such as reducing the growth rate of cancer cells, regulating blood sugar, and enhancing vision as well as anti-aging and anti-tumor properties.Therefore, eating colored potatoes is beneficial to human health [6][7][8].However, there are few studies on the detection of anthocyanins in potatoes at present.Currently, research on potato anthocyanins has mainly focused on their function, accumulation mode, characteristics, and content using stoichiometric methods.For the detection of anthocyanins, the pH-differential method and different high-performance liquid chromatography (HPLC) methods in combination with a photodiode array detector or mass spectrometry (MS) are most frequently used in the food industry as well as in research [9].However, the detection process is complicated and redundant, which significantly affects the accurate detection and quality classification of potato anthocyanins.
Some scholars have also conducted some research on the rapid detection of anthocyanins and have made some achievements.Huck C W et al. [9] used near-infrared spectroscopy to quickly detect the total anthocyanin content in Sambucus fruits, used a partial least squares regression (PLSR) model to predict, and found that using near-infrared spectroscopy is a reliable detection method that can realize the prediction of anthocyanin content.U. S. Dinish [10] used a new custom portable handheld Vis-NIR spectrometer that collected the reflectance spectra of red and green lettuce leaves, wirelessly transmitted the spectral data via Bluetooth, and provided the raw spectral data and processed information, after which he predicted the anthocyanin content of red and green lettuce and found a correlation coefficient of 0.84.It can be seen that the handheld spectrometer can accurately detect the content of anthocyanins in plants.However, these studies are all point measurement methods, and the detection area is small.
Only a small area near the probe can be detected, and the overall information of the tested sample cannot be obtained.
Microscopic hyperspectral imaging technology is a combination of atlas technology, integrating microscopic imaging and spectral information, which can not only obtain the microscopic cell morphology information of substances but also the corresponding spectral information.Currently, it is mainly used in the medical field and rarely in agriculture.It can enlarge information that is invisible to the naked eye to the required multiple under a microscope.By directly projecting the beam to the target area and narrowing the measurement range, spectral and spatial information of tissue slices can be obtained [11][12][13], thereby fundamentally improving the detection accuracy.Minghua [14] used microscopic hyperspectral imaging technology to detect POD, CAT, and SOD activity indices of tomato leaves under salt stress and integrated them with spectral image information to build a quantitative model of antioxidant enzymes in tomato leaves under salt stress, realizing the spectral stripping and visual distribution of single antioxidant enzymes in cells.Xuan et al. [15] studied the detection of chlamydia spores in contaminated soil, obtained the microscopic hyperspectral image of perispora chlamydia in contaminated soil, and established the detection model.Jianhong [16] studied the changes of antioxidant active molecules and malondialdehyde (MDA) in mutton at different storage periods at 4 • C and combined with 400-1000 nm micro-hyperspectral technology, conducted rapid detection and analysis of total superoxide dismutase (T-SOD) activity, catalase (CAT) activity and malondialdehyde content.The feasibility of simultaneous determination of T-SOD, CAT, and MDA in mutton by micro-hyperspectral imaging was verified by Jinping [17].Relying on the early detection method involving the use of micro-high spectral imaging technology to detect mushroom wolf molds, a combination of the BS-NET-FC band selection algorithm and MTCEM to high-spectrum image detection thickness of the thick spore micro-spectrum image was proposed.Great spores reduce redundant band images while effectively detecting the spore target.Lu [18] used the spectral information of microscopic hyperspectral imaging technology to conduct rapid non-destructive testing research on soluble protein content, glutathione (GSH) content, peroxidase (POD) activity and catalase (CAT) activity of mutton and established models, and these models generated good results.Huan [19] used visible micro-hyperspectral technology to detect the activity of superoxide dismutase (SOD) in mutton muscle cells.The above-mentioned studies confirm that micro-hyperspectroscopy is feasible for internal quality detection.
The traditional regression detection algorithm used currently in the prediction process of potato internal components is not suitable for the detection of large sample sizes, whereas the deep learning algorithm can achieve linear and nonlinear calculations through convolution and activation functions to extract the linear and nonlinear features of samples.In addition, the deep learning model is highly robust and can withstand the continuous detection of a large sample size.Therefore, deep learning has gradually become widely used in the regression analysis of spectral data [20][21][22].Convolutional neural networks (CNN), as classic deep learning neural networks, have also been successfully applied to one-, two-, and three-dimensional data analysis [23][24][25][26][27].
Therefore, a convolutional neural network model based on deep learning of an artificial intelligence algorithm was used in this study to predict anthocyanin content.The specific research objectives were as follows: (1) To obtain spectral information on the microstructures of different parts of potatoes.
(2) To build a model based on the CNN, conforming to the characteristics of the spectral data.(3) To construct a convolutional neural network and partial least regression prediction model of potato anthocyanins based on the original spectrum, pre-process the spectrum and characteristic spectrum variables and obtain the optimal prediction model through comparative analysis.
At present, no scholars have used micro-hyperspectral equipment and deep learning algorithms to detect anthocyanin content in potatoes.This study provides a reference for future research in related industries.

Preparation of Experimental Samples
Potatoes were purchased from a farmers' market in Hohhot, Inner Mongolia Autonomous Region.Fresh round or oval potatoes, which are intact and with no decay or mechanical damage, little difference in shape, and belonging to red and black diamond varieties were selected.The potatoes were cleaned using water before the experiment and placed at the laboratory temperature for 8 h.In this study, freehand sections were selected, and rectangular blocks of 8 mm × 6 mm × 15 mm of uniform size were cut with a single knife blade from the outer skin and inner skin of potatoes, respectively.They were cut into uniform slices with a knife blade and then rinsed briefly under distilled water using tweezers.After rinsing, the surface moisture was absorbed with absorbent paper and placed on the slide, and the cover slide was used for simple sealing.The outer skin and inner skin of the potatoes constituted 576 samples, respectively.

Microscopic Hyperspectral Imaging System
In this study, a microscopic hyperspectral system was established by Wuling optics (Taiwan Province, China), as shown in Figure 1, which was composed of an optical microsystem, a spectral scanning imaging instrument, and a data acquisition system.An optical microscopy system primarily comprises a microscope and an electric carrier table.Multiples of 5, 10, 20, 50, and 100 times were obtainable for the objective mirrors, and a multiple of 10 was available for the eyepiece.
The interior of the spectral scanning imager is mainly composed of acousto-optic tunable filters (AOTF), their drivers, and CCD imaging equipment.Among them, the spectral scanner has a spectral range of 365-1025 nm, a total of 616 spectra, and a spectral resolution of 2.8 nm.The camera resolution of the imaging device is 1.4 million pixels, and the slit size is 30 µm.

Micro-Hyperspectral Data Acquisition
Sample collection process: (1) Before collecting the micro-high-resolution spectral images, the instrument and equipment were maintained open for 30 min to ensure that the light source irradiation intensity was stable.This study used the transmitted light source.(2) The potato slices were fixed on a microscope carrier table .(3) The image collection software Hyperspec was opened; the carrier table was initialized, and preliminary focusing was attained; the eye mirror adjustment focal length was observed to make the image clear; the image of the image was avoided; and the strength of the light source was adjusted until the sample reached a reasonable light source exposure value.(4) The collection parameters were set in Hyperspec software.The specific parameters are listed in Table 1.(5) The software was then executed, and the instrument was scanned until the image collection was completed.This process was repeated to collect all samples.

Micro-Hyperspectral Image Correction
Owing to the inherent instability of the light source of the hyperspectral imaging system and the influence of external noise and the transmission process operation, the acquired hyperspectral images contain noise in certain bands.Therefore, before acquiring the micro-hyperspectral images, a lens cover and standard whiteboard were used to obtain all white and black images, respectively.Subsequently, in the acquisition software of the imaging system, the original image is corrected to black and white according to Equation (1) [19]: where C is the corrected image, R the original image, B the black reference image obtained by completely covering the camera lens with a lens cap (approximately 0% reflectivity), and W the white-calibrated image (approximately 100% reflectivity).

Determination of Anthocyanin Content
The measurement of anthocyanins in potatoes was based on the Chinese agricultural industry standard "NY/T 2640-2014 Plant-Dedicated Flower Circin Primrose Method" [28].The main principle was to extract anthocyanins from potatoes using ethanol and water and hydrolyze anthocyanins into anthocyanins by boiling water bath.The anthocyanins were determined using high-performance liquid chromatography, the retention time was qualitative, and the external standard method was quantitative.

Extraction of Microscopic Hyperspectral Data
The corrected potato micro-hyperspectral images were imported into ENVI 5.3 software (ITT Visual Information Solutions, Boulder, CO, USA), and a Region of interest (ROI) area of 100 × 100 was selected on the complete cell structure with color using the square tool.The average spectral transmittance of the ROI was extracted from the spectral data of each sample.Using this method, the spectral information of the samples was successively extracted according to the sequence of labels, and the spectral data matrix of the outer and inner skin was established as 576 × 616 pixels.

Micro-Hyperspectral Data Pre-Processing
Owing to the existence of mechanical noise and baseline drift in the original spectrum, it was necessary to conduct pre-processing to eliminate unnecessary information.In this study, the established data matrix was pre-processed, and the spectral pre-processing algorithms adopted were the standard normal variable transformation (SNV), Detrending method (DET), convolution smoothing (Savitzk-Golay), and their combinations, SG-SNV, SG-DET, and SNV-DET.SNV is the most widely used method in spectral data preprocessing, which is conducive to correcting changes in path length and spectral intensity and eliminating the interference of the nonlinear light scattering effect [29].The SG can improve the smoothness of the spectrum and reduce noise interference.DET is a polynomial baseline correction method, which is used to eliminate baseline offset and curvature in spectral signals.It highlights the absorption peak of the spectral curve by subtracting an optimal trend line fitted by a polynomial from the original spectral curve [30].DET has great advantages in eliminating the interference of spectral data by multicollinearity, baseline drift, and curvature.In this study, spectral data were pre-processed using the Unscrambler X 10.1 (CAMO AS, Oslo, Norway) software.

Feature Wavelength Selection
High-spectrum data contain hundreds of thousands of continuous wavelengths with redundant and multi-common linearity.In this study, improved competitive adaptive weighted (CARS) and continuous projection algorithms (SPA) were used to eliminate redundant wavelengths and select the variables for the best performance.
The competitive adaptive reweighting algorithm (CARS) is an algorithm that Li et al. simplified and improved on the original CARS algorithm [31].This method is based on Darwin's evolutionary theory.In sample selection, adaptive reweighting sampling technology is used to select wavelength points with large absolute values of regression coefficients in the PLS model.Wavelength points with small weights are eliminated, and the subset with the smallest root-mean-square error RMSECV is selected by means of crossvalidation, which is the optimal variable subset.In this study, 50 Monte Carlo samples and 10 cross-validations were used.
The SPA method is a forward variable-selection method that uses a simple projection operation to obtain a collinear minimum subset of variables.Therefore, the characteristic wavelength is extracted from the entire band, most of the redundant information in the original spectral matrix is eliminated, and the modeling conditions are improved.The basic principle of SPA is to project a set of wavelength subsets into a vector space and select the wavelength subset with the least redundancy [32].The number of characteristic wavelengths was set in advance, and the parameters for the minimum and maximum numbers of variables selected in the SPA program were 1 and 30, respectively.

Establishment of Regression Prediction Model
To compare and analyze the differences between the traditional regression algorithm and the popular deep learning algorithm in spectral information processing, the traditional linear partial least squares regression algorithm and convolutional neural network algorithm were selected in this study.

Partial Least Squares Regression Algorithm
Partial least squares regression (PLSR) [33,34] is the most widely used linear regression algorithm at present.Owing to its modeling principles and structure, this model is often the first choice for building predictive models.It has the advantage of considering both matrices X (spectral data) and Y (starch content).This can solve the problem of having a large number of variables or collinear variables in the original data.Partial least squares regression analysis was used to convert the original data into a limited number of independent latent variables (LVs).The optimal number of potential variables was determined by minimizing the sum of the squares of error (RMSE) to prevent model over-fitting or under-fitting.This is typically performed through cross-validation.In this study, the number of LVs was optimized using a 10-fold cross-validation method, the maximum number of LVs was set to 15, and the LVs value with a smaller error was selected according to the modeling effect.The ratio of the PLS model training set and test set was 2:1.

Convolutional Neural Network Regression Algorithm
As the convolutional neural network model can use a hierarchical structure, it has the characteristics of translation and other changes [35,36].Thus, even if the appearance of the data changes, the original information of the data will not be lost, and effective information can still be identified and extracted.The convolutional neural network also has the feature of parameter sharing.The convolutional kernel moves in the same layer by means of translation and shares a set of convolutional kernel parameters when feature extraction is performed at each position.Therefore, the convolutional neural network significantly reduces the number of parameters, accelerates the learning rate, and prevents overfitting.
Combined with the characteristics of spectral data, this study proposes to further optimize the design of the basic convolutional neural network.

1.
Combined with the spectral data and several experiments, three convolution layers were built, and the number of convolution nuclei in each layer was 16 and the sample ratio of the model training set and the test set is 4:1.

2.
This study proposes introducing batch normalization (BN) after the convolutional layer, standardizing the data after convolution, and then inputting it into the next layer [37], which can significantly simplify the data after the convolutional layer and improve the speed after extracting useful information.

3.
In this study, the rectified linear unit (ReLU) activation function was introduced after normalization.

Data Processing Software
The pre-processing method in this study used the Unscrambler software, and the PLS algorithm was implemented in MATLAB (R2019).The CNN program in this study is executed on the computer with the following specifications: Windows 10 system, Intel(R) Core (TM) i7-9700 CPU, 3.00 GHz, and memory 32 GB (Intel, Santa Clara, CA, USA).The CNN algorithm program is based on the Python language, using the PyTorch (Professional 2021) development environment.The learning rate was set to 0.001, and the number of training rounds was 100.The training hardware was an NVIDIA 2070 GPU for parallel computing.

Characteristic Analysis of Spectral Information
In this study, hyperspectral image information under the microscope of the outer and inner skin of two kinds of potatoes, Red Mei and Black Jingang, was collected, as shown in Figure 2. As shown in Figure 3, the spectral information of the outer and inner skin shows that the trend of the raw spectral information of the two varieties is consistent, indicating that the spectral information under the microscope is not significantly affected by the variety.Further, by comparing the outer skin and the inner skin part, it was also found that the spectral trend of the inner and outer skin was consistent, which also showed that the spectral difference between the inner skin part and the outer skin was not large; however, whether there was a difference after the final application of algorithm modeling needs to be further studied.[38].Therefore, visible/near-infrared spectroscopy can be used to predict anthocyanin content [39].It can also be observed from the original spectrum in Figure 3 that there are evident trappings in the spectrum at approximately 530, 700, and 850 nm.The main pigment information was observed at approximately 530 and 700 nm, and anthocyanins were soluble pigments, which is consistent with previous studies [40,41].The absorption peak at approximately 850 nm was due to the third overtone of C-H, which represents the absorption band of glucose and is related to the hydrocarbon group of C-H [42,43].
It can be observed from the raw spectral data in Figure 3 that there is a certain raw edge, that is, noise, in the spectral information.Hence, it is necessary to pre-process the original data.SG smoothing, SNV, DET, SG + SNV, SG + DET, and SNV + DET were used to pre-process the original spectra of the inner skin part and the outer skin part, respectively, and the results are shown in Figures 4 and 5.It can also be observed from the image that SG smoothing cannot generate evident changes from the original spectrum that are distinguishable with the naked eye.However, the spectral data value has changed, the other pre-processing methods generate clear changes, and the spectrum becomes more clustered and has fewer burrs.

Characteristic Wavelenght Extraction Analysis
In this study, feature wavelength extraction was performed on pre-processed data using CARS and SPA.The partial least squares regression and convolutional neural net-Foods 2024, 13, 2096 9 of 19 work algorithms were used to predict the internal anthocyanin content of potatoes in the spectra after feature extraction, and the results of the two algorithms were compared and analyzed.The characteristic wavelength variables extracted from the outer skin are shown in Table 2, and the characteristic wavelength variables extracted from the inner skin are shown in Table 3.As shown in Tables 2 and 3 for potato skin, the SG + SPA and SNV + DET + SPA algorithms extracted the least number of characteristic variables (12).Compared with the original spectral data, the number of input spectral variables was reduced by 98.05%.In the potato endothelium, the SNV + DET + SPA algorithm extracted the least number of characteristic variables (11), and the input spectral variables were reduced by 98.2% compared with the original spectral data.Studies have shown that the SPA algorithm extracts relatively few variables in the feature extraction of skin and inner skin parts, and this algorithm is more dominant in feature variable extraction because it identifies the least useful data, simplifies the input of prediction model data, avoids the input of redundant data, and plays a significant role in reducing the algorithm's operation time.

PLS Method Was Used to Predict Anthocyanin Content
In this study, the PLS method was used to predict the anthocyanin content in the original spectrum, pretreatment spectrum, and characteristic wavelength variable spectrum of two types of red, black, and gold potatoes.The results are presented in Tables 4 and 5.The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.
It can be observed from Table 4 that the PLS anthocyanin predictive model was established based on the original spectrum, RC = 0.7874, RMSEC = 0.429%, RPD = 2.30, and RPD value greater than 2, indicating that this model can predict the content of anthocyanins.It can also be noted that the PLS model based on the original spectrum-based construction is better than using some pre-processing and feature wavelength variables.Pre-processing and feature wavelength extraction methods cannot accurately remove and extract the main variables from the original spectral data.However, there are too many models based on the original spectrum construction, and redundant information exists between the spectrum bands.The performance of the PLS predictive model built using the original spectrum was low.Therefore, it is necessary to find the best pre-processing and feature variable method to reduce complexity and simplify the model.
According to the results in Table 4, for the PLS anthocyanin prediction model built based on the pretreatment method, the model with the best effect was SNV + PLS (Rp = 0.7496, RMSEP = 0.435%, Rc = 0.7439, RMSEC = 0.449%, RPD = 2.25, and RPD value greater than 2).This model can be used to predict potato anthocyanins quantitatively.The optimal PLS anthocyanin prediction model based on the characteristic wavelength was DET + CARS + PLS, with Rp = 0.8593, RMSEP = 0.37%, Rc = 0.8158, RMSEC = 0.334%, RPD = 2.64, and an RPD value greater than 2.5.This shows that the model can predict the anthocyanin content in a stable and accurate manner.
Table 5 presents the results of the PLS model constructed for inner skin cells.The results showed that the PLS anthocyanin prediction model established based on the original spectral information was ideal (RPD = 2.45), indicating that the model can accurately predict anthocyanins.However, owing to excessive input data and the addition of redundant information between the spectral data, the operational efficiency of the model is low.Therefore, it is necessary to optimize the pre-processing and feature wavelength extraction algorithms to reduce the complexity and simplify the model.
As shown in Table 5, the optimal PLS anthocyanin prediction model built based on the pretreatment method was SNV + PLS, with Rp = 0.839, RMSEP = 0.395%, Rc = 0.7707, RMSEC = 0.446%, and RPD = 2.50.According to the model evaluation criteria, this model could completely predict the anthocyanin content of potatoes.The optimal PLS anthocyanin prediction model based on the characteristic wavelength was the DET + CARS + PLS model, with Rp = 0.9287, RMSEP = 0.325%, Rc = 0.9227, RMSEC = 0.329%, RPD = 3.03, and an RPD value greater than 2.5.This shows that this model has strong robustness and stability and can accurately predict anthocyanins.
From Tables 4 and 5, it can be observed that SNV + PLS is the ideal model for pre-processing, DET + CARS + PLS is the optimal model for feature variables, and DET + CARS + PLS is the best model among all models, indicating that the DET preprocessing algorithm can effectively reduce noise and remove unwanted information.The CARS algorithm can extract more effective feature variables, and the PLS algorithm can accurately predict the anthocyanin content in potatoes.
It can be noted from the results in Tables 4 and 5 that under the premise of using the same algorithm, the models established for the outer and inner skin have different effects, indicating that the sampling location still affects the prediction accuracy.Further, the prediction accuracy of the models constructed for the inner skin was better than that of the outer skin, indicating that the spectrum of the inner skin is most closely related to the anthocyanin content.If a conventional algorithm is used to predict the anthocyanin content of potatoes, then the endothelium is the preferred location.

Prediction of Anthocyanin Content by CNN Method
In this study, a CNN prediction model for anthocyanin content in potatoes was constructed based on the original full spectrum, pretreatment spectrum, and characteristic wavelength variable spectrum of potato skin and inner skin cells.The dataset was randomly divided into a training set (80%) and a test set (20%).The training set is used to train the model so that the model can learn features, and the test set is used to check the model effect.
The results of the CNN model constructed on the outer skin are listed in Table 6.As shown in Table 6, the CNN model was built based on the original full spectrum, Rc = 0.9486, RMSEC = 0.0312%, Rp = 0.9446, RMSEP = 0.2291%, and RPD = 4.41, and the RPD value was much higher than 2.5, indicating that the CNN model built based on the original full spectrum was very robust.It can accurately predict anthocyanin levels.
SG, SNV, DET, and their combinations were used to preprocess the original spectrum of the outer skin to establish a CNN prediction model.The DET + CNN model had the best accuracy, with Rc = 0.9499, RMSEC = 0.0235%, Rp = 0.9457, and RMSEP = 0.2234%.RPD = 4.4893, and the RPD value of the model was much higher than 2.5, indicating that this model could accurately predict the level of anthocyanins.
CARS and SPA feature extraction algorithms were used to extract the feature wavelength variables.The DET + CARS + CNN model exhibited the best prediction accuracy: Rc = 0.9524, RMSEC = 0.0657%, Rp = 0.9468, RMSEP = 0.2651%, and RPD = 4.0942.The RPD value of the model is still greater than 2.5, and this model can achieve accurate prediction of anthocyanins.As shown in the above table, the accuracy of the CNN model built based on SPA feature extraction is relatively general.The feature information extracted by SPA and input spectral data are limited; therefore, the CNN model learns less effective information during the training process, whereas the characteristic wavelength information variables of anthocyanins extracted by SPA in this study are not sufficiently accurate resulting in average model accuracy.
The training and testing processes of the Raw + CNN, DET + CNN, and DET + CARS + CNN models are shown in Figure 6.As shown in Table 6, the CNN model was built based on the original full spectrum, Rc = 0.9486, RMSEC = 0.0312%, Rp = 0.9446, RMSEP = 0.2291%, and RPD = 4.41, and the RPD value was much higher than 2.5, indicating that the CNN model built based on the original full spectrum was very robust.It can accurately predict anthocyanin levels.

SPA
SG, SNV, DET, and their combinations were used to preprocess the original spectrum of the outer skin to establish a CNN prediction model.The DET + CNN model had the best accuracy, with Rc = 0.9499, RMSEC = 0.0235%, Rp = 0.9457, and RMSEP = 0.2234%.RPD = 4.4893, and the RPD value of the model was much higher than 2.5, indicating that this model could accurately predict the level of anthocyanins.The specific results of the CNN model constructed for inner skin cells are listed in Table 7.The specific results of the CNN model constructed for inner skin cells are listed in Table 7.
As shown in Table 7, the Raw + CNN model built based on the original full spectrum had a high prediction accuracy: Rc = 0.9508, RMSEC = 0.0374%, Rp = 0.9461, RMSEP = 0.2361%, and RPD = 4.4933.The RPD value of this model was very high.This indicates that the anthocyanin content can be predicted accurately.
SG, SNV, DET, and their combinations were used to pretreat the original spectrum of the endothelium.The SG + DET + CNN model exhibited the best prediction performance, with Rc = 0.9499, RMSEC = 0.0359%, Rp = 0.9439, RMSEP = 0.2384%, and RPD = 4.6516.The RPD value of this model was also very high, indicating that it is very robust and can accurately predict anthocyanin content.
The CARS and SPA algorithms were used to extract feature wavelength variables.The DET + CARS + CNN model exhibited the best prediction performance: Rc = 0.9527, RMSEC = 0.0708%, Rp = 0.9457, RMSEP = 0.2711%, and RPD = 4.1623.The RPD value of this model is also very high.However, the prediction accuracy of this model was worse than that of the Raw + CNN and SG + DET + CNN models, indicating that the extracted feature variable information was incomplete and inaccurate.The research also found that the prediction accuracy of the CNN model based on SPA is worse than that of the CNN model based on CARS, owing to the small input variable information of SPA and the small amount of feature information learned in the training process of the convolutional neural network.In addition, the characteristic variable information extracted by the SPA in this study was not accurate, which led to a decline in the model prediction accuracy.The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.
In the CNN model constructed by the inner skin part, the training and testing processes of Raw + CNN, SG + DET + CNN, DET + CARS + CNN are shown in Figure 7.  6 and 7, the CNN prediction model of potato anthocyanin content built using different pretreatment methods and feature extraction algorithms for both the skin and endothelium showed little change in the correlation coefficient and root-mean-square error of the model.Compared with the CNN prediction model based on pre-processing and feature extraction algorithms, the CNN model based on the original full spectrum has a better effect, which is basically consistent with the conclusions of previous studies.Zhang Xiaolei [23] used a convolutional neural network to carry out end-to-end qualitative analysis of the spectral data of grape varieties and found that the classification and recognition effect without pretreatment was better.At the same time, the protein content of corn, the active substance content of tablets, the protein content of wheat, and the organic carbon content of soil are also quantitatively analyzed, and it is concluded that the convolutional neural network can learn from the original data without pretreatment, thus improving the accuracy.
LeCun Y [23] uses traditional algorithms and deep learning convolutional neural network algorithms to identify the feature information in the image.It is found that convolutional neural network algorithms realize linear and nonlinear expression, and identify image features adaptively under the action of different network layers and inverse functions, which reduces the pre-processing links of conventional algorithms.
Xin Wang [44] proposed an end-to-end deep learning method called the residual spectrum, which combined residual modules to learn features from original data to improve model performance and compared this algorithm with the classical convolutional neural network.The results show that the residual spectrum is better than other CNN models and traditional machine learning models in the original data.
To a certain extent, deep learning has the ability to automatically extract feature information, and extracting spectral features does not require manual pretreatment.This also shows that the CNN algorithm can simplify several operation processes of traditional machine learning algorithms and effectively improve the efficiency of model prediction.
In addition, the results showed that the accuracy of the CNN prediction model established by the inner skin part was better than that established by the outer skin part, which is consistent with the prediction model established by the previous PLS algorithm.

Conclusions
Based on a basic convolutional neural network, this study proposes the use of normalization and activation functions to build a network framework for processing spectral data information.The optimized CNN network structure and traditional machine learning PLS algorithm were used to construct potato internal anthocyanin level prediction models, and the best algorithm was selected for comparative analysis.
CNN and PLS models for anthocyanin content prediction were constructed based on the original spectrum.Rp = 0.7765, RMSEP = 0.426%, Rc = 0.7874, RMSEC = 0.429%, RPD = 2.30 for the Raw + PLS prediction model constructed in the outer skin.Rp = 0.8429, RMSEP = 0.403%, Rc = 0.8159, RMSEC = 0.422%, RPD = 2.45 for the Raw + PLS prediction model constructed in the inner skin part.Rc = 0.9486, RMSEC = 0.0312%, Rp = 0.9446, RMSEP = 0.2291%, RPD = 4.41 for the Raw + CNN prediction model constructed in the outer skin.Rc = 0.9508, RMSEC = 0.0374%, Rp = 0.9461, RMSEP = 0.2361%, and RPD = 4.4933 for the Raw + CNN prediction models constructed for the inner skin part.The results showed that the accuracy of the prediction model established by the CNN algorithm was better than that of the conventional machine learning algorithm PLS model, and the prediction accuracy of the model established using the spectral information of the endothelium was better than that of the model established using the spectral information of the outer skin.SG, SNV, SET, SG + SNV, SG + DET, SNV + DET, and other algorithms were used for the pre-processing of the original spectrum.After pre-processing, the PLS prediction model and CNN prediction models for anthocyanin content were constructed.The specific results are as follows: for the prediction model built based on PLS, the SNV + PLS algorithm was the best model for the potato skin (Rp = 0.7496, RMSEP = 0.435%, Rc = 0.7439, RMSEC = 0.449%, and RPD = 2.25).For the inner skin part, the SNV + PLS algorithm established the best model, with Rp = 0.839, RMSEP = 0.395%, Rc = 0.7707, RMSEC = 0.446%, and RPD = 2.50.In the model constructed based on the CNN, the DET + CNN model was the best for the potato skin, with Rc = 0.9499, RMSEC = 0.0235%, Rp = 0.9457, RMSEP = 0.2234%, and RPD = 4.4893; in the inner skin part, the SG + DET + CNN model was the best, with Rc = 0.9499 and RPD = 4.4893, RMSEC = 0.0359%, Rp = 0.9439, RMSEP = 0.2384%, and RPD = 4.6516.From the above data, it can be concluded that the CNN algorithm established using deep learning is superior to the conventional PLS algorithm and it shows that the prediction model established by the inner skin part is better than that by the outer skin part of the potato.
For the pre-processed spectral data, the CARS and SPA algorithms were used to select the variables most related to the anthocyanin content, and then the PLS and CNN prediction models were established.The specific results were as follows: for the model built based on PLS, DET + CARS + PLS was the best model for the skin (Rp = 0.8593, RMSEP = 0.37%, Rc = 0.8158, RMSEC = 0.334%, and RPD = 2.64).For inner skin cells, DET + CARS + PLS was the best model (Rp = 0.9287, RMSEP = 0.325%, Rc = 0.9227, RMSEC = 0.329%, and RPD = 3.03).In the model constructed based on the CNN, DET + CARS + CNN was the best model for the skin (Rc = 0.9524, RMSEC = 0.0657%, Rp = 0.9468, RMSEP = 0.2651%, RPD = 4.0942), and DET + CARS + CNN was the best model (Rc = 0.9527, RMSEC = 0.0708%, Rp = 0.9457, RMSEP = 0.2711%, and RPD = 4.1623).According to the above data, the CNN neural network algorithm is more ideal than the PLS algorithm for the model established by the feature variable extraction method, and the model built in the inner skin part is better than the model built in the outer skin part.
According to the data, the models established based on the feature variables were worse than those established based on the original spectrum and pre-processing.This was because the data extracted from the feature variables contained less information than the original and pre-processed spectral information.Compared with the CNN algorithm, the models constructed using pre-processing and feature variable extraction showed little difference in correlation coefficients and RMS errors.These results provide meaningful directions for building deep learning models using spectral information in the future.The results also showed that the sampling position affected the prediction accuracy of the model, providing a reference for improving the prediction effect of the model in the future.

Figure 3 .
Figure 3. Raw spectrum: (a) Spectral information of the outer skin; (b) Spectral information of the inner skin.Visible/near-infrared spectroscopy is based on the vibration of molecular bonds such as C-H, O-H, and N-H.Anthocyanins are flavonoid compounds with a C-skeleton of C6-C3-C6 as the basic structure, containing C-H, O-H, C-O, and other chemical bonds[38].Therefore, visible/near-infrared spectroscopy can be used to predict anthocyanin content[39].It can also be observed from the original spectrum in Figure3that there are evident trappings in the spectrum at approximately 530, 700, and 850 nm.The main pigment information was observed at approximately 530 and 700 nm, and anthocyanins

Figure 4 .
Figure 4.After the pre−processing of the outer skin.

Figure 5 .
Figure 5.After the pre−processing of the inner skin.

Figure 6 .
Figure 6.Results of the optimal outer skin model.

Figure 6 .
Figure 6.Results of the optimal outer skin model.

Figure 7 .
Figure 7. Results of the optimal inner skin model.By comparing Tables6 and 7, the CNN prediction model of potato anthocyanin content built using different pretreatment methods and feature extraction algorithms for both the skin and endothelium showed little change in the correlation coefficient and root-mean-square error of the model.Compared with the CNN prediction model based on pre-processing and feature extraction algorithms, the CNN model based on the original full spectrum has a better effect, which is basically consistent with the conclusions of previous studies.Zhang Xiaolei[23] used a convolutional neural network to carry out end-to-end qualitative analysis of the spectral data of grape varieties and found that the classification and recognition effect without pretreatment was better.At the same time, the protein content of corn, the active substance content of tablets, the protein content of wheat, and the organic carbon content of soil are also quantitatively analyzed, and it is concluded that the convolutional neural network can learn from the original data without pretreatment, thus improving the accuracy.

Table 1 .
Parameters of potato micro-hyperspectral image acquisition.

Table 2 .
Characteristic wavelength information of the outer skin.

Table 2 .
Cont.The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.

Table 3 .
Characteristic wavelength information of the inner skin.
The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.

Table 4 .
Regression prediction of PLS in outer skin region.

Table 4 .
Cont.The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.

Table 5 .
Regression prediction of PLS in inner skin region.

Table 6 .
CNN-anthocyanin prediction model in outer skin.
The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.
The algorithms that are shown individually in bold in the table are the ones that are the focus of the following analysis.

Table 7 .
CNN-anthocyanin prediction model in inner skin.