# A Free-Space-Based Model for Predicting Peanut Moisture Content during Natural Drying

Authors: Xin Xu; Ying Sun; Yuanyuan Yin; Yiwei Xue; Fangyan Ma; Chao Song; Hang Yin; Liqing Zhao
Journal: Journal of Food Quality
 (2022)

---

## Abstract

This study aimed to investigate the water dissipation pattern from peanut pods under natural drying conditions after harvest. The Shandong peanut Luhua 22 was used to examine the effects of varying moisture content, bulk density, and porosity on the relative permittivity of the peanut at a signal frequency of 5.8 GHz. The peanut dielectric constant, porosity, and bulk density were used as inputs and peanut kernel moisture as outputs. Support vector regression (SVR), extreme learning machine (ELM), sparrow search algorithm-support vector regression (SSA-SVR), and sparrow search algorithm-extreme learning machine (SSA-ELM) were used to create a prediction model of peanut kernel moisture content. The results show that the water content of peanut kernels decreased in a fast and then slow manner throughout the drying process and that the water content of kernels was stable at 5–8% at the end of drying. The relative permittivity of peanut kernels increased with an increase in the water content and bulk density but decreased with an increase in porosity. The developed SVR, ELM, SSA-SVR, and SSA-ELM water-content prediction models were validated and analyzed in this study, with the model test set coefficients of determination of 0.936, 0.949,0.984, and 0.994, respectively. In comparison to SVR, ELM, and SSA-SVR, the SSA-ELM root mean square error was reduced by 0.0080, 0.0060, and 0.0012, respectively. According to the findings, the ELM neural network model, which is based on the optimization of the SSA, has an improved prediction accuracy. This prediction model provides a theoretical foundation for the variations in peanut seed moisture content during the natural drying process after harvesting peanuts in Shandong, which will be useful for future peanut storage and transportation.


---

## Body

## 1. Introduction

Peanut is a major oil crop in China, with planting area and production consistently ranking first in the world for many years [1]. Peanuts are underground nuts, with pod growth and development requiring a relatively wet environment to ensure water absorption from the soil during the entire growth phase [2]. Unlike other crops, the water content of fresh blossoms can be as high as 40%. Peanut shells are thicker, seeds are larger, and the water evaporation process is slower compared with that of other food crops. Therefore, it takes longer to harvest and dry peanuts [3]. At our location, it takes eight to 10 days to dry peanuts to a safe water quantity, and because of variables such as the scale of peanut production and the lack of popularity of drying technology, natural drying still dominates peanut drying in China. Farmers frequently suffer unnecessary economic losses because of their lack of attention to the drying process or appropriate testing technologies [4]. Therefore, it is critical to examine the change in peanut moisture during natural drying for the purpose of improving the drying process and storage of peanuts.Microwave, capacitance, resistance, infrared, and resonant cavity technologies are currently the most common methods for detecting moisture content in agricultural crops [5]. Since 1977, when Nelson [6] employed dielectric characteristics to quantify grain moisture, interest in the dielectric constant of agricultural materials has increased in both local and international studies. Electrostatic (frequency equal to direct current (DC)) water has a dielectric constant of approximately 81 at room temperature, which is substantially greater than that of other materials; therefore, the water content of agricultural products is closely related to their dielectric qualities [7]. Guo et al. used the capacitance method to explore the effects of the water content, temperature, and bulk density on the relative dielectric constants of substances from barley, tiny grains, and pears [8–11]. However, their studies were concerned with capacitance. Zhu et al. investigated the effects of signal frequency, temperature, and dielectric density on the nodal properties of soybean and peanut and used artificial neural network modeling to characterize a water-content prediction model between the water content and dielectric properties of soybean, which provided a theoretical basis for manual modeling [12]. Jin et al. investigated the dielectric characteristics of maize with moisture contents ranging from 13–22% between 25–85°C and 10–3000 MHz, resulting in a new scientific strategy for evaluating maize drying and storage [13]. Zhou et al. used the microwave method of attenuation to measure the moisture content of straw and phase shift [14]. The high-frequency penetration of microwaves and nondestructive detection have resulted in domestic researchers using microwave dielectric testing technology to conduct analyses and research on the factors affecting crop moisture testing. However, these studies included materials without shells; therefore, the peanut shell and seed kernel moisture dissipation relationship while drying naturally is still unclear.In recent years, machine learning has been used for crop moisture-content prediction, namely multiple linear regression (MLR) [15], regression tree and support vector regression (SVR), and radial basis function (RBF) neural networks [16]. These models greatly advance the ability to predict the crop moisture content. However, the performance of the model is significantly impacted for peanuts, a shell crop; this includes data quality, input features, prediction algorithm, and selected parameters. Therefore, the existing model needs to be further refined to predict the moisture content of the inner kernels of peanut pods more accurately. The influence of temperature, porosity, and bulk density on the relative permittivity of Luhua 22 peanuts was explored utilizing the transmission method of the microwave free-space method at a frequency of 5.8 GHz. A peanut seed moisture-content prediction model was generated using an extreme learning machine (ELM) neural network, and a sparrow-search algorithm (SSA) was used to optimize the parameters of the prediction model to determine the optimal prediction model for evaluating the peanut moisture content. This provides a theoretical foundation for the water dissipation pattern of peanuts during the natural drying process, decreases resource waste, and has significant implications for peanut storage.


## 2. Materials and Methods

### 2.1. Test Principle

#### 2.1.1. Testbed Construction

Free-space microwave transmission was used to assess peanut moisture content by evaluating the loss of attenuation and phase shift experienced by electromagnetic waves after passing through the peanut samples. The experimental equipment included components such as a high-gain flat plate antenna, PXIe controller, sending antenna, and receiving antenna (Figure1).Figure 1
The test platform used to assess peanut moisture content.The Pxle-5644R vector signal transceiver (VST) has a real-time bandwidth of up to 80 MHz and a center frequency of up to 6 GHz [17]. The 5.8 GHz microwave spectrum of the industrial scientific medical (ISM) band was chosen as a suitable microwave frequency (5.725–5.875 GHz). A 6 GHz radio frequency (RF) vector signal generator, vector signal analyzer, high-performance user-programmable field programmable gate array (FPGA), and high-speed serial and parallel digital interfaces were all housed in its card slot.


#### 2.1.2. Principle of Dielectric Constant Measurement

The VST first inputs the 120 MHz clock into the phase-locked loop (PLL) [18], which includes three vector-controlled oscillators (VCOs) with frequencies of 2–2.5, 2.5–3, and 3–4 GHz. The signal is shifted to the frequency multiplier (two multipliers) for output, as this experiment employs a 5.8 GHz microwave transmission. After passing through the directional coupler, the microwave source was split into two signals. One microwave signal served as a reference signal and was supplied to the mixer’s local oscillator (LO) port. The transmitting antenna received another microwave signal that radiated electromagnetic energy into the sample being tested [19]. The receiving antenna is located opposite to the transmitting antenna, and it collects electromagnetic energy after it passes through the sample and transmits it to the RF port of the mixer. The test rig antenna is a high-gain flat panel antenna, which is lower in cost and has a narrower beam width, resulting in more concentrated electromagnetic microwave signals able to match the electromagnetic energy measurement needs of this experiment. The RF input is split into two paths in a zero intermediate frequency (IF) receiver. The RF input was mixed with the LO signal in one path, resulting in an in-phase (I) signal. The RF signal was combined with the 90° phase-shifted LO signal in the second path, resulting in a quadrature (Q) signal. The voltage output from the mixer has a DC value because the LO and RF signals have the same frequency (5.8 GHz), which makes it easier to evaluate the energy lost due to moisture in the sample. The output DC value was calculated as follows [20]:(1)VI=VKdcosϕ,VQ=VKdsinϕ,ϕ=arctanVQVI,where V represents the peak voltage, Kd represents the total conversion gain of the receiver, and ϕ represents the phase angle between the two signals.The attenuation and phase shift of the microwave signals were estimated using the original microwave signal as a reference value, compared to the microwave signal obtained when a sample was placed between the sending and receiving antennas [21]. The attenuation ΔA (dB) represents the difference in the signal power level between the sample being present (PRF1) and without the sample (PRF0).(2)ΔA=PRF1−PRF0,where the RF power level (dB) is calculated as(3)PRFdB=10logPRFW.The phase shift is the difference between the phase without the sample present (Φ0) and the phase with the sample present (ΦS) and represents the delay induced by the slowing down of the wave propagation in the sample.(4)ΔΦrad=Φs−Φ0.The dielectric constantεr′ and dielectric loss factor εr″ were determined using the attenuation constant α and phase shift constant β as follows:(5)εr′=β2−α2β02,(6)εr″=2αββ02.Additionally,α and β can be determined using the following equations:(7)α=ΔA8.686d,(8)β=β0+ΔΦd,(9)β0=2πλ0,(10)λ0=cf,where λ0 is the free-space wavelength, c is the speed of light in vacuum (m/s), f is the frequency (Hz), and d is the thickness of the material (m).Multiple reflections within the sample and between the antennas were minimized to limit compromising the accuracy of the attenuation measurement by ensuring the material thickness achieves an attenuation of at least 8–10 dB [22]. If the material thickness is greater than the wavelength, phase blurring occurs; however, this can be adjusted using the following equation:(11)ΔΦactrad=Φs−Φ0−2πn,where N is the integer to be determined. Extensive experimental calibration of this peanut moisture-content testing resulted in the development of a new phase correction method. The attenuation values for each purchased peanut test sample and the corresponding dielectric constants were plotted on a graph (Figure 2). Using this graph, if the measured attenuation of the peanut sample is 12.4 dB, then the expected range of the dielectric constant (2.42–2.60) can be determined. The value of the dielectric constant is then computed using equations (5) to (10), starting with n = 1 in equation (11). If the value produced is within that range, then n = 1 is the solution. If the calculated value did not fall within the specified range, then the value of n is increased by an integer, and the new value is calculated as before until it reaches a value within the specified range. The dielectric characteristics of the matching device under test (DUT) were acquired once n was calculated. Phase correction does not require the physical parameters of the sample, such as density, moisture, or temperature.Figure 2
Reference diagram for the phase ambiguity correction algorithm. The dielectric range example is indicated with dashed lines.


