Next Article in Journal
A New Target Detection Method of Ferrography Wear Particle Images Based on ECAM-YOLOv5-BiFPN Network
Next Article in Special Issue
Swin Transformer-Based Edge Guidance Network for RGB-D Salient Object Detection
Previous Article in Journal
Affine Iterative Closest Point Algorithm Based on Color Information and Correntropy for Precise Point Set Registration
Previous Article in Special Issue
CoSOV1Net: A Cone- and Spatial-Opponent Primary Visual Cortex-Inspired Neural Network for Lightweight Salient Object Detection
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Approach for Apple Freshness Prediction Based on Gas Sensor Array and Optimized Neural Network

1
School of Information and Communication Engineering, North University of China, Taiyuan 030051, China
2
Department of Electronic and Electrical Engineering, Brunel University London, Uxbridge UB8 3PH, UK
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(14), 6476; https://doi.org/10.3390/s23146476
Submission received: 16 June 2023 / Revised: 13 July 2023 / Accepted: 15 July 2023 / Published: 17 July 2023
(This article belongs to the Special Issue Object Detection Based on Vision Sensors and Neural Network)

Abstract

:
Apple is an important cash crop in China, and the prediction of its freshness can effectively reduce its storage risk and avoid economic loss. The change in the concentration of odor information such as ethylene, carbon dioxide, and ethanol emitted during apple storage is an important feature to characterize the freshness of apples. In order to accurately predict the freshness level of apples, an electronic nose system based on a gas sensor array and wireless transmission module is designed, and a neural network prediction model using an improved Sparrow Search Algorithm (SSA) based on chaotic sequence (Tent) to optimize Back Propagation (BP) is proposed. The odor information emitted by apples is studied to complete an apple freshness prediction. Furthermore, by fitting the relationship between the prediction coefficient and the input vector, the accuracy benchmark of the prediction model is set, which further improves the prediction accuracy of apple odor information. Compared with the traditional prediction method, the system has the characteristics of simple operation, low cost, reliable results, mobile portability, and it avoids the damage to apples in the process of freshness prediction to realize non-destructive testing.

1. Introduction

1.1. Background