### 2.2. Test Materials and Equipment

#### 2.2.1. Test Materials

The material used in this trial was the Luhua 22 peanut variety, selected from double-kernel nuts with intact pods, free of insect damage, of uniform size, and full. The shells and seeds were washed with clean water to remove sediment, and the surface was dried with a dry cloth and then immediately weighed.


#### 2.2.2. Test Equipment

An MB45 Halogen Moisture Analyzer (OHAUS, Shanghai, China), YH Electronic Balance (Yingheng, Shanghai, China), and other auxiliary equipment, such as compact bags, cling film, aluminum boxes, and drying dishes, were used to conduct the experiments in this study [23].


### 2.3. Measurement Methods

#### 2.3.1. Free Water Dissipation Patterns in Peanut Pods

The peanut pods were placed in mesh bags (0.5 × 0.8 m) and laid flat in a single layer outside the laboratory to dry at a thickness of approximately 3 cm, with external climatic conditions of 5–20°C and 35–55% relative humidity. The initial moisture content of the peanut shells and kernels was recorded before drying. The peanuts were then spread for drying, turning over the nuts every 12 h. Forty peanut pods were collected every 24 h, shells were peeled, and the husks and kernels were weighed. Porosity was measured by the pycnometer method, and the moisture content of the peanut kernels was recorded by the drying method. This was repeated three times. Each sample was chosen at random to fill the measurement container with peanut pods, which were placed in the container at a low density using the free-fall method. The mass of the peanut sample in the container was altered by vibration and pressure, changing the bulk density to obtain a high bulk density value for peanuts. Two-hundred groups of test samples were obtained. A flowchart of the predictive modeling is presented in Figure3.Figure 3
Predictive modeling flowchart.


#### 2.3.2. Dielectric Constant Measurement

The peanut dielectric constant measurement platform mainly comprises a microwave signal source, transmitting and receiving antennas, data acquisition unit, and a computer. The loss of electromagnetic waves in the air was compensated for by placing an empty sample holder between the sending and receiving antennas at the start of the measurement. Peanut pod samples with varying moisture levels were measured after the reference values were recorded using LabVIEW analysis software. The true attenuation and phase shift values were acquired in the front panel of the software. The test cable and VST are extremely sensitive to temperature-induced phase shifts; therefore, temperature also affects the samples being tested. To account for this, the laboratory room temperature was set to approximately 25°C to ensure the accuracy of the experiment. Furthermore, the dielectric constant of peanuts was not measured, until the instrument had warmed up for 1 h after switching on to minimize the effect of temperature drift within the instrument between sample measurements.


#### 2.3.3. Peanut Moisture Measurement

(1) Measuring the Moisture Content of Peanuts on a Wet Basis. The “Determination of Moisture in Food Safety National Standard Food” (GB5009.3-2016) protocol was used to measure the moisture content of peanut samples. Samples were heated to a constant weight in an electric thermostatic oven at 103 ± 2°C. The mass lost from the sample was determined, and the moisture content was calculated.(2) Steps for Measuring the Moisture Content of Peanuts. Five grams of the sample was weighed using an electronic balance and then placed in a drying oven at 103 ± 2°C. After heating for 4 h, the cover was removed, the samples were chilled in a desiccator to room temperature, and the samples were weighed. The sample was then heated for 1 h in a desiccator, the lid was removed, and the sample was returned to the desiccator for cooling and weighed. The heating procedure was repeated for 1 h or until the difference between two successive weighs was less than 0.005 g, indicating a constant weight.(3) Calculation Methods. Peanut moisture content was expressed as a mass fraction and was calculated using the following equation:(12)M=m1−m2m0×100%,where M is the moisture content of the peanut sample (%), m1 is the mass of the specimen and the drying dish before drying (g), m2 is the mass of the specimen and drying dish after drying, and m0 is the mass of the specimen. In this experiment, porosity was measured using the pycnometer immersion method.


#### 2.3.4. Peanut Pod Porosity Measurements

Porosity is the ratio of the volume of pores in a lumpy material to the total volume of the material in its natural state [24]. The specific gravity bottle was filled with distilled water, together with the stopper, and its mass was weighed as m0 (accurate to 0.001 g). The sample (peanut seeds, shells) was crushed as far as possible to remove impurities, 5 g of the sample was weighed out in the specific gravity bottle, and then, the distilled water (m0) was transferred to the specific gravity bottle and the mass weighed (m2). The true density (ρs/(g/cm3)) was calculated using the following equation:(13)ρs=msρms+m1+m2,where ms is the mass of the sample, ρ is the density of distilled water (1 g/cm3 at 20°C), m1 is the mass of the specific gravity bottle containing the distilled water, and m2 is the mass of the specific gravity bottle containing distilled water and the sample.The volume of the samples was measured using the drainage method. The mass was measured using an electronic balance, and each set of samples was repeated three times. The porosity,P, was calculated using the following equation:(14)P=1−mVρs×100%.


### 2.4. Modeling Methods

Support vector regression (SVR), ELM, sparrow search algorithm–support vector regression (SSA-SVR), and sparrow search algorithm–extreme learning machine (SSA-ELM) were utilized in this study to develop a model for predicting the moisture content of peanut kernels using microwave dielectric properties. To develop a good prediction model for exploring the moisture dissipation pattern of peanut pods throughout the drying process, the root mean square error (RMSE) and coefficient of determination (R2) were utilized as model evaluation indicators.


#### 2.4.1. Support Vector Regression (SVR)

SVR is an important application branch of support vector machine (SVM), which uses the same principles as SVM. The core of this method is the choice of the kernel function, which solves the problem of nonlinear transformation of some data points in the original space to the computational complexity in the high-dimensional feature space by constructing the optimal hyperplane to convert the nonlinear problem into a linear one. However, the idea of SVR is to find the best-fit line, which can reflect a regression trend and can be applied to predict the output. And the SVR decision interface is more robust than regular linear regression since it has a specific “thickness”—that is, if the sample is not too far from the regression line or hyperplane, no error is thought to have occurred.The polynomial kernel function, linear kernel function, sigmoid kernel function, and Gaussian radial basis kernel function are the most frequently utilized kernel functions [25]. Since the experimental data in this paper are nonlinear, the Gaussian radial basis kernel function is chosen as its kernel function, which has two main hyperparameters: the penalty parameter C and the kernel function parameter g.


#### 2.4.2. Extreme Learning Machine (ELM)

The ELM is a new feedforward neural network learning algorithm that differs from the traditional gradient-based feedforward neural network learning algorithms in that the connection weights between the hidden and the input layers, as well as the thresholds of the neurons in the hidden layer [26], are generated at random. To obtain a unique optimal solution during parameter training, we set the number of buried neurons. The most important characteristic of ELM is that the input and implicit layer connection weights, as well as the implicit layer threshold, can be set arbitrarily and do not need to be modified after initialization. Compared to standard back propagation (BP) neural networks, such a rule saves time and effort because it eliminates the requirement to reverse the weights and thresholds, resulting in superior model generalization and speed [27].The key influencing parameters are chosen in this study to investigate the water loss pattern of peanut kernels during the natural drying process bulk density, dielectric constant, and porosity. The input parameters of the neural network were peanut bulk density, dielectric constant, and porosity, while the output parameter was peanut seed moisture content. The structure of the neural network is presented in Figure4. A 3-layer network topology with a single hidden layer was used, and the number of nodes in the hidden layer was calculated using the following equation:(15)L≤am+n+a,where L is the number of implied layer nodes, m is the number of output layer nodes, n is the number of input layer nodes, and a is the regulation constant (typically between 1 and 10).Figure 4
Extreme learning machine network structure.In the limit learning machine, if we suppose that there areN random samples, let them be (Xi, ti), where Xi = [xi1,xi2,…,xin]T ∈ Rn, ti = [ti1, ti2,…,tin]T ∈ Rm. Then, for a single hidden layer neural network with L hidden layer neurons, ∑i=1LβigWiXj+bi=oj,j=1,.,N where gx is the activation function. Not only can many nonlinear activation functions be used in ELM (such as S-shaped, sine, and composite functions), but nonintegrable functions and even discontinuous functions can also be used as activation functions. In the above equation, Wi=wi,1,wi,2,.,wi,n,T is the input weight, βi is the output weight, bi is the bias of the hidden unit, and WiXj denotes the inner product of the two.


#### 2.4.3. ELM Neural Network Optimization Based on SSA

The SSA is a novel type of swarm intelligence optimization algorithm based on sparrow foraging and predator avoidance behavior. Its advantages include high search accuracy, fast convergence, stability, and avoidance of falling into local optimality [28].It is essential to utilize virtual sparrows to identify food in the simulation experiment. The population ofn sparrows can be described as follows:(16)X=x11x12.x1dx21x22.x2d....xn1xn2.xnd,where d is the number of sparrows and n is the dimensionality of the issue variable to be optimized. Therefore, all of the sparrow fitness values can be described in the following manner [29]:(17)Fx=fx11x12.x1dfx21x22.x2dfxn1xn2.xnd.During the search process in SSA, discoverers with higher fitness values are prioritized. Furthermore, the discoverer is in charge of obtaining food for the entire sparrow population, as well as offering foraging directions to all newcomers. As a result, the discoverer has a wider range of foraging options than joiners. According to equations (16) and (17), the update of the position of the discoverer during the course of each iteration is described as follows:(18)Xi,jt+1=Xi,j.exp−iα.itermax,ifR2<ST,Xi,j+Q.L,ifR2≥ST,where t and itermax represent the current number of iterations and the maximum number of iterations, respectively, and X (i, j) represents the position information of the ith sparrow in the jth dimension. The α ∈ (0, 1] represents a random number, and R2 ∈ (0, 1] and ST ∈ (0.5, 1] are warning and safety values, respectively. Q is a random number subject to a normal distribution, and L is a 1 × d matrix.WhenR2<ST, the finder can execute extended search activities because there are no predators in the foraging environment. When R2≥ST is present, this indicates that some sparrows in the population have discovered a predator and have informed other sparrows in the population; at this moment, all sparrows must fly to safe alternative foraging areas. The formula for updating the joint position is as follows:(19)Xi,jt+1=Q,expXworst−Xi,jti2,ifi>n2,XPt+1+Xi,j−XPt+1.A+.L,otherwise,where XP is the best position currently occupied by the discoverer, and Xworst indicates the current global worst position. A denotes a 1 × d matrix in which the elements of A are randomly assigned to 1 or −1. When i > n/2, this indicates that the ith joiner with a lower fitness value does not obtain food and must forage. The formula for updating the alert position is as follows:(20)Xi,jt+1=Xbestt+β.Xi,jt−Xbestt,iffi>fg,Xi,jt+K.Xi,jt−Xworsttfi−fw+ε,iffi=fg,where Xbest is the global best position, and β is the step size control parameter, which is a random number that obeys a normal distribution with a mean of 0 and a variance of 1. The fi, fg, and fw represent the i-th sparrow, global best, and worst adaptation, respectively. The ε is a constant that avoids a zero in the denominator. When fi>fg, the sparrow is at the edge of the population and extremely vulnerable to predator attacks. When fi=fg, the sparrow is in the middle position and is aware of the danger and must adjust its strategy in time to avoid the attack.When the classic ELM is trained, the system randomly generates the connection weights and thresholds between the input and hidden layers; therefore, the values remain the same after initializing the weights and thresholds, resulting in a poor global search or training failure. In the process of initializing the weight thresholds, SSA was first optimized as a global optimization search algorithm. The optimized values can improve the training effect and network performance to a greater extent, boost convergence speed, and minimize difficulties such as random initialization-induced local optimality. The flow chart of SSA is shown in Figure5.Figure 5
SSA flow chart.


## 2.1. Test Principle

### 2.1.1. Testbed Construction

Free-space microwave transmission was used to assess peanut moisture content by evaluating the loss of attenuation and phase shift experienced by electromagnetic waves after passing through the peanut samples. The experimental equipment included components such as a high-gain flat plate antenna, PXIe controller, sending antenna, and receiving antenna (Figure1).Figure 1
The test platform used to assess peanut moisture content.The Pxle-5644R vector signal transceiver (VST) has a real-time bandwidth of up to 80 MHz and a center frequency of up to 6 GHz [17]. The 5.8 GHz microwave spectrum of the industrial scientific medical (ISM) band was chosen as a suitable microwave frequency (5.725–5.875 GHz). A 6 GHz radio frequency (RF) vector signal generator, vector signal analyzer, high-performance user-programmable field programmable gate array (FPGA), and high-speed serial and parallel digital interfaces were all housed in its card slot.


### 2.1.2. Principle of Dielectric Constant Measurement

The VST first inputs the 120 MHz clock into the phase-locked loop (PLL) [18], which includes three vector-controlled oscillators (VCOs) with frequencies of 2–2.5, 2.5–3, and 3–4 GHz. The signal is shifted to the frequency multiplier (two multipliers) for output, as this experiment employs a 5.8 GHz microwave transmission. After passing through the directional coupler, the microwave source was split into two signals. One microwave signal served as a reference signal and was supplied to the mixer’s local oscillator (LO) port. The transmitting antenna received another microwave signal that radiated electromagnetic energy into the sample being tested [19]. The receiving antenna is located opposite to the transmitting antenna, and it collects electromagnetic energy after it passes through the sample and transmits it to the RF port of the mixer. The test rig antenna is a high-gain flat panel antenna, which is lower in cost and has a narrower beam width, resulting in more concentrated electromagnetic microwave signals able to match the electromagnetic energy measurement needs of this experiment. The RF input is split into two paths in a zero intermediate frequency (IF) receiver. The RF input was mixed with the LO signal in one path, resulting in an in-phase (I) signal. The RF signal was combined with the 90° phase-shifted LO signal in the second path, resulting in a quadrature (Q) signal. The voltage output from the mixer has a DC value because the LO and RF signals have the same frequency (5.8 GHz), which makes it easier to evaluate the energy lost due to moisture in the sample. The output DC value was calculated as follows [20]:(1)VI=VKdcosϕ,VQ=VKdsinϕ,ϕ=arctanVQVI,where V represents the peak voltage, Kd represents the total conversion gain of the receiver, and ϕ represents the phase angle between the two signals.The attenuation and phase shift of the microwave signals were estimated using the original microwave signal as a reference value, compared to the microwave signal obtained when a sample was placed between the sending and receiving antennas [21]. The attenuation ΔA (dB) represents the difference in the signal power level between the sample being present (PRF1) and without the sample (PRF0).(2)ΔA=PRF1−PRF0,where the RF power level (dB) is calculated as(3)PRFdB=10logPRFW.The phase shift is the difference between the phase without the sample present (Φ0) and the phase with the sample present (ΦS) and represents the delay induced by the slowing down of the wave propagation in the sample.(4)ΔΦrad=Φs−Φ0.The dielectric constantεr′ and dielectric loss factor εr″ were determined using the attenuation constant α and phase shift constant β as follows:(5)εr′=β2−α2β02,(6)εr″=2αββ02.Additionally,α and β can be determined using the following equations:(7)α=ΔA8.686d,(8)β=β0+ΔΦd,(9)β0=2πλ0,(10)λ0=cf,where λ0 is the free-space wavelength, c is the speed of light in vacuum (m/s), f is the frequency (Hz), and d is the thickness of the material (m).Multiple reflections within the sample and between the antennas were minimized to limit compromising the accuracy of the attenuation measurement by ensuring the material thickness achieves an attenuation of at least 8–10 dB [22]. If the material thickness is greater than the wavelength, phase blurring occurs; however, this can be adjusted using the following equation:(11)ΔΦactrad=Φs−Φ0−2πn,where N is the integer to be determined. Extensive experimental calibration of this peanut moisture-content testing resulted in the development of a new phase correction method. The attenuation values for each purchased peanut test sample and the corresponding dielectric constants were plotted on a graph (Figure 2). Using this graph, if the measured attenuation of the peanut sample is 12.4 dB, then the expected range of the dielectric constant (2.42–2.60) can be determined. The value of the dielectric constant is then computed using equations (5) to (10), starting with n = 1 in equation (11). If the value produced is within that range, then n = 1 is the solution. If the calculated value did not fall within the specified range, then the value of n is increased by an integer, and the new value is calculated as before until it reaches a value within the specified range. The dielectric characteristics of the matching device under test (DUT) were acquired once n was calculated. Phase correction does not require the physical parameters of the sample, such as density, moisture, or temperature.Figure 2
Reference diagram for the phase ambiguity correction algorithm. The dielectric range example is indicated with dashed lines.