Apples are one of the most commonly consumed fruits by people. China’s apple production accounts for one-seventh of the world’s output, and it is an important cash crop in China. The freshness of apples is the most important indicator to evaluate the quality of apples, which directly affects the sales of apples. If the shelf life of apples can be accurately predicted, it will provide an effective guarantee for quality and output value.
Fruit and vegetable freshness prediction technology has a long history, and its freshness prediction methods [1] mainly include fuzzy sense, dielectric property, mechanical property, acoustic property, near-infrared spectroscopy, and electronic nose detection technology. Fuzzy sense mainly relies on individuals to judge the feel, smell, and experience of objects, which are highly subjective. The dielectric property is detected by using the dielectric constant of the fruit, which can be used for the detection of fruit sugar content and moisture content. Acoustic characteristics are detected using acoustic properties such as fruit reflection, scattering, transmission, and attenuation. Kinetic modeling is a technique that uses the relevant mechanical properties of fruits for testing. Near-infrared spectroscopy is the use of fruit to detect the absorption, reflection, scattering, transmission, and other characteristics of light. The above four detection methods are generally for a single detection object, which needs to be judged one by one; the detection efficiency is relatively low; and the requirements for equipment are high.
The smell of the same fruit at different growth stages is different. The odor between different varieties is also different, and the electronic nose is used to simulate the biological olfactory function to analyze and identify the odor for detection. In order to meet the requirements of rapid and non-destructive real-time monitoring of food freshness, electronic nose technology based on gas sensors has developed rapidly, and in recent years, more and more research on the freshness prediction of food has been applied by electronic nose technology.
In 2008, Antihus [2] used the PEN2 electronic nose, principal component analysis method, and LDA (Linear Discriminant Analysis) algorithm to monitor the shelf life of tomato storage, which realized the monitoring and differentiation of tomatoes with different storage times but did not realize the freshness prediction of tomatoes.
In 2013, Hui Guohua [3] proposed a storage time prediction method for Fuji apples based on electronic nose, which used the random resonance method to calculate the gas concentration data collected by electronic nose and established a prediction relationship with the storage time of apples, which detected a single apple sampling time of 3 h and a long detection time.
In 2016, Alireza Sanaeifar [4] used a low cost electronic nose to detect bananas with different shelf lives and used SVM (support vector machine) technology to predict various quality indicators of bananas, which had a good prediction effect on soluble solids and hardness but a poor prediction effect on PH and titratable acid, so that the overall freshness prediction effect of bananas did not reach the expected level.
In 2019, Wojciech Wojnowski [5] et al. proposed a prediction method for the bioamine index of refrigerated chicken based on an electronic nose. Using a modular electronic nose and a special sample chamber to analyze the volatile components of chicken and a BP neural network for data modeling, the results show that it can accurately predict the biogenic amine index of chicken. In this experiment, the biogenic amine index of chicken was predicted, but the quality of the chicken was not evaluated.
In 2020, Parthasarathy Srinivasan [6] used a self-designed electronic nose to predict the quality changes of Pacific white shrimp during storage and determined its quality by measuring PH value, determining microbial content, texture analysis, and sensory evaluation, and the identification rate of white shrimp stored at low temperatures was as high as 96.29% through the Soft-max algorithm.
In 2019, Feng Lei [7] from Jiangnan University applied electronic nose and low-field nuclear magnetic resonance technology to study the freshness of cucumbers, cherries, and tomatoes, and by monitoring their flavor characteristics and the change of moisture status, the PLS (Partial Least-Squares) algorithm model was used to predict the hardness, soluble solids, and color difference of cucumbers and tomatoes and the quality changes of cucumbers during storage. In the model, the detection cost of low-field NMR (Nuclear Magnetic Resonance) technology is high, and it is difficult to popularize and practice.
In 2020, Chen Shaoxia [8] from Nanjing Agricultural University used an electronic nose and near-infrared spectroscopy to predict the quality loss rate, VC (vitamin C) content, hardness, and other quality indicators of baby vegetables during storage. The results show that the combination of the two technologies has a good predictive effect on quality indicators. However, the combination of the two technologies increases the detection cost and makes the experimental process too complex and cumbersome. The infrared spectroscopy technology has high requirements for light source selection, which is not suitable for large-scale promotion.
In 2022, Zhang Man [9] proposed a method for predicting the freshness of cold fresh mutton based on a BP neural network using gas information and established a prediction model for the physical and chemical indicators (hardness, pH value, color, TVB-N (total volatile basic nitrogen) content) that characterize the freshness of mutton by detecting the environmental gas content. The results showed that the coefficient of prediction of physicochemical properties was above 0.9, indicating that the BP neural network has a good prediction effect. In the implementation method, the amount of data is large, and the training time is long.
In summary, through the analysis of the research status at home and abroad, the use of an electronic nose to predict the freshness of vegetables and fruits is achievable, and the detection process has the advantages of non-contact and batch detection. At present, among the relevant detection methods, there are problems such as a complex detection process, a high detection cost, an excessive amount of collected data, and a long detection time.

1.2. Related Work