## 2.1.1. Testbed Construction

Free-space microwave transmission was used to assess peanut moisture content by evaluating the loss of attenuation and phase shift experienced by electromagnetic waves after passing through the peanut samples. The experimental equipment included components such as a high-gain flat plate antenna, PXIe controller, sending antenna, and receiving antenna (Figure1).Figure 1
The test platform used to assess peanut moisture content.The Pxle-5644R vector signal transceiver (VST) has a real-time bandwidth of up to 80 MHz and a center frequency of up to 6 GHz [17]. The 5.8 GHz microwave spectrum of the industrial scientific medical (ISM) band was chosen as a suitable microwave frequency (5.725–5.875 GHz). A 6 GHz radio frequency (RF) vector signal generator, vector signal analyzer, high-performance user-programmable field programmable gate array (FPGA), and high-speed serial and parallel digital interfaces were all housed in its card slot.


## 2.1.2. Principle of Dielectric Constant Measurement

The VST first inputs the 120 MHz clock into the phase-locked loop (PLL) [18], which includes three vector-controlled oscillators (VCOs) with frequencies of 2–2.5, 2.5–3, and 3–4 GHz. The signal is shifted to the frequency multiplier (two multipliers) for output, as this experiment employs a 5.8 GHz microwave transmission. After passing through the directional coupler, the microwave source was split into two signals. One microwave signal served as a reference signal and was supplied to the mixer’s local oscillator (LO) port. The transmitting antenna received another microwave signal that radiated electromagnetic energy into the sample being tested [19]. The receiving antenna is located opposite to the transmitting antenna, and it collects electromagnetic energy after it passes through the sample and transmits it to the RF port of the mixer. The test rig antenna is a high-gain flat panel antenna, which is lower in cost and has a narrower beam width, resulting in more concentrated electromagnetic microwave signals able to match the electromagnetic energy measurement needs of this experiment. The RF input is split into two paths in a zero intermediate frequency (IF) receiver. The RF input was mixed with the LO signal in one path, resulting in an in-phase (I) signal. The RF signal was combined with the 90° phase-shifted LO signal in the second path, resulting in a quadrature (Q) signal. The voltage output from the mixer has a DC value because the LO and RF signals have the same frequency (5.8 GHz), which makes it easier to evaluate the energy lost due to moisture in the sample. The output DC value was calculated as follows [20]:(1)VI=VKdcosϕ,VQ=VKdsinϕ,ϕ=arctanVQVI,where V represents the peak voltage, Kd represents the total conversion gain of the receiver, and ϕ represents the phase angle between the two signals.The attenuation and phase shift of the microwave signals were estimated using the original microwave signal as a reference value, compared to the microwave signal obtained when a sample was placed between the sending and receiving antennas [21]. The attenuation ΔA (dB) represents the difference in the signal power level between the sample being present (PRF1) and without the sample (PRF0).(2)ΔA=PRF1−PRF0,where the RF power level (dB) is calculated as(3)PRFdB=10logPRFW.The phase shift is the difference between the phase without the sample present (Φ0) and the phase with the sample present (ΦS) and represents the delay induced by the slowing down of the wave propagation in the sample.(4)ΔΦrad=Φs−Φ0.The dielectric constantεr′ and dielectric loss factor εr″ were determined using the attenuation constant α and phase shift constant β as follows:(5)εr′=β2−α2β02,(6)εr″=2αββ02.Additionally,α and β can be determined using the following equations:(7)α=ΔA8.686d,(8)β=β0+ΔΦd,(9)β0=2πλ0,(10)λ0=cf,where λ0 is the free-space wavelength, c is the speed of light in vacuum (m/s), f is the frequency (Hz), and d is the thickness of the material (m).Multiple reflections within the sample and between the antennas were minimized to limit compromising the accuracy of the attenuation measurement by ensuring the material thickness achieves an attenuation of at least 8–10 dB [22]. If the material thickness is greater than the wavelength, phase blurring occurs; however, this can be adjusted using the following equation:(11)ΔΦactrad=Φs−Φ0−2πn,where N is the integer to be determined. Extensive experimental calibration of this peanut moisture-content testing resulted in the development of a new phase correction method. The attenuation values for each purchased peanut test sample and the corresponding dielectric constants were plotted on a graph (Figure 2). Using this graph, if the measured attenuation of the peanut sample is 12.4 dB, then the expected range of the dielectric constant (2.42–2.60) can be determined. The value of the dielectric constant is then computed using equations (5) to (10), starting with n = 1 in equation (11). If the value produced is within that range, then n = 1 is the solution. If the calculated value did not fall within the specified range, then the value of n is increased by an integer, and the new value is calculated as before until it reaches a value within the specified range. The dielectric characteristics of the matching device under test (DUT) were acquired once n was calculated. Phase correction does not require the physical parameters of the sample, such as density, moisture, or temperature.Figure 2
Reference diagram for the phase ambiguity correction algorithm. The dielectric range example is indicated with dashed lines.


## 2.2. Test Materials and Equipment

### 2.2.1. Test Materials

The material used in this trial was the Luhua 22 peanut variety, selected from double-kernel nuts with intact pods, free of insect damage, of uniform size, and full. The shells and seeds were washed with clean water to remove sediment, and the surface was dried with a dry cloth and then immediately weighed.


### 2.2.2. Test Equipment

An MB45 Halogen Moisture Analyzer (OHAUS, Shanghai, China), YH Electronic Balance (Yingheng, Shanghai, China), and other auxiliary equipment, such as compact bags, cling film, aluminum boxes, and drying dishes, were used to conduct the experiments in this study [23].


## 2.2.1. Test Materials

The material used in this trial was the Luhua 22 peanut variety, selected from double-kernel nuts with intact pods, free of insect damage, of uniform size, and full. The shells and seeds were washed with clean water to remove sediment, and the surface was dried with a dry cloth and then immediately weighed.


## 2.2.2. Test Equipment

An MB45 Halogen Moisture Analyzer (OHAUS, Shanghai, China), YH Electronic Balance (Yingheng, Shanghai, China), and other auxiliary equipment, such as compact bags, cling film, aluminum boxes, and drying dishes, were used to conduct the experiments in this study [23].


## 2.3. Measurement Methods

### 2.3.1. Free Water Dissipation Patterns in Peanut Pods

The peanut pods were placed in mesh bags (0.5 × 0.8 m) and laid flat in a single layer outside the laboratory to dry at a thickness of approximately 3 cm, with external climatic conditions of 5–20°C and 35–55% relative humidity. The initial moisture content of the peanut shells and kernels was recorded before drying. The peanuts were then spread for drying, turning over the nuts every 12 h. Forty peanut pods were collected every 24 h, shells were peeled, and the husks and kernels were weighed. Porosity was measured by the pycnometer method, and the moisture content of the peanut kernels was recorded by the drying method. This was repeated three times. Each sample was chosen at random to fill the measurement container with peanut pods, which were placed in the container at a low density using the free-fall method. The mass of the peanut sample in the container was altered by vibration and pressure, changing the bulk density to obtain a high bulk density value for peanuts. Two-hundred groups of test samples were obtained. A flowchart of the predictive modeling is presented in Figure3.Figure 3
Predictive modeling flowchart.


### 2.3.2. Dielectric Constant Measurement

The peanut dielectric constant measurement platform mainly comprises a microwave signal source, transmitting and receiving antennas, data acquisition unit, and a computer. The loss of electromagnetic waves in the air was compensated for by placing an empty sample holder between the sending and receiving antennas at the start of the measurement. Peanut pod samples with varying moisture levels were measured after the reference values were recorded using LabVIEW analysis software. The true attenuation and phase shift values were acquired in the front panel of the software. The test cable and VST are extremely sensitive to temperature-induced phase shifts; therefore, temperature also affects the samples being tested. To account for this, the laboratory room temperature was set to approximately 25°C to ensure the accuracy of the experiment. Furthermore, the dielectric constant of peanuts was not measured, until the instrument had warmed up for 1 h after switching on to minimize the effect of temperature drift within the instrument between sample measurements.


### 2.3.3. Peanut Moisture Measurement

(1) Measuring the Moisture Content of Peanuts on a Wet Basis. The “Determination of Moisture in Food Safety National Standard Food” (GB5009.3-2016) protocol was used to measure the moisture content of peanut samples. Samples were heated to a constant weight in an electric thermostatic oven at 103 ± 2°C. The mass lost from the sample was determined, and the moisture content was calculated.(2) Steps for Measuring the Moisture Content of Peanuts. Five grams of the sample was weighed using an electronic balance and then placed in a drying oven at 103 ± 2°C. After heating for 4 h, the cover was removed, the samples were chilled in a desiccator to room temperature, and the samples were weighed. The sample was then heated for 1 h in a desiccator, the lid was removed, and the sample was returned to the desiccator for cooling and weighed. The heating procedure was repeated for 1 h or until the difference between two successive weighs was less than 0.005 g, indicating a constant weight.(3) Calculation Methods. Peanut moisture content was expressed as a mass fraction and was calculated using the following equation:(12)M=m1−m2m0×100%,where M is the moisture content of the peanut sample (%), m1 is the mass of the specimen and the drying dish before drying (g), m2 is the mass of the specimen and drying dish after drying, and m0 is the mass of the specimen. In this experiment, porosity was measured using the pycnometer immersion method.


### 2.3.4. Peanut Pod Porosity Measurements

Porosity is the ratio of the volume of pores in a lumpy material to the total volume of the material in its natural state [24]. The specific gravity bottle was filled with distilled water, together with the stopper, and its mass was weighed as m0 (accurate to 0.001 g). The sample (peanut seeds, shells) was crushed as far as possible to remove impurities, 5 g of the sample was weighed out in the specific gravity bottle, and then, the distilled water (m0) was transferred to the specific gravity bottle and the mass weighed (m2). The true density (ρs/(g/cm3)) was calculated using the following equation:(13)ρs=msρms+m1+m2,where ms is the mass of the sample, ρ is the density of distilled water (1 g/cm3 at 20°C), m1 is the mass of the specific gravity bottle containing the distilled water, and m2 is the mass of the specific gravity bottle containing distilled water and the sample.The volume of the samples was measured using the drainage method. The mass was measured using an electronic balance, and each set of samples was repeated three times. The porosity,P, was calculated using the following equation:(14)P=1−mVρs×100%.


## 2.3.1. Free Water Dissipation Patterns in Peanut Pods

The peanut pods were placed in mesh bags (0.5 × 0.8 m) and laid flat in a single layer outside the laboratory to dry at a thickness of approximately 3 cm, with external climatic conditions of 5–20°C and 35–55% relative humidity. The initial moisture content of the peanut shells and kernels was recorded before drying. The peanuts were then spread for drying, turning over the nuts every 12 h. Forty peanut pods were collected every 24 h, shells were peeled, and the husks and kernels were weighed. Porosity was measured by the pycnometer method, and the moisture content of the peanut kernels was recorded by the drying method. This was repeated three times. Each sample was chosen at random to fill the measurement container with peanut pods, which were placed in the container at a low density using the free-fall method. The mass of the peanut sample in the container was altered by vibration and pressure, changing the bulk density to obtain a high bulk density value for peanuts. Two-hundred groups of test samples were obtained. A flowchart of the predictive modeling is presented in Figure3.Figure 3
Predictive modeling flowchart.


## 2.3.2. Dielectric Constant Measurement

The peanut dielectric constant measurement platform mainly comprises a microwave signal source, transmitting and receiving antennas, data acquisition unit, and a computer. The loss of electromagnetic waves in the air was compensated for by placing an empty sample holder between the sending and receiving antennas at the start of the measurement. Peanut pod samples with varying moisture levels were measured after the reference values were recorded using LabVIEW analysis software. The true attenuation and phase shift values were acquired in the front panel of the software. The test cable and VST are extremely sensitive to temperature-induced phase shifts; therefore, temperature also affects the samples being tested. To account for this, the laboratory room temperature was set to approximately 25°C to ensure the accuracy of the experiment. Furthermore, the dielectric constant of peanuts was not measured, until the instrument had warmed up for 1 h after switching on to minimize the effect of temperature drift within the instrument between sample measurements.


## 2.3.3. Peanut Moisture Measurement

(1) Measuring the Moisture Content of Peanuts on a Wet Basis. The “Determination of Moisture in Food Safety National Standard Food” (GB5009.3-2016) protocol was used to measure the moisture content of peanut samples. Samples were heated to a constant weight in an electric thermostatic oven at 103 ± 2°C. The mass lost from the sample was determined, and the moisture content was calculated.(2) Steps for Measuring the Moisture Content of Peanuts. Five grams of the sample was weighed using an electronic balance and then placed in a drying oven at 103 ± 2°C. After heating for 4 h, the cover was removed, the samples were chilled in a desiccator to room temperature, and the samples were weighed. The sample was then heated for 1 h in a desiccator, the lid was removed, and the sample was returned to the desiccator for cooling and weighed. The heating procedure was repeated for 1 h or until the difference between two successive weighs was less than 0.005 g, indicating a constant weight.(3) Calculation Methods. Peanut moisture content was expressed as a mass fraction and was calculated using the following equation:(12)M=m1−m2m0×100%,where M is the moisture content of the peanut sample (%), m1 is the mass of the specimen and the drying dish before drying (g), m2 is the mass of the specimen and drying dish after drying, and m0 is the mass of the specimen. In this experiment, porosity was measured using the pycnometer immersion method.


## 2.3.4. Peanut Pod Porosity Measurements

Porosity is the ratio of the volume of pores in a lumpy material to the total volume of the material in its natural state [24]. The specific gravity bottle was filled with distilled water, together with the stopper, and its mass was weighed as m0 (accurate to 0.001 g). The sample (peanut seeds, shells) was crushed as far as possible to remove impurities, 5 g of the sample was weighed out in the specific gravity bottle, and then, the distilled water (m0) was transferred to the specific gravity bottle and the mass weighed (m2). The true density (ρs/(g/cm3)) was calculated using the following equation:(13)ρs=msρms+m1+m2,where ms is the mass of the sample, ρ is the density of distilled water (1 g/cm3 at 20°C), m1 is the mass of the specific gravity bottle containing the distilled water, and m2 is the mass of the specific gravity bottle containing distilled water and the sample.The volume of the samples was measured using the drainage method. The mass was measured using an electronic balance, and each set of samples was repeated three times. The porosity,P, was calculated using the following equation:(14)P=1−mVρs×100%.


## 2.4. Modeling Methods

Support vector regression (SVR), ELM, sparrow search algorithm–support vector regression (SSA-SVR), and sparrow search algorithm–extreme learning machine (SSA-ELM) were utilized in this study to develop a model for predicting the moisture content of peanut kernels using microwave dielectric properties. To develop a good prediction model for exploring the moisture dissipation pattern of peanut pods throughout the drying process, the root mean square error (RMSE) and coefficient of determination (R2) were utilized as model evaluation indicators.


### 2.4.1. Support Vector Regression (SVR)

SVR is an important application branch of support vector machine (SVM), which uses the same principles as SVM. The core of this method is the choice of the kernel function, which solves the problem of nonlinear transformation of some data points in the original space to the computational complexity in the high-dimensional feature space by constructing the optimal hyperplane to convert the nonlinear problem into a linear one. However, the idea of SVR is to find the best-fit line, which can reflect a regression trend and can be applied to predict the output. And the SVR decision interface is more robust than regular linear regression since it has a specific “thickness”—that is, if the sample is not too far from the regression line or hyperplane, no error is thought to have occurred.The polynomial kernel function, linear kernel function, sigmoid kernel function, and Gaussian radial basis kernel function are the most frequently utilized kernel functions [25]. Since the experimental data in this paper are nonlinear, the Gaussian radial basis kernel function is chosen as its kernel function, which has two main hyperparameters: the penalty parameter C and the kernel function parameter g.


### 2.4.2. Extreme Learning Machine (ELM)