In recent years, our research group has completed a number of studies on electronic nose freshness detection technology for apples. Guo et al. [10] built an apple freshness test platform using odor recognition technology combined with fuzzy sensory algorithms and dielectric properties to measure apple quality, and the accuracy of apple freshness determination was 93.75%. Liu et al. [11] used a self-made odor recognition system to complete a rapid evaluation of the classification of the freshness of Fuji apples. The principal component analysis algorithm was used to detect the freshness features of apples within 1 min, with an accuracy of 95.33%. Yan et al. [12] connected the smell of apples with their sweetness through the gas sensor array and realized the classification of the sweetness of apples. The CPSO-BP (BP optimization by Chaotic Particle Swarm Optimization) neural network algorithm was adopted with an accuracy of 83.33%, which was comparable to the detection accuracy of commercial near-infrared spectroscopy analyzers and realized the non-destructive testing of the sweetness of apples.
Among the existing research results [13], an odor recognition system for evaluating the freshness of Fuji apples was designed. By collecting and detecting the aroma emitted by apples, cluster analysis and a classification model are established using stable system response values. The continuous projection algorithm is used to optimize the sensor array, solve the collinearity and overlap problems, and eliminate abnormal and redundant sensors. It uses a ZigBee wireless sensor network to send data to the upward computer and uses a BP neural network algorithm optimized by the hybrid leapfrog algorithm to recognize the gas data, which improves the training speed and accuracy of the neural network. The experimental results showed that the accuracy of the method was 98.67%, and it could identify the freshness of Fuji apples quickly and comprehensively.
Apple odor information is feasible and reliable for apple quality detection, and on this basis, apple freshness prediction is further realized. Combined with the existing research results, The main work of this study is as follows: (1) This study detects the gas concentration released by apples during storage by the self-designed electronic nose system, accurately characterizes the freshness of apples by using a sensor array composed of ethylene, ethanol, oxygen, and carbon dioxide, and uses a WSN (wireless sensor network) as a means of information transmission. (2) Taking the prediction of the future freshness of apples as the starting point, the SSA optimization BP neural network added to Tent is used to further optimize the network to complete the prediction of apple odor characteristics. The Tent-SSA-BP model for apple freshness prediction is established, and finally, low cost, lossless, and efficient apple freshness prediction is realized.

2. Technical Principles

2.1. Freshness Prediction System

Using a self-made dual-chip wireless acquisition and processing system, the overall function is completed by two main chips with each other, with gas concentration collection, data information processing, wireless transmission, processing result display, and the ability to work with other nodes. The block diagram of the system structure is shown in Figure 1. WSN nodes are used to realize wireless transmission during acquisition. One of the sensor arrays is connected and placed in the container where the apple is stored, and the other node is connected to the host computer to transmit data back and be processed by the host computer. Then multiple nodes can be added to form a wireless acquisition and prediction network. The actual self-made hardware is shown in Figure 2.
The sensor array is connected to the WSN transmitter module and placed in a gas environment containing the sample to be measured, which converts the gas concentration into an electrical signal packaged by the transmitter module. The receiving module is connected to the host computer, receives the data packets from the transmitting module, and uploads the data to the host computer through the serial port output for storage. The control chip of the whole acquisition system is Msp430F449, which has complete functions and can complete the preliminary data processing task. The ZigBee wireless transmission module adopts the CC2530 RF module circuit and supports the ZigBee2007Ztack protocol stack. The wireless transmission of data has the advantages of saving costs and making the system more convenient.

2.2. Choice of Sensor

According to the types of gases involved in the physiological action of apples after picking, the optimal sensor combination in the actual environment is selected to ensure the accuracy of gas concentration collection. According to the previous research and research results [14,15], the main response gases are selected as ethylene, ethanol, oxygen, and carbon dioxide gas sensors to form a sensor array, and the type of selection and performance indicators of the sensors are shown in Table 1. The sensor array composed of four types of sensors selected has a good response characteristic curve to the volatile gas of apples, and effectively improves the cross-sensitivity characteristics between the sensors during the detection process and the identification accuracy of apple odor in the experiment.
The advantage of using the sensor module is that after the power sensor module is turned on and the sensor module starts to work, the communication and data transmission between the main control chip can be realized through the general IO port, In terms of the collected data, the concentration value, voltage, and current value can be collected through the program according to its own needs. In addition, the use of ready-made sensor modules can also reduce the volume of the main circuit board, and you only need to reserve different voltage power supply interfaces and IO ports required for communication according to different sensor power supply needs in the design work. It also provides convenience for replacing the sensor, as the operation of the sensor ages and different environmental needs change, so it is necessary to detect and replace the sensor in time to ensure the stability and correctness of the collected data.

3. Algorithm Framework and Principle

The collected apple odor data is divided into a training set and a test set and imported into the optimized neural network for modeling and training, and the subsequent concentration change is predicted according to the current gas concentration of apple samples. The apple freshness is identified and classified by the predicted concentration, so as to realize the prediction of apple freshness.

3.1. Sparrow Search Algorithm