The ELM is a new feedforward neural network learning algorithm that differs from the traditional gradient-based feedforward neural network learning algorithms in that the connection weights between the hidden and the input layers, as well as the thresholds of the neurons in the hidden layer [26], are generated at random. To obtain a unique optimal solution during parameter training, we set the number of buried neurons. The most important characteristic of ELM is that the input and implicit layer connection weights, as well as the implicit layer threshold, can be set arbitrarily and do not need to be modified after initialization. Compared to standard back propagation (BP) neural networks, such a rule saves time and effort because it eliminates the requirement to reverse the weights and thresholds, resulting in superior model generalization and speed [27].The key influencing parameters are chosen in this study to investigate the water loss pattern of peanut kernels during the natural drying process bulk density, dielectric constant, and porosity. The input parameters of the neural network were peanut bulk density, dielectric constant, and porosity, while the output parameter was peanut seed moisture content. The structure of the neural network is presented in Figure4. A 3-layer network topology with a single hidden layer was used, and the number of nodes in the hidden layer was calculated using the following equation:(15)L≤am+n+a,where L is the number of implied layer nodes, m is the number of output layer nodes, n is the number of input layer nodes, and a is the regulation constant (typically between 1 and 10).Figure 4
Extreme learning machine network structure.In the limit learning machine, if we suppose that there areN random samples, let them be (Xi, ti), where Xi = [xi1,xi2,…,xin]T ∈ Rn, ti = [ti1, ti2,…,tin]T ∈ Rm. Then, for a single hidden layer neural network with L hidden layer neurons, ∑i=1LβigWiXj+bi=oj,j=1,.,N where gx is the activation function. Not only can many nonlinear activation functions be used in ELM (such as S-shaped, sine, and composite functions), but nonintegrable functions and even discontinuous functions can also be used as activation functions. In the above equation, Wi=wi,1,wi,2,.,wi,n,T is the input weight, βi is the output weight, bi is the bias of the hidden unit, and WiXj denotes the inner product of the two.


### 2.4.3. ELM Neural Network Optimization Based on SSA

The SSA is a novel type of swarm intelligence optimization algorithm based on sparrow foraging and predator avoidance behavior. Its advantages include high search accuracy, fast convergence, stability, and avoidance of falling into local optimality [28].It is essential to utilize virtual sparrows to identify food in the simulation experiment. The population ofn sparrows can be described as follows:(16)X=x11x12.x1dx21x22.x2d....xn1xn2.xnd,where d is the number of sparrows and n is the dimensionality of the issue variable to be optimized. Therefore, all of the sparrow fitness values can be described in the following manner [29]:(17)Fx=fx11x12.x1dfx21x22.x2dfxn1xn2.xnd.During the search process in SSA, discoverers with higher fitness values are prioritized. Furthermore, the discoverer is in charge of obtaining food for the entire sparrow population, as well as offering foraging directions to all newcomers. As a result, the discoverer has a wider range of foraging options than joiners. According to equations (16) and (17), the update of the position of the discoverer during the course of each iteration is described as follows:(18)Xi,jt+1=Xi,j.exp−iα.itermax,ifR2<ST,Xi,j+Q.L,ifR2≥ST,where t and itermax represent the current number of iterations and the maximum number of iterations, respectively, and X (i, j) represents the position information of the ith sparrow in the jth dimension. The α ∈ (0, 1] represents a random number, and R2 ∈ (0, 1] and ST ∈ (0.5, 1] are warning and safety values, respectively. Q is a random number subject to a normal distribution, and L is a 1 × d matrix.WhenR2<ST, the finder can execute extended search activities because there are no predators in the foraging environment. When R2≥ST is present, this indicates that some sparrows in the population have discovered a predator and have informed other sparrows in the population; at this moment, all sparrows must fly to safe alternative foraging areas. The formula for updating the joint position is as follows:(19)Xi,jt+1=Q,expXworst−Xi,jti2,ifi>n2,XPt+1+Xi,j−XPt+1.A+.L,otherwise,where XP is the best position currently occupied by the discoverer, and Xworst indicates the current global worst position. A denotes a 1 × d matrix in which the elements of A are randomly assigned to 1 or −1. When i > n/2, this indicates that the ith joiner with a lower fitness value does not obtain food and must forage. The formula for updating the alert position is as follows:(20)Xi,jt+1=Xbestt+β.Xi,jt−Xbestt,iffi>fg,Xi,jt+K.Xi,jt−Xworsttfi−fw+ε,iffi=fg,where Xbest is the global best position, and β is the step size control parameter, which is a random number that obeys a normal distribution with a mean of 0 and a variance of 1. The fi, fg, and fw represent the i-th sparrow, global best, and worst adaptation, respectively. The ε is a constant that avoids a zero in the denominator. When fi>fg, the sparrow is at the edge of the population and extremely vulnerable to predator attacks. When fi=fg, the sparrow is in the middle position and is aware of the danger and must adjust its strategy in time to avoid the attack.When the classic ELM is trained, the system randomly generates the connection weights and thresholds between the input and hidden layers; therefore, the values remain the same after initializing the weights and thresholds, resulting in a poor global search or training failure. In the process of initializing the weight thresholds, SSA was first optimized as a global optimization search algorithm. The optimized values can improve the training effect and network performance to a greater extent, boost convergence speed, and minimize difficulties such as random initialization-induced local optimality. The flow chart of SSA is shown in Figure5.Figure 5
SSA flow chart.


## 2.4.1. Support Vector Regression (SVR)

SVR is an important application branch of support vector machine (SVM), which uses the same principles as SVM. The core of this method is the choice of the kernel function, which solves the problem of nonlinear transformation of some data points in the original space to the computational complexity in the high-dimensional feature space by constructing the optimal hyperplane to convert the nonlinear problem into a linear one. However, the idea of SVR is to find the best-fit line, which can reflect a regression trend and can be applied to predict the output. And the SVR decision interface is more robust than regular linear regression since it has a specific “thickness”—that is, if the sample is not too far from the regression line or hyperplane, no error is thought to have occurred.The polynomial kernel function, linear kernel function, sigmoid kernel function, and Gaussian radial basis kernel function are the most frequently utilized kernel functions [25]. Since the experimental data in this paper are nonlinear, the Gaussian radial basis kernel function is chosen as its kernel function, which has two main hyperparameters: the penalty parameter C and the kernel function parameter g.


## 2.4.2. Extreme Learning Machine (ELM)

The ELM is a new feedforward neural network learning algorithm that differs from the traditional gradient-based feedforward neural network learning algorithms in that the connection weights between the hidden and the input layers, as well as the thresholds of the neurons in the hidden layer [26], are generated at random. To obtain a unique optimal solution during parameter training, we set the number of buried neurons. The most important characteristic of ELM is that the input and implicit layer connection weights, as well as the implicit layer threshold, can be set arbitrarily and do not need to be modified after initialization. Compared to standard back propagation (BP) neural networks, such a rule saves time and effort because it eliminates the requirement to reverse the weights and thresholds, resulting in superior model generalization and speed [27].The key influencing parameters are chosen in this study to investigate the water loss pattern of peanut kernels during the natural drying process bulk density, dielectric constant, and porosity. The input parameters of the neural network were peanut bulk density, dielectric constant, and porosity, while the output parameter was peanut seed moisture content. The structure of the neural network is presented in Figure4. A 3-layer network topology with a single hidden layer was used, and the number of nodes in the hidden layer was calculated using the following equation:(15)L≤am+n+a,where L is the number of implied layer nodes, m is the number of output layer nodes, n is the number of input layer nodes, and a is the regulation constant (typically between 1 and 10).Figure 4
Extreme learning machine network structure.In the limit learning machine, if we suppose that there areN random samples, let them be (Xi, ti), where Xi = [xi1,xi2,…,xin]T ∈ Rn, ti = [ti1, ti2,…,tin]T ∈ Rm. Then, for a single hidden layer neural network with L hidden layer neurons, ∑i=1LβigWiXj+bi=oj,j=1,.,N where gx is the activation function. Not only can many nonlinear activation functions be used in ELM (such as S-shaped, sine, and composite functions), but nonintegrable functions and even discontinuous functions can also be used as activation functions. In the above equation, Wi=wi,1,wi,2,.,wi,n,T is the input weight, βi is the output weight, bi is the bias of the hidden unit, and WiXj denotes the inner product of the two.


## 2.4.3. ELM Neural Network Optimization Based on SSA

The SSA is a novel type of swarm intelligence optimization algorithm based on sparrow foraging and predator avoidance behavior. Its advantages include high search accuracy, fast convergence, stability, and avoidance of falling into local optimality [28].It is essential to utilize virtual sparrows to identify food in the simulation experiment. The population ofn sparrows can be described as follows:(16)X=x11x12.x1dx21x22.x2d....xn1xn2.xnd,where d is the number of sparrows and n is the dimensionality of the issue variable to be optimized. Therefore, all of the sparrow fitness values can be described in the following manner [29]:(17)Fx=fx11x12.x1dfx21x22.x2dfxn1xn2.xnd.During the search process in SSA, discoverers with higher fitness values are prioritized. Furthermore, the discoverer is in charge of obtaining food for the entire sparrow population, as well as offering foraging directions to all newcomers. As a result, the discoverer has a wider range of foraging options than joiners. According to equations (16) and (17), the update of the position of the discoverer during the course of each iteration is described as follows:(18)Xi,jt+1=Xi,j.exp−iα.itermax,ifR2<ST,Xi,j+Q.L,ifR2≥ST,where t and itermax represent the current number of iterations and the maximum number of iterations, respectively, and X (i, j) represents the position information of the ith sparrow in the jth dimension. The α ∈ (0, 1] represents a random number, and R2 ∈ (0, 1] and ST ∈ (0.5, 1] are warning and safety values, respectively. Q is a random number subject to a normal distribution, and L is a 1 × d matrix.WhenR2<ST, the finder can execute extended search activities because there are no predators in the foraging environment. When R2≥ST is present, this indicates that some sparrows in the population have discovered a predator and have informed other sparrows in the population; at this moment, all sparrows must fly to safe alternative foraging areas. The formula for updating the joint position is as follows:(19)Xi,jt+1=Q,expXworst−Xi,jti2,ifi>n2,XPt+1+Xi,j−XPt+1.A+.L,otherwise,where XP is the best position currently occupied by the discoverer, and Xworst indicates the current global worst position. A denotes a 1 × d matrix in which the elements of A are randomly assigned to 1 or −1. When i > n/2, this indicates that the ith joiner with a lower fitness value does not obtain food and must forage. The formula for updating the alert position is as follows:(20)Xi,jt+1=Xbestt+β.Xi,jt−Xbestt,iffi>fg,Xi,jt+K.Xi,jt−Xworsttfi−fw+ε,iffi=fg,where Xbest is the global best position, and β is the step size control parameter, which is a random number that obeys a normal distribution with a mean of 0 and a variance of 1. The fi, fg, and fw represent the i-th sparrow, global best, and worst adaptation, respectively. The ε is a constant that avoids a zero in the denominator. When fi>fg, the sparrow is at the edge of the population and extremely vulnerable to predator attacks. When fi=fg, the sparrow is in the middle position and is aware of the danger and must adjust its strategy in time to avoid the attack.When the classic ELM is trained, the system randomly generates the connection weights and thresholds between the input and hidden layers; therefore, the values remain the same after initializing the weights and thresholds, resulting in a poor global search or training failure. In the process of initializing the weight thresholds, SSA was first optimized as a global optimization search algorithm. The optimized values can improve the training effect and network performance to a greater extent, boost convergence speed, and minimize difficulties such as random initialization-induced local optimality. The flow chart of SSA is shown in Figure5.Figure 5
SSA flow chart.


## 3. Influence of the Main Factors on the Peanut Dielectric Constant

The peanut pod dielectric constant was affected by the moisture content of the peanut seeds, porosity, and bulk density, and relative dielectric constants of the peanuts at different moisture contents, porosities, and bulk densities were obtained through experimental tests.


### 3.1. Effect of Porosity on the Dielectric Properties of Peanuts

The relative permittivity of peanuts with shells produced under natural air-drying conditions decreased as the porosity increased (Figure6). Ren Guangyue et al. studied the effect of porosity on the dry basis moisture content of peanut kernels and shells during hot air drying [24]. The porosity of peanut kernels and shells increased as the dry basis moisture content decreased, and this exhibited a nearly linear correlation. Therefore, one can deduce that the greater the porosity of either the peanut shells or peanut kernels, the less water is contained in the peanuts, resulting in a smaller dielectric constant.Figure 6
Effect of porosity on the dielectric properties of peanuts at different moisture contents.The change in peanut kernel porosity is relatively slow at the early stage of drying because the drying object at this stage is the peanut shell; therefore, the change in the peanut kernel dielectric constant is not obvious. As the moisture content of the peanut kernel decreased during the drying process, the dielectric constant began to change, and the curve became steeper, indicating that the peanut shell had reached the final stage of drying, the peanut kernel began to lose water, and the rate of dielectric constant change began to accelerate. The amount of change in the dielectric constant decreased as peanut kernel moisture disappeared and drying progressed to the later phases, which exhibited porosities of 75.89%, 85.23%, and 93.65%. The change in the dielectric constant was more noticeable in peanut shells during the early stages of drying, and the dielectric constant of peanut shells was almost linearly related to porosity, indicating that the shells were in the normal shrinkage stage, with the volume of water loss equal to the shrinkage volume. The internal pore mesh structure of peanut shells became denser with the dissipation of water, and the rate of water loss in peanut shells decreased, resulting in the change in dielectric constant being slow and unnoticeable. By the late drying period, the porosity of peanut shells continued to change, the peanut shell tended to shrink, but the dielectric constant stopped changing.


### 3.2. Effect of Bulk Density on the Dielectric Properties of Peanuts

The bulk density of the examined sample is also an essential element in the dielectric properties of the material [30]. Relative permittivity is positively correlated with bulk density for peanut samples with the same moisture content (Figure 7). The relative permittivity of peanuts follows a monotonic increasing trend as bulk density increases, and higher moisture contents resulted in higher relative permittivity. This is because, as the bulk density increases, the density of peanuts increases after being compressed, the number of peanuts per unit volume increases, and greater electric field energy can be stored. The dielectric constant is an important factor in determining the magnitude of a sample’s energy storage capacity; therefore, its relative dielectric constant is high.Figure 7
Effect of bulk density on the dielectric properties of peanut shells and kernels of different moisture contents. (a) Peanut shells. (b) Peanut kernels.
(a)(b)


### 3.3. Effect of Moisture Content on the Dielectric Properties of Peanuts

The relative dielectric constant of peanut shells and kernels varies with moisture content at different bulk densities at 5.8 GHz (Figure8). The water content of peanuts is the key factor for determining the relative dielectric constant of peanuts as the dielectric constant of water is greater at room temperature and water molecules are polar molecules with a large electric dipole moment at a frequency of 5.8 GHz [31]. The relative dielectric constant of peanuts increased with increasing water content (Figure 8). The electric dipole moment of the water molecules in the peanut turns and aligns along the external electric field at a frequency of 5.8 GHz, under the operation of the external electric field. As a result, polarization is created in the medium, and the electric dipole moment changes its direction as the external electric field changes. The term for this type of polarization is orientation polarization [32]. The intermolecular forces are smaller, and the relative permittivity is smaller for peanut samples with lower moisture content. The fraction of free water in the cells increases with the increase in water content, and because water molecules are more active, the force at which molecules interact also increases, as does the relative permittivity of the peanuts [33]. The peanut kernel contains more water than the shell at the same moisture level; therefore, its relative dielectric constant is generally higher.Figure 8
The effect of moisture content on the relative dielectric constants of peanut shells and kernels at different bulk densities.


## 3.1. Effect of Porosity on the Dielectric Properties of Peanuts

The relative permittivity of peanuts with shells produced under natural air-drying conditions decreased as the porosity increased (Figure6). Ren Guangyue et al. studied the effect of porosity on the dry basis moisture content of peanut kernels and shells during hot air drying [24]. The porosity of peanut kernels and shells increased as the dry basis moisture content decreased, and this exhibited a nearly linear correlation. Therefore, one can deduce that the greater the porosity of either the peanut shells or peanut kernels, the less water is contained in the peanuts, resulting in a smaller dielectric constant.Figure 6
Effect of porosity on the dielectric properties of peanuts at different moisture contents.The change in peanut kernel porosity is relatively slow at the early stage of drying because the drying object at this stage is the peanut shell; therefore, the change in the peanut kernel dielectric constant is not obvious. As the moisture content of the peanut kernel decreased during the drying process, the dielectric constant began to change, and the curve became steeper, indicating that the peanut shell had reached the final stage of drying, the peanut kernel began to lose water, and the rate of dielectric constant change began to accelerate. The amount of change in the dielectric constant decreased as peanut kernel moisture disappeared and drying progressed to the later phases, which exhibited porosities of 75.89%, 85.23%, and 93.65%. The change in the dielectric constant was more noticeable in peanut shells during the early stages of drying, and the dielectric constant of peanut shells was almost linearly related to porosity, indicating that the shells were in the normal shrinkage stage, with the volume of water loss equal to the shrinkage volume. The internal pore mesh structure of peanut shells became denser with the dissipation of water, and the rate of water loss in peanut shells decreased, resulting in the change in dielectric constant being slow and unnoticeable. By the late drying period, the porosity of peanut shells continued to change, the peanut shell tended to shrink, but the dielectric constant stopped changing.


## 3.2. Effect of Bulk Density on the Dielectric Properties of Peanuts

The bulk density of the examined sample is also an essential element in the dielectric properties of the material [30]. Relative permittivity is positively correlated with bulk density for peanut samples with the same moisture content (Figure 7). The relative permittivity of peanuts follows a monotonic increasing trend as bulk density increases, and higher moisture contents resulted in higher relative permittivity. This is because, as the bulk density increases, the density of peanuts increases after being compressed, the number of peanuts per unit volume increases, and greater electric field energy can be stored. The dielectric constant is an important factor in determining the magnitude of a sample’s energy storage capacity; therefore, its relative dielectric constant is high.Figure 7
Effect of bulk density on the dielectric properties of peanut shells and kernels of different moisture contents. (a) Peanut shells. (b) Peanut kernels.
(a)(b)