The Sparrow Search Algorithm (SSA) [16] is a new type of meta-heuristic algorithm. In the algorithm, individuals are divided into discoverers, watchers, and followers, with each individual corresponding to a solution. In the process of algorithmic foraging, the positions of the three are continuously updated to complete the resource acquisition. Compared with other optimization algorithms, this one is easy to implement and has relatively few control parameters and strong local search ability. In order to avoid falling into the local optimum, the tent chaotic sequence is introduced for optimization, which increases the population diversity, thereby improving the search and exploitation performance of the algorithm and increasing its stability [17].
The specific implementation steps are shown in Table 2:

3.2. Optimized BP Neural Network

According to the prediction of concentration change, the shelf life of apples is predicted, and the sparrow search algorithm is improved by the Tent chaotic sequence. SSA is used to optimize the BP neural network in order to complete the prediction of apple odor characteristics. Tent-SSA optimizes BP in two aspects: one is to optimize the weight threshold of BP by using the optimization function of the optimization algorithm; Second, the input layer is optimized, and the structure of the input matrix is changed by setting the expected value and the number of cycles to find the best input matrix suitable for prediction and the number of input nodes of BP, where the setting of the expected threshold is further calculated by the fitting function of the relationship between the coefficient of determination and the input vector. The optimized flowchart is shown in Figure 3.
The specific implementation steps are shown in Table 3.
The pros and cons of the prediction model have a great relationship with the coefficient of determination ε0, and according to multiple experiments and statistical analysis of data, there is a correlation between the prediction results of the model and the arrangement of the input matrix. After a fixed number of iterations, the fitting curve between ε0 and the input vector obtained by multiple fitting using MATLAB is shown in Figure 4.
It can be seen from the figure that ε0 shows a wave upward trend with the increase in the number of input vectors. Freshness prediction is the analysis of concentration change in days, and the number of input vectors should not be too large. The relationship between derived ε0 and input vectors is shown in the following Equation (1), where x represents the number of input vectors.
ε 0 = 1.396 × 10 6 x 8 2.548 × 10 5 x 7 0.0003126 x 6 + 0.01221 x 5 0.1327 x 4 + 0.701 x 3 1.905 x 2 + 2.461 x 0.2368
The goodness-of-fit degree verified by the results is above 0.96, and ε0 is used as the key parameter for model prediction. Through experimental testing, under indoor conditions of room temperature of 20 degrees Celsius and humidity of 50% RH, apples go from fresh to rotten in about 40 days. Each apple sample in the 800 mL container has a gas emission stability value as the characteristic value of the sample. By detecting the change in the characteristic value of apples within 40 days, a prediction model is established.

4. Freshness Classification Basis

In the process of storage, the physical and chemical changes of apples will lead to changes in the water content, freshness, and content and arrangement of some organic substances. The physiological tissue components inside apples can be regarded as an unconventional dielectric, and these physical and chemical changes will be further manifested in the internal biomolecules of apples in the change of charge arrangement response characteristics. Their macroscopic manifestation is the change of dielectric characteristics and its parameters, so the dielectric constant can be used to express the state of apple freshness.
Apple freshness feature detection technology based on dielectric properties has been relatively mature. In this experiment, a TH2822A handheld LCR instrument combined with a computer and a shielded box with plates was used to complete the detection of the dielectric constant of Fuji apples and classify the freshness of apples, and the relationship between the dielectric characteristics of Fuji apples and freshness is shown in the following table [10,11]. Among them, apples are divided into three categories: Fresh (apples without any wrinkles or shrinkage phenomena, not rotten); Not freshness (apples shrink after a period of time and do not decay); Decay (apples appear rotten).

5. Results and Analysis

5.1. Materials and Methods

Since the apples are picked, the cells in the fruit continue to respire, consuming oxygen while producing ethanol and carbon dioxide. In addition, ethylene is closely related to the ripeness of apples. Four gases: ethanol, ethylene, oxygen, and carbon dioxide, are selected to establish the apple freshness model. A number of Fuji apples picked from the same batch and purchased at the same time in the same market are selected and stored at 20 degrees Celsius indoors, and the volatile gas of each sample is sampled every 24 h to record the gas concentration change in the process from freshness to rot.
Based on the odor characteristics of apples, a BP neural network classification model was established. The eigenvalues of each apple sample were taken from the stable response values of the four sensors; the eigen input signal of the apple was four dimensions, and the result to be classified was three types, according to the Kolmogorov theorem combined with multiple experiments to verify that the number of optimal hidden layer nodes was 9, so the structure of the neural network was 4-9-3.
A total of 180 groups of pre-processed sample feature signals were selected, and 144 groups were randomly selected for network training. And it defined the expected output of each type of apple. For example, the expected output of a fresh apple sample is [1, 0, 0]; Not fresh is [0, 1, 0]; Decay is [0, 0, 1].

5.2. The Data Collection

Apples of varying degrees of freshness, from fresh to rotten, are tested separately. During the detection process, apple samples and fully preheated gas sensor arrays are put into the container, one sample at a time. The odor information concentration change of each sample in the container for 15 min is collected, and the relevant gas concentration change curve detected is shown in Figure 5.

5.3. Data Pre-Processing

As can be seen from the data in the above figure, the concentration packets of ethylene and oxygen in the collected data contain a lot of noise and need to be filtered. Linear least squares filtering is selected, and the filtering effect is shown in Figure 6.
The characteristic values of the filtered noise data are extracted, and when the gas emitted by the apple tends to be stable, the stable, average, and maximum values are taken as the characteristic signal values for statistical analysis.

5.4. Predicted Results

Figure 7 and Figure 8 show the comparison of training errors before and after BP neural network optimization.
As shown in Figure 7, the optimized neural network has a smaller prediction error. The 40-day concentration change curve of an apple sample during the detection process and the stable value concentration prediction curve of the apple sample before and after the optimization of the BP neural network are shown in Figure 8.
Based on the comparison of the above figures, it can be seen that the prediction errors of the prediction model before and after optimization are 0.002 and 0.0002, respectively, and the error after optimization is significantly reduced. The coefficient of determination is a key parameter used to reflect the reliability of model variables, and in order to evaluate the stability and reliability of the model more intuitively, the coefficient of determination is used as the evaluation index of the predictive model. Firstly, the sum of squares and total squares of the residuals are calculated according to Formulas (2) and (3), SS res is the sum of residual squares, S S t o t is the total sum of squares, y i represents the real data, y ¯ represents the average, and f i is the predicted data. Then the determination coefficient is calculated according to Formula (4).
S S r e s = Σ ( y i f i ) 2
S S t o t = Σ ( y i y ¯ ) 2
R 2 = 1 S S r e s / S S t o t
Finally, the coefficient of determination before optimization is 0.80057 and the coefficient of determination R2 after optimization is 0.95851, which shows that the prediction stability of the optimized model is better than that before optimization, the prediction error is smaller, and the performance is stable.

5.5. The Classification Results

Through the pre-processed 180 sets of data, the ratio of training set to test set is 8:2 to divide, of which 144 groups are used to train the classification model and the other 36 groups are shuffled and sorted for recognition verification. We obtained some specific detection results as shown in both Table 4 and Table 5, and the result change of the neural network for the freshness classification output of an apple sample within 30 days is shown in Figure 9, where the maximum value of the three types of output values on the same day is the predicted freshness result of the apple.
According to the predicted concentration, the freshness of the apples was classified and identified. By comparing the recognition results, it was found that the accuracy rate of the sixth day was the highest, and the accuracy rate was 100%. The lowest accuracy rate was 80 percent on day 30. In practical application, the prediction days can be determined according to the accuracy requirements of the freshness prediction, and the accuracy of the freshness prediction will decrease with the increase in the number of days.
According to the predicted concentration, the freshness of apples was classified and identified. Then the identification results are compared, and the accuracy rate is the highest on the sixth day, which was 100%, and the lowest on the 30th day, which was 80%. In practical applications, the number of predicted days can be determined according to the requirements for freshness prediction accuracy, and the freshness prediction accuracy will decrease as the time goes on.

6. Conclusions