## 3.3. Effect of Moisture Content on the Dielectric Properties of Peanuts

The relative dielectric constant of peanut shells and kernels varies with moisture content at different bulk densities at 5.8 GHz (Figure8). The water content of peanuts is the key factor for determining the relative dielectric constant of peanuts as the dielectric constant of water is greater at room temperature and water molecules are polar molecules with a large electric dipole moment at a frequency of 5.8 GHz [31]. The relative dielectric constant of peanuts increased with increasing water content (Figure 8). The electric dipole moment of the water molecules in the peanut turns and aligns along the external electric field at a frequency of 5.8 GHz, under the operation of the external electric field. As a result, polarization is created in the medium, and the electric dipole moment changes its direction as the external electric field changes. The term for this type of polarization is orientation polarization [32]. The intermolecular forces are smaller, and the relative permittivity is smaller for peanut samples with lower moisture content. The fraction of free water in the cells increases with the increase in water content, and because water molecules are more active, the force at which molecules interact also increases, as does the relative permittivity of the peanuts [33]. The peanut kernel contains more water than the shell at the same moisture level; therefore, its relative dielectric constant is generally higher.Figure 8
The effect of moisture content on the relative dielectric constants of peanut shells and kernels at different bulk densities.


## 4. Development of a Peanut Moisture-Content Prediction Model

### 4.1. Predictive Modeling

From the preceding chapter, it is clear that the water content, bulk density, and porosity are the key variables influencing the relative dielectric constant of peanut pods. A prediction model using the water content of the peanut kernel as the dependent variable and the dielectric constant of the peanut pod, porosity, and bulk density as independent variables was used for modeling analysis. There is a certain correlation between the inputs of the prediction model. The dielectric constant of peanut pods increased with the increase in bulk density and decreased with the increase in porosity at the same frequency and temperature.Three measurements of the dielectric constant were obtained for each group of porosity, bulk density, and moisture content and averaged to obtain 200 sets of test data. This process was performed to select the best model for predicting the moisture content of peanut kernels and to minimize experimental errors. For the comparison analysis, the SVR, ELM, SSA-SVR, and SSA-ELM models were chosen. TheR2 and RMSE are the two metrics used to identify the best predictive model [34, 35].


### 4.2. Comparative Assessment of Predictive Models

The neurons in the hidden layer were taken to be 1–13 equation (15), and the neural network architecture of each model was established through trials to create the SVR, ELM, SSA-SVR, and SSA-ELM models for predicting the water content of peanut seed. In this study, the initial population size in the SSA algorithm was set to 50 iterations, the maximum number of iterations was set to 70, and the proportion of different types of sparrows in the population and the safety value was set. The training and test sets of the data structure were split 8 : 2 (160 sets for the water-content model training set, which consisted of 40 sets), and the R2 and RMSE values were employed as metrics for evaluating the model. The relative error between the predicted and actual values of the sample moisture content in the training and test sets is presented in Figure 9. The prediction results show that the SSA-ELM model’s relative error range, whether in the training or the test sets, is between −1% and 1%, and its predictive effect is superior to that of ELM and SVR. Additionally, in the test set, the error fluctuation of the SSA-relative ELM was lower, and its predictive performance was more consistent.Figure 9
Relative prediction error comparison chart. (a) Train sets. (b) Test sets.
(a)(b)The MSE of the SSA-ELM model in the training set is optimized by an average of 0.0065, 0.0047, and 0.0049 compared to the SVR, ELM, and SSA-SVR models, and the fitting degree is improved by 0.101,0.082, and 0.013, respectively (Figure10 and Table 1). The MSE was reduced by 0.0080, 0.0060, and 0.0012, and the fitting degree was increased by 0.058, 0.045, and 0.01, respectively, in the test set, where its predictive effect was more pronounced. The model’s prediction impacts range from high to low and are represented by SSA-ELM, SSA-SVR, ELM, and SVR. This shows that the SSA-ELM model produces the best prediction of peanut kernel moisture content, with a higher degree of correlation between the predicted and actual peanut moisture content values. This shows that the ELM model optimized by the SSA has high prediction applicability and accuracy.Figure 10
Comparison of predictive model and test set validation results.Table 1
Comparative analysis of the water-content prediction models.
Predictive modelTraining setTest setMSE (%)R2MSE (%)R2SVR0.7320.8940.8330.936ELM0.5540.9130.6320.949SSA-SVR0.1320.9820.1560.984SSA-ELM0.0830.9950.0320.994


## 4.1. Predictive Modeling

From the preceding chapter, it is clear that the water content, bulk density, and porosity are the key variables influencing the relative dielectric constant of peanut pods. A prediction model using the water content of the peanut kernel as the dependent variable and the dielectric constant of the peanut pod, porosity, and bulk density as independent variables was used for modeling analysis. There is a certain correlation between the inputs of the prediction model. The dielectric constant of peanut pods increased with the increase in bulk density and decreased with the increase in porosity at the same frequency and temperature.Three measurements of the dielectric constant were obtained for each group of porosity, bulk density, and moisture content and averaged to obtain 200 sets of test data. This process was performed to select the best model for predicting the moisture content of peanut kernels and to minimize experimental errors. For the comparison analysis, the SVR, ELM, SSA-SVR, and SSA-ELM models were chosen. TheR2 and RMSE are the two metrics used to identify the best predictive model [34, 35].


## 4.2. Comparative Assessment of Predictive Models

The neurons in the hidden layer were taken to be 1–13 equation (15), and the neural network architecture of each model was established through trials to create the SVR, ELM, SSA-SVR, and SSA-ELM models for predicting the water content of peanut seed. In this study, the initial population size in the SSA algorithm was set to 50 iterations, the maximum number of iterations was set to 70, and the proportion of different types of sparrows in the population and the safety value was set. The training and test sets of the data structure were split 8 : 2 (160 sets for the water-content model training set, which consisted of 40 sets), and the R2 and RMSE values were employed as metrics for evaluating the model. The relative error between the predicted and actual values of the sample moisture content in the training and test sets is presented in Figure 9. The prediction results show that the SSA-ELM model’s relative error range, whether in the training or the test sets, is between −1% and 1%, and its predictive effect is superior to that of ELM and SVR. Additionally, in the test set, the error fluctuation of the SSA-relative ELM was lower, and its predictive performance was more consistent.Figure 9
Relative prediction error comparison chart. (a) Train sets. (b) Test sets.
(a)(b)The MSE of the SSA-ELM model in the training set is optimized by an average of 0.0065, 0.0047, and 0.0049 compared to the SVR, ELM, and SSA-SVR models, and the fitting degree is improved by 0.101,0.082, and 0.013, respectively (Figure10 and Table 1). The MSE was reduced by 0.0080, 0.0060, and 0.0012, and the fitting degree was increased by 0.058, 0.045, and 0.01, respectively, in the test set, where its predictive effect was more pronounced. The model’s prediction impacts range from high to low and are represented by SSA-ELM, SSA-SVR, ELM, and SVR. This shows that the SSA-ELM model produces the best prediction of peanut kernel moisture content, with a higher degree of correlation between the predicted and actual peanut moisture content values. This shows that the ELM model optimized by the SSA has high prediction applicability and accuracy.Figure 10
Comparison of predictive model and test set validation results.Table 1
Comparative analysis of the water-content prediction models.
Predictive modelTraining setTest setMSE (%)R2MSE (%)R2SVR0.7320.8940.8330.936ELM0.5540.9130.6320.949SSA-SVR0.1320.9820.1560.984SSA-ELM0.0830.9950.0320.994


## 5. Conclusions

The change in the dielectric constant of peanut pods collected in Shandong was examined under natural drying conditions. The microwave free-space method was used to measure the dielectric constant of peanut pods, and the effects of peanut moisture content, porosity, and bulk density on the dielectric constant of peanut pods were analyzed. A prediction model of peanut pod moisture content was developed which resulted in the following conclusions:(1)
Changes in the dielectric constants of peanut pods were investigated at different moisture contents, bulk densities, and porosities after harvesting, after natural drying, and at a frequency of 5.8 GHz. The relative permittivity of peanut pods increased during the drying process, along with the increase in water content and bulk density, and it decreased with the increase in porosity of the peanut shells and kernels. This demonstrates that the dielectric constant of peanut pods is significantly influenced by moisture content, bulk density, and porosity.(2)
SVR, ELM, SSA-SVR, and SSA-ELM models were employed to accurately evaluate changes in the moisture content of peanut pods during natural drying. By comparing the four models, the input parameters employed were the peanut bulk density, dielectric constant, and porosity, and the output parameter was the water content of the peanut seed kernel. The SSA-ELM was selected as the prediction model for peanut moisture content because it had the best prediction performance, with a modelR2 of 0.994.



---

*Source: 9620349-2022-11-11.xml*