In this paper, a gas sensor array based on a wireless transmission module is used to collect the odor information of apples with different degrees of freshness, and a system model for apple odor information prediction is established by combining deep learning algorithms and intelligent senses by using the Tent-SSA-BP neural network prediction model. Compared with existing prediction models, the experimental results show that the model has strong optimization ability, high prediction accuracy, good stability, and a coefficient of determination of more than 0.95. Combined with the apple freshness classification system based on the gas sensor array, a complete apple freshness prediction system is formed that can accurately predict the freshness of apples in the next 30 days or so with the advantages of high accuracy, low cost, a small amount of data, convenient detection, and non-destructive testing. In the next phase of research, further research will be carried out on apples under practical application conditions, such as the shelf life of apples under refrigerated conditions and the change in shelf life of apples during transportation.

Author Contributions

Conceptualization, W.W. and W.Y.; methodology, W.Y.; software, W.Y.; validation, W.W., W.Y. and M.L.; formal analysis, W.Y.; investigation, W.D. and Z.Z.; resources, W.W. and W.Y.; data curation, W.W. and W.Y.; writing—original draft preparation, W.Y.; writing—review and editing, M.L.; visualization, W.Y.; supervision, W.W.; project administration, W.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Shanxi Provincial Natural Science Foundation General Project, China, Project, grant number 202203021221117. Grantee: Wei Wang.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Publicly available datasets were analyzed in this study. This data can be found here: [email protected] (W.Y.).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Guo, Z.; Wang, J.; Song, Y.; Zou, X.; Cai, J. Research progress on sensing detection and monitoring technology of quality deterioration of fruits and vegetables. Smart Agric. 2021, 3, 14–28. [Google Scholar]
  2. Gómez, A.H.; Wang, J.; Hu, G.; Pereira, A.G. Monitoring storage shelf life of tomato using electronic nose technique. J. Food Eng. 2008, 85, 625–631. [Google Scholar] [CrossRef]
  3. Guohua, H.; Yuling, W.; Dandan, Y.; Wenwen, D. Fuji Apple Storage Time Predictive Method Using Electronic nose. Food Anal. Methods 2013, 6, 82–88. [Google Scholar] [CrossRef]
  4. Sanaeifar, A.; Mohtasebi, S.S.; Ghasemi-Varnamkhasti, M.; Ahmadi, H. Application of MOS based electronic nose for the prediction of banana quality properties. Measurement 2016, 82, 105–114. [Google Scholar] [CrossRef]
  5. Wojnowski, W.; Kalinowska, K.; Majchrzak, T.; Płotka-Wasylka, J.; Namieśnik, J. Prediction of the Biogenic Amines Index of Poultry Meat Using an Electronic Nose. Sensors 2019, 19, 1580. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  6. Srinivasan, P.; Robinson, J.; Geevaretnam, J.; Rayappan, J.B.B. Development of electronic nose (Shrimp-Nose) for the determination of perishable quality and shelf-life of cultured Pacific white shrimp (Litopenaeus Vannamei). Sens. Actuators B Chem. 2020, 317, 128192. [Google Scholar] [CrossRef]
  7. Lei, F. Intelligent Detection of Cucumber and Cherry Tomato Freshness Based on Electronic Nose and Low-Field NMR. Ph.D. Thesis, Jiangnan University, Wuxi, China, 2019. [Google Scholar]
  8. Saoxia, C. Nondestructive Testing of Freshness of Baby Vegetable Based on Electronic Nose and Near-Infrared Spectroscopy. Master’s Thesis, Nanjing Agricultural University, Nanjing, China, 2020. [Google Scholar]
  9. Man, Z.; Zhigang, L.; Xinwu, L.; Xiaoshuan, Z. Prediction method of freshness of Chilled Mutton based on gas sensing information. J. Shihezi Univ. (Nat. Sci. Ed.) 2022, 7, 1–7. [Google Scholar]
  10. Zhihui, G. Research on Apple Freshness Detection Based on Odor Recognition; North University of China: Taiyuan, China, 2019; (In Chinese with English abstract). [Google Scholar]
  11. Yungang, L.; Wei, W. Apple freshness odor recognition system based on BP neural network optimized by SLA. Sens. Microsyst. 2020, 39, 96–99. [Google Scholar]
  12. Zhuanhong, Y.; Wei, W. Research on apple sweetness recognition technology based on gas sensor array. Foreign Electron. Meas. Technol. 2021, 40, 71–76. [Google Scholar]
  13. Wang, W.; Yang, W.; Liu, Y.; Wang, Z.; Yan, Z. A Research of Neural Network Optimization Technology for Apple Freshness Recognition Based on Gas Sensor Array. Sci. Program. 2022, 2022, 5861326. [Google Scholar] [CrossRef]
  14. Jie, H.; Yan, L.; Fangyuan, Y.; Mengtian, Z.; Yan, J.; Feng, S.; Luye, W.; Guohua, H.; Yuquan, C. Prediction of Storage time of Tilapia cryopreservation using Electronic nose. Chin. J. Sens. Sens. 2013, 26, 1317–1322. [Google Scholar]
  15. Dongjie, C.; Peihong, J.; Changfeng, Z.; Xiaobao, N. Prediction of freshness quality of sea bass based on electronic nose and statistical method. Sci. Technol. Food Ind. 2018, 39, 235–239. [Google Scholar]
  16. Xu, L.; Zhang, Z.Y.; Chen, X.; Zhao, S.W.; Wang, L.Y.; Wang, T. Prediction of aero-optical imaging migration based on BP Neural Network Optimized by improved Sparrow Search Algorithm. J. Optoelectron. Laser 2021, 32, 653–658. [Google Scholar]
  17. Huang, J.Y. Sparrow Search Algorithm Based on T Distribution and Tent Chaos Map. Master’s Thesis, Lanzhou University, Lanzhou, China, 2021. [Google Scholar]
Figure 1. Block diagram of acquisition system.
Figure 1. Block diagram of acquisition system.
Sensors 23 06476 g001
Figure 2. Information processing center module (left), Information collection (right).
Figure 2. Information processing center module (left), Information collection (right).
Sensors 23 06476 g002
Figure 3. Flowchart of the algorithm.
Figure 3. Flowchart of the algorithm.
Sensors 23 06476 g003
Figure 4. Relation diagram of fitting curve.
Figure 4. Relation diagram of fitting curve.
Sensors 23 06476 g004
Figure 5. Comparison of gas concentrations of apples with different freshness: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Figure 5. Comparison of gas concentrations of apples with different freshness: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Sensors 23 06476 g005
Figure 6. Gas concentration of apples with different freshness after filtering: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Figure 6. Gas concentration of apples with different freshness after filtering: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Sensors 23 06476 g006aSensors 23 06476 g006b
Figure 7. Training error before optimization (left), Training error after optimization (right).
Figure 7. Training error before optimization (left), Training error after optimization (right).
Sensors 23 06476 g007
Figure 8. Comparison between the predicted value and the measured value of a sample before and after optimization: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Figure 8. Comparison between the predicted value and the measured value of a sample before and after optimization: (a) ethylene; (b) ethanol; (c) oxygen; (d) carbon dioxide.
Sensors 23 06476 g008
Figure 9. Freshness prediction output of a single apple.
Figure 9. Freshness prediction output of a single apple.
Sensors 23 06476 g009
Table 1. Composition of sensor array.
Table 1. Composition of sensor array.
Type of SensorMainly Measured GasMeasuring RangeWorking Voltage/V
MQ3ethanol(25~500) × 10−6 ppm5.0
MG811Carbon dioxide(0~10,000) × 10−6 ppm6.0
ME2-O2oxygen0~25% Vol3.3
ME3-C2H4ethylene(0~100) × 10−6 ppm5.0
Table 2. Tent-SSA implementation steps.
Table 2. Tent-SSA implementation steps.
Step NumberStep Content
1Set the population size N, the number of discoverers p n u m , the number of reconnaissance warnings s n u m , the target function dimension D, the initial values of the upper and lower bounds ub and lb, respectively, the maximum number of iterations T, and the solution accuracy ε .
2Tent is applied to generate N D-dimensional vectors Zi, and within the range of values of the variable by the carrier X n e w d = d min + ( d max - d min ) Z i , dmin and dmax are, respectively, the minimum and maximum values of the d-dimension vector X n e w d .
3Calculate the fitness f i and select the optimal fitness f g , the worst fitness f w , and the corresponding positions xb and xw, respectively.
4Select the first p n u m with good fitness to be the discoverer, and the rest as joiners; update the locations of the discoverer and joiner.
5Randomly select s n u m as the vigilant and update their position.
6One iteration was performed to calculate the fitness f i and average fitness f a v g for each animal.
Perform an iteration to calculate the fitness and average fitness of each animal
7If f i f a v g , the individual is chaotically disturbed, if the individual’s performance is better after disturbance, it will replace the previous individual; otherwise, it will remain unchanged.
8If f i < f a v g , m u t a t i o n ( x ) = x ( 1 + N ( 0 , 1 ) ) was used to conduct Gaussian mutations on individuals. x represents the original parameter value, N(0,1) represents the normally distributed random number, and mutation(x) is the value after Gaussian mutation.
9Update the optimal position xb and its fitness and the worst position xw and its fitness in the entire population.
10Determine whether the maximum number of iterations or solution accuracy is reached, and if so, the loop ends and outputs the optimal parameter result.
11If not, go back to Step 6 and iterate again.
Table 3. Optimized BP implementation prediction steps.
Table 3. Optimized BP implementation prediction steps.
Step NumberStep Content
1Initialize. According to the input matrix, determine the BP topology, initialize the maximum number of iterations T0, and determine the coefficient of determination ε .
2Use an optimized sparrow search algorithm for iterative optimization through Tent.
3The SSA algorithm is completed, the optimal parameters are output, and the values are assigned to the BP network for prediction and calculate ε .
4According to ε 0 = 1.396 * 10 6 x 8 2.548 * 10 5 x 7 0.0003126 x 6 + 0.01221 x 5 0.1327 x 4 + 0.701 x 3 1.905 x 2 + 2.461 x 0.2368 , calculate the quality threshold value ε 0 in this prediction result.
5Make a judgement. If ε < ε 0 , adjust the input matrix and return to Step 1 until the number of iterations T0 is reached or Step 6 is satisfied.
6Make a judgement. If ε > ε 0 , the loop ends, and the predicted result is output.
Table 4. The relationship between the dielectric properties and the freshness of Fuji apples [10,11].
Table 4. The relationship between the dielectric properties and the freshness of Fuji apples [10,11].
Improvement of Characteristics The   Equivalent   Capacitance   C S / e 10 F Loss   Factor   D / e 2 Relative   Dielectric   Constant   ε / e 1
fresh2.0–2.56.1–6.85.0–5.5
not fresh1.2–2.04.5–5.83.5–5.0
decay>0.8>2.8>2.8
Table 5. Partial prediction results of an apple.
Table 5. Partial prediction results of an apple.
Time/dThe Actual FreshnessThe Classification Results of Neural Network OutputPredicted
Results
FreshNot FreshDecay
6Fresh0.82720.1970−0.0242Fresh
10Fresh0.65210.4064−0.0585Fresh
15Not fresh0.22190.8077−0.0297Not fresh
20Not fresh−0.08140.71050.3708Not fresh
30Decay0.13810.16510.6967Decay
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, W.; Yang, W.; Li, M.; Zhang, Z.; Du, W. A Novel Approach for Apple Freshness Prediction Based on Gas Sensor Array and Optimized Neural Network. Sensors 2023, 23, 6476. https://doi.org/10.3390/s23146476

AMA Style

Wang W, Yang W, Li M, Zhang Z, Du W. A Novel Approach for Apple Freshness Prediction Based on Gas Sensor Array and Optimized Neural Network. Sensors. 2023; 23(14):6476. https://doi.org/10.3390/s23146476

Chicago/Turabian Style

Wang, Wei, Weizhen Yang, Maozhen Li, Zipeng Zhang, and Wenbin Du. 2023. "A Novel Approach for Apple Freshness Prediction Based on Gas Sensor Array and Optimized Neural Network" Sensors 23, no. 14: 6476. https://doi.org/10.3390/s23146476

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop