[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Next Article in Journal
Architecture for a Mobile Robotic Camera Positioning System for Photogrammetric Data Acquisition in Hydroelectric Tunnels
Next Article in Special Issue
Integrating Automated Labeling Framework for Enhancing Deep Learning Models to Count Corn Plants Using UAS Imagery
Previous Article in Journal
High-Speed Tracking with Mutual Assistance of Feature Filters and Detectors
Previous Article in Special Issue
Diagnosis of Induced Resistance State in Tomato Using Artificial Neural Network Models Based on Supervised Self-Organizing Maps and Fluorescence Kinetics
You seem to have javascript disabled. Please note that many of the page functionalities won't work as expected without javascript enabled.
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

TinyML-Sensor for Shelf Life Estimation of Fresh Date Fruits

by
Ramasamy Srinivasagan
1,*,
Maged Mohammed
2,3 and
Ali Alzahrani
1
1
Department of Computer Engineering, College of Computer Sciences and Information Technology, King Faisal University, Al Hofuf 36362, Saudi Arabia
2
Date Palm Research Center of Excellence, King Faisal University, Al Hofuf 36362, Saudi Arabia
3
Agricultural and Biosystems Engineering Department, Faculty of Agriculture, Menoufia University, Shebin El Koum 32514, Egypt
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(16), 7081; https://doi.org/10.3390/s23167081
Submission received: 22 June 2023 / Revised: 2 August 2023 / Accepted: 8 August 2023 / Published: 10 August 2023
(This article belongs to the Collection Machine Learning in Agriculture)
Figure 1
<p>The responsivity of AS7265x—18-channel optical sensor [<a href="#B37-sensors-23-07081" class="html-bibr">37</a>].</p> ">
Figure 2
<p>Methodology flow for the proposed shelf life estimation.</p> ">
Figure 3
<p>The supply chain of fresh dates.</p> ">
Figure 4
<p>TinyML model workflow.</p> ">
Figure 5
<p>Block diagram of spectral shelf life estimator for dates (SSLED).</p> ">
Figure 6
<p>Connection schematic between spectral sensor and Arduino.</p> ">
Figure 7
<p>TinyML-based spectral shelf life estimator for dates (SSLED) neural network architecture.</p> ">
Figure 8
<p>Reflected photon count versus wavelengths for three maturation stages of fruit.</p> ">
Figure 9
<p>Reflectance ratio for moisture content for various treatments vs. shelf life in # days.</p> ">
Figure 10
<p>Cumulative reflectance value from the spectral sensor of five major attributes vs. shelf life in # days.</p> ">
Figure 11
<p>Sensitivity analysis for hyperparameters (momentum, batch size, and layer numbers).</p> ">
Figure 12
<p>Model accuracy with activation function (<b>A</b>) and model accuracy without activation function (<b>B</b>).</p> ">
Figure 13
<p>Model accuracy for treated samples for various confidence thresholds.</p> ">
Figure 14
<p>Data visualization plots covering four treated samples kept at cold storage room (5 °C) and at normal temperature (room temperature 24 °C). (<b>A</b>) unsealed at 5 °C, (<b>B</b>) unsealed at 24 °C, (<b>C</b>) MAP1 at 5 °C, (<b>D</b>) MAP1 at 24 °C, (<b>E</b>) MAP2 at 5 °C, (<b>F</b>) MAP2 at 24 °C, (<b>G</b>) VSB at 5 °C, and (<b>H</b>) VSB at 24 °C.</p> ">
Figure 15
<p>Live classification results for sample from unsealed tray kept at room temperature.</p> ">
Figure 16
<p>Model test results for all treated samples when confidence threshold was set to 1.5: (green blobs are correct; red ones are incorrect prediction). (<b>A</b>) unsealed at 5 °C, (<b>B</b>) unsealed at 24 °C, (<b>C</b>) MAP1 at 5 °C, (<b>D</b>) MAP1 at 24 °C, (<b>E</b>) MAP2 at 5 °C, (<b>F</b>) MAP2 at 24 °C, (<b>G</b>) VSB at 5 °C, and (<b>H</b>) VSB at 24 °C.</p> ">
Figure 17
<p>Model test results for unsealed samples at cold storage (5 °C).</p> ">
Figure 18
<p>Model test results for unsealed samples at room temperature.</p> ">
Figure 19
<p>Training and validation accuracy and loss curves for VSB samples at room temperature.</p> ">
Versions Notes

Abstract

:
Fresh dates have a limited shelf life and are susceptible to spoilage, which can lead to economic losses for producers and suppliers. The problem of accurate shelf life estimation for fresh dates is essential for various stakeholders involved in the production, supply, and consumption of dates. Modified atmosphere packaging (MAP) is one of the essential methods that improves the quality and increases the shelf life of fresh dates by reducing the rate of ripening. Therefore, this study aims to apply fast and cost-effective non-destructive techniques based on machine learning (ML) to predict and estimate the shelf life of stored fresh date fruits under different conditions. Predicting and estimating the shelf life of stored date fruits is essential for scheduling them for consumption at the right time in the supply chain to benefit from the nutritional advantages of fresh dates. The study observed the physicochemical attributes of fresh date fruits, including moisture content, total soluble solids, sugar content, tannin content, pH, and firmness, during storage in a vacuum and MAP at 5 and 24 °C every 7 days to determine the shelf life using a non-destructive approach. TinyML-compatible regression models were employed to predict the stages of fruit development during the storage period. The decrease in the shelf life of the fruits begins when they transition from the Khalal stage to the Rutab stage, and the shelf life ends when they start to spoil or ripen to the Tamr stage. Low-cost Visible–Near–Infrared (VisNIR) spectral sensors (AS7265x—multi-spectral) were used to capture the internal physicochemical attributes of the fresh fruit. Regression models were employed for shelf life estimation. The findings indicated that vacuum and modified atmosphere packaging with 20% CO2 and N balance efficiently increased the shelf life of the stored fresh fruit to 53 days and 44 days, respectively, when maintained at 5 °C. However, the shelf life decreased to 44 and 23 days when the vacuum and modified atmosphere packaging with 20% CO2 and N balance were maintained at room temperature (24 °C). Edge Impulse supports the training and deployment of models on low-cost microcontrollers, which can be used to predict real-time estimations of the shelf life of fresh dates using TinyML sensors.

1. Introduction

Substantial losses occur within the food product supply chain, especially in fruits and vegetables, from when they are cultivated until they reach the consumer. A considerable quantity of food is produced but is not consumed due to these losses in the supply chain. This segment of postharvest losses is approximately 25–30% [1]. Roughly 14 percent of the world’s food is lost between harvest and retail, and another 17 percent is wasted in retail and at the consumption level. The 2030 Agenda for Sustainable Development, specifically SDG 12, Target 12.3, aims to halve per capita global food waste at the retail and consumer levels and reduce food losses along production and supply chains [1].
The date palm (Phoenix dactylifera L.) is one of the oldest fruit trees that grows widely in the Middle East and North Africa. Dates are a key source of income and a staple food for locals in many regions where they are cultivated. They have also played an essential role in those countries’ socioeconomic and environmental conditions [2]. Consequently, the demand for date-importing countries like India, Germany, the United Kingdom, the USA, the Netherlands, Canada, Spain, Italy, Belgium, and Switzerland has increased significantly. Given the importance of the date palm trade on a local and global scale, ensuring a continuous supply in the market is vital [3].
A total of 8.46 million tons of date fruit are produced annually worldwide. In 2022, Saudi Arabia exported 1.54 million tonnes. Date fruit is renowned for its high nutritional value, and clinical studies have proven that consuming two to three servings of date fruit per day is beneficial for patients with Type-2 diabetes due to its low Glycemic Index (GI). Consuming foods with a GI index of less than 50 is recommended. Date varieties such as Khalas cv., Hilali, Sukkary, Sagai, and Shaqra have a GI of less than 50 and are considered safe to consume when they reach the mature stage. Fresh dates are suggested as a healthy and nutritious snack because they have a lower calorie and sugar content compared with dried dates (Tamr). The GI of fresh fruits is 2–3 times lower than that of mature dates, and they are also rich in calcium and other nutrients. However, all varieties of fresh dates can be consumed without restrictions (regarding the number of servings per day that may increase Glycemic levels) if consumed before reaching the mature stage. It is important to note that the shelf life of fresh fruits is only 10–12 days before reaching maturity in an uncontrolled environment [4,5,6].
Dates fruit is known for its great nutritional value, and it has been proven in a clinical study that two to three servings of dates fruit per day are beneficial for patients with diabetes (Type-2) because of their low Glycemic Index (GI). A GI index of less than 50 is recommended for consumption [4]. The dates varieties, Khalas cv., Hilali, Sukkary, Sagai, and Shaqra, have a GI of less than 50 and are very safe to consume at the mature stage. Fresh dates are recommended as a healthy and nutritious snack due to their low calorie and sugar content compared with dried dates (Tamr). The GI of fresh fruits is 2–3 order times less than that of mature fruits and is rich in calcium apart from its nutritional content. However, if consumed before the mature stage, all the fresh date varieties can be consumed without restrictions (number of servings in a day, which will not increase GL-Glycemic Level).
Nonetheless, fresh date fruits exhibit seasonality and are available from July to November. Consequently, storing these fruits under appropriate conditions is imperative to ensure food security. The key objectives of fruit storage encompass preserving fruits for consumption beyond their regular season, maintaining the quality of the food, slowing down the decaying process, ensuring a steady supply to the market, and obtaining better pricing [7,8,9].
The dates’ freshness and shelf life depend on preserving their physicochemical properties, including moisture content (MC), total soluble solids (TSS), firmness, pH, and water activity (AW). However, the conventional methods of analyzing these properties and other quality indicators in the fruit are time-consuming, labor-intensive, and damaging. Consequently, the need for rapid and non-destructive testing of fruit quality has emerged as a crucial area of research. Non-destructive techniques, such as spectroscopic and imaging methods, have proven highly effective in food control. These analytical techniques offer numerous advantages, including preserving samples, producing swift results, and conducting checks during production processes. As a result, they have been extensively studied and utilized in the agro-food sector for a considerable period of time [10].
The most commonly widespread non-destructive techniques in the food industry are indeed visual/Near-Infrared (NIR) spectroscopy, NIR spectroscopy (NIRs), and image and multi/hyperspectral analysis [11]. The hyperspectral imaging technique to detect fungal contamination of edible date fruits using Latent Discriminant Analysis and Quadratic Discriminant Analysis was investigated in [12]. This work evaluates the possibility of an objective, fast, and non-destructive method to identify healthy and fungal-infected date fruits. Four wavelengths (1120, 1300, 1610, and 1650 nm) were used for this study [12].
Visible (Vis; 400–750 nm) and near-infrared red (NIR; 750–2500 nm) region spectroscopy have been employed to evaluate the quality and internal attributes of fruits and vegetables. Focusing specifically on “point” spectroscopy rather than hyperspectral imaging, various non-destructive testing applications have been successfully concluded using this approach [13]. Several researchers have used spectral bands (Visible, Short-Wave Near-Infrared (SWNIR), NIR, and IR) to observe the reflectance properties to estimate the quality or shelf life of various fruits such as Kesar mango [14], grapes [15], persimmon [16], muskmelon [17], kiwi fruit [18], strawberry [19], Royal Gala [20], and pineapple [21].
The researchers [17,22,23,24,25,26,27,28,29] have put forth a collection of deep learning (DL) and machine learning (ML) techniques to classify and grade the quality of date fruits. However, these approaches predominantly rely on cloud services for training and inference, making them unsuitable for edge computing. In contrast, edge artificial intelligence (AI) primarily processes data locally, reducing internet data transfer and conserving significant bandwidth. Moreover, edge computing devices are designed for highly efficient power consumption, resulting in lower power requirements than cloud data centers. To meet the demands of edge AI computing, we propose adopting lightweight AI models that can be deployed on microcontrollers, a new paradigm of Edge AI computing referred to as Tiny Machine Learning (TinyML). This approach satisfies all the requirements for edge AI computing and enables efficient processing and classification of date fruit quality without relying on resource-intensive cloud services [30,31].
Understanding the shelf life of perishable food products is essential for ensuring food safety and quality and reducing food waste. Fresh dates have a limited shelf life and are susceptible to spoilage, which can lead to economic losses for producers and suppliers. The problem of accurate shelf life estimation for fresh dates is essential for various stakeholders involved in the production, supply, and consumption of dates [32,33]. By addressing this problem, we can enhance food safety, reduce waste, and improve the overall efficiency and sustainability of the food industry. By addressing this problem and developing a reliable methodology for estimating the shelf life of fresh dates, we aim to provide a practical solution to enhance the quality control processes throughout the supply chain. This can benefit producers, suppliers, and consumers by reducing food waste, improving product quality, and ensuring that dates reach consumers at their peak freshness. Accurately estimating shelf life also has broader implications for the food industry. It can enable better inventory management, reduce losses, and optimize production and distribution processes. Additionally, it contributes to overall sustainability efforts by minimizing food waste and resource utilization.
This study investigates the integration of non-destructive techniques, machine learning (ML) regression models, and packaging methods to assess and predict the shelf life of fresh date fruits. While previous studies have investigated shelf life estimation using various methods, this research focuses explicitly on date fruits. It introduces low-cost VisNIR spectral sensors for non-destructive assessment of internal quality attributes. Additionally, ML regression models are developed to predict the stages of fruit development and estimate shelf life based on observed quality attribute data. Furthermore, the study explores the effects of different packaging conditions, including modified atmosphere packaging and vacuum packaging. By combining these elements, the research provides a comprehensive approach that goes beyond previous efforts in the literature and offers new insights into accurate shelf life estimation and preservation techniques for fresh date fruits.
The main contribution of the current study lies in applying non-destructive techniques, machine learning (ML) regression models, and modified atmosphere packaging (MAP) to estimate and predict the shelf life of fresh date fruits. In addition, the study demonstrates the effectiveness of low-cost VisNIR spectral sensors for the non-destructive assessment of internal quality attributes, enabling continuous monitoring of fruit quality without sample destruction. The development of ML regression models enhances the accuracy of shelf life estimation by utilizing observed quality attribute data. Additionally, the research highlights the benefits of MAP in extending the shelf life of date fruits. These contributions provide valuable insights into optimizing fruit quality management and decision-making for optimal freshness and nutritional benefits of fresh date fruits throughout the supply chain.
TinyML delivers intelligence to low-memory and low-power tiny devices by enabling machine learning. This research proposes a new lightweight model for fresh date fruit shelf life estimation based on a low-cost, handy VIS/NIR range spectral sensor and CNN architecture deployable on any Microcontroller supported by the Edge Impulse Platform. The proposed model is trained and validated using the Edge Impulse cloud platform using an in-house dataset.
The main objectives of the current study are the following:
  • Assess the physicochemical attributes of date fruits throughout their storage period in various modified atmospheres and determine the shelf life for each storage condition.
  • Develop a low-cost, fast inference, and portable shelf life estimator using a TinyML-assisted 18-channel spectrometer.
  • Develop real-time predictive regression models trained from Edge Impulse utilizing the reflectance property to predict the shelf life of fresh dates.
  • Validate the results obtained using the developed predictive models against the observed laboratory results.
The rest of the paper is structured as follows: First, we introduce the Materials and Methods used in Section 2; Section 3 details the results and discussion. Section 4 concludes the work and Section 5 suggests future work.

2. Materials and Methods

2.1. Sample Collection and Preparation

The date samples at the Khalal stage (Khalas cv.) were harvested from the Date Palm Research Center of Excellence experimental farm, King Faisal University, Saudi Arabia (25.26809 N, 49.70847 E).
The harvested fruit samples were cleaned, sorted, and washed immediately after harvesting. Afterward, the samples were precooled at 24 °C in cold storage to be randomly moved to storage treatments. Once the selected fruits were precooled, the samples of approximately 250 g were placed into vacuum-sealed bags (150 × 200 mm) and in trays with a single layer of modified atmosphere packaging (MAP) (35 × 135 × 185 mm). The vacuum sealer (SH-6691, Swiss Home) was used to vacuum and seal the vacuum sealer bags after packing with fresh date samples. The trays were obtained from VC999 MAP Systems, CH–9100, Melonenstrasse 2, Herisau, Switzerland. The sealing machine model VC999 TS300, Bernhard Inauen, Herisau, Switzerland, was used to process the MAP trays by adding the gas mixtures to the samples and then sealing the MAP trays. The fresh date samples to be packaged were put manually in the trays. The MAP trays with the fresh date samples were evacuated, filled with modified gas before sealing, and sealed with non-permeable film (320 mm PA⁄PP 65 my).
The MAP treatments were unsealed trays (Control), vacuum-sealed bags (VSB), MAP with 20% CO2 and N balance (MAP1), and MAP with 10% O2, 20% CO2, and N balance (MAP2). The modified atmospheric concentrations of the gases were supplied from premixed gas cylinders. All treatments were stored in the cold storage room at 5 °C and room temperature (24 °C) for quality assessment. The study focused specifically on predicting shelf life for fresh dates based on the data from every week in the early stage of maturity within the suitable storage period for each storage temperature and method. For example, measurements are taken every week when dates have a longer shelf life. In the later stages, when the dates were closer to expiration, measures were taken more frequently, over shorter intervals, to capture any rapid changes in the attributes. Three replicates from each packing treatment were randomly evaluated before and after each storage period.

2.2. Physicochemical Attributes Measurements

The physicochemical attributes (moisture content, water activity, total soluble solids, total sugar, pH, and tannin) of the date fruit were evaluated before and after each storage period. These properties were analyzed in the Date Palm Research Center of Excellence fruit quality laboratories at King Faisal University, Saudi Arabia. The fruit moisture content (MC) was measured using a vacuum-drying oven (LVO-2041P, Daihan Labtech Co., Ltd., Namyangju-si, Gyeonggi-do, Republic of Korea) by drying a sample of 50 g of fruits under vacuum at 70 °C. The fruit sample weight was determined after 48 h to calculate the date fruit MC according to the Association of Official Analytical Chemists (AOAC) [34]. The total soluble solids (TSS) of the date fruits were measured using a digital laboratory refractometer (RFM 840, Richmond Scientific Ltd., Unit 9, Lancashire, UK) [33]. The fruit’s total sugar (TS) was measured using the anthrone–sulfuric acid colorimetry method. The absorbance was determined at 630 nm wavelength using a spectrophotometer (Genesys 20, Thermo Scientific, Waltham, MA, USA). The amount of TS in the sample was quantified using a standard graph constructed by plotting standard concentration on the x-axis vs. absorbance on the y-axis [35]. The pH of the fruit was measured using a pH meter (S400, Mettler-Toledo LLC, Columbus, OH, USA). The TC of the fruits was measured using a spectrophotometer (Genesys 20, Thermo Scientific, Waltham, MA, USA) at 750 nm wavelength based on the method described in [36]. The TC was determined by establishing a calibration curve by measuring absorbance at different known gallic acid concentrations [35].

2.3. Characteristics of Low-Cost Multiband Sensor

This section describes the features of an 18-channel multi-spectral sensor and the mapping of wavelengths to significant fruit attributes, which in turn were used to predict shelf life. The AS7265x chipset from AMS OSRAM, Austria, used for this experiment consists of an 18-channel Visible (VIS) to Short Wave Near Infra-Red (SWNIR) multi-spectral sensor used for detecting the physicochemical properties of fresh dates. This chipset has onboard optical filters whose spectral response is defined by on-device Gaussian Band Pass filters with 20 nm Full Width at Half Maximum (FWHM) value and with three optical sensors and 6 wavelengths for each optical sensor, totaling 18 wavelengths. The device wavelengths for each optical sensor are listed in Table 1. The sensors also have integrated programmable constant current-led drivers, through which light intensity can vary. The reflected light from the target is used to find the internal characteristics of the fruit.
The normalized responsivity for the entire spectrum of the Triad AS7265x chipset is reproduced from the manufacturer’s Datasheet in Figure 1. The normalized responsivity peaking occurs for various wavelengths and is coded with Alphabets “A, B---K, and L” [37].
The wavelengths used in the AS7265x optical sensors correspond to a particular absorption peak of particular interest in this fresh date fruit maturity analysis (Khalal to Tamr). As reported by Giovenzana et al. [10] and Beghi et al. [11], 630 and 690 nanometers are near the characteristic peak of chlorophyll, 730 nanometers are near the third overtone of the -OH bond, and lastly, 810 and 860 nanometers are near the combination band of the -OH groups of sugars. Major attributes determining the shelf life of dates are pH, total soluble solids (TSS), sugar, MC, water activity (AW), tannin, and firmness. Water activity and moisture content in the fruit maturity stages were analyzed in different modified atmospheric conditions [36] and verified that the ratio (MC/aw) is 0.33. The non-invasive assessment of fruit firmness remains a “holy grail” in postharvest research [13]. According to Walsh et al. [13], a change in firmness is associated with minor changes in chemical composition, such as pectin levels. It is unlikely that NIRS can be used to detect these chemical changes in intact fruit. Thus, there is no consensus that firmness can be robustly (and directly) assessed using Vis-SWNIR. Finally, the major attributes considered for predicting the shelf life and analyzing the freshness of date fruits are pH, TSS, sugar, moisture, and tannin. Figure 2 shows the methodology flow for the proposed shelf life estimation. The date fruit samples at various modified atmospheres are subjected to both conventional testing for major attributes (pH, TSS, tannin, moisture content, and sugar) and the AS7265x sensors. The mapped data are used for AI model development through Edge Impulse flow. The final model is deployed on the Arduino Nano sense microcontroller for inferencing shelf life estimation.

2.4. Need for ML Models in Enhancing Food Sustainability

Broadly, the agriculture tasks are categorized into preharvest, harvest, and postharvest [38].
Machine learning evolved as a subdomain of Artificial Intelligence (AI) that comprises algorithms capable of deriving niche information from data and utilizing the same in self-learning to make good predictions or classifications. Machine learning and Artificial Intelligence can improve food sustainability by optimizing agricultural practices, such as precision farming, to reduce the resources used while maximizing yields. AI can also monitor crop growth and make more accurate predictions about yield, allowing farmers to plan better and reduce waste. Additionally, AI can be used in the supply chain to track food quality and reduce food waste by predicting customer demand and optimizing logistics for more efficient delivery.
The prime activities in each agriculture task and AI models used are listed below in Table 2.
The shelf life of food products mainly depends on environmental factors in the food supply chain. Environmental factors play an essential role in the dynamic change in the quality pattern of food products over time. Hence, the potential of incremental learning or lifelong machine learning approach may be utilized for building models with high classification or prediction accuracy. Lifelong learning (LL) involves a reinforcement learning approach and using the accumulated knowledge over time for future learning and solving problems [56].
To apply any machine learning approach, datasets, training, and Inference are the three pillars to improving food sustainability and reducing food waste.
Figure 3 shows the process of bringing food (fresh dates) from farmers to consumers. Throughout the process, various stakeholders, such as farmers, packaging companies, logistics providers, and retailers, work together to ensure the dates are safely transported and delivered to consumers. Similarly, various Internet of Things Sensors, actuators, and ML models are used to preserve the freshness of date fruit. However, the choice of Model development and deployment is decided by two approaches: Cloud computing and Edge computing.

2.5. Computing Choices for ML Model

Cloud computing is a model for delivering computing services over the internet. It allows users to access virtual resources such as computing power, storage, software, and services on demand without managing their own physical hardware.
Edge computing is an emerging computing paradigm that refers to a range of networks and devices at or near the user. Edge computing is about processing data closer to where it is being generated, enabling processing at greater speeds and volumes, leading to greater real-time action-led results.
The following parameters have the same choice of computing as in Table 3: We define the “ITSBLERP” parameters.

2.6. Need for Tiny Machine Learning

TinyML brings machine learning to microcontrollers and Internet of Things (IoT) devices to perform on-device analytics by leveraging the massive amounts of data they collect.
Tiny Machine Learning (TinyML), a rapidly growing subfield of applied ML, is a prime candidate for enabling computation and inference on edge devices. This budding area focuses on deploying simple yet powerful models on extremely low-power, low-cost microcontrollers at the network edge. TinyML models require relatively small amounts of data, and their training can employ simple procedures. Furthermore, as TinyML can run on microcontroller development boards with extensive hardware abstraction, such as Arduino products, deploying an application onto hardware is easy. TinyML enables diverse always-on applications ideal for battery-powered devices, particularly in Food supply chain verticals. Additionally, the cost-effectiveness and efficiency advantages of TinyML make it possible to deploy distributed TinyML systems that collaborate at the “edge” of the cloud computing network, making it a perfect fit for our proposed work [30,31].

2.7. How to Implement TinyML?

There are a couple of machine learning frameworks that support TinyML applications, as follows:
  • TensorFlow Lite for mobile-based applications
  • PyTorch Mobile
  • Tensor Flow Lite for Microcontrollers (TFLM)
Building ML models for mobile devices (using TensorFlow Lite) or the web (using TensorFlow.js) is possible using high-level programming languages such as Python and JavaScript. These languages are easy to learn and far more accessible to beginners than C/C++, which are microcontroller-friendly. However, the cost of mobile devices is higher than that of microcontroller devices. Also, optimizing and compressing Neural networks on mobile devices is not straightforward. On the other hand, popular frameworks such as TensorFlow Lite for Microcontrollers (TFLM) [30] help address optimization and compression of neural networks for embedded devices, but adoption has been slow due to challenges (data collection, data processing, development, deployment, and monitoring) that are unique to the embedded machine learning ecosystem. Edge Impulse, an online platform designed to simplify the process of collecting data, training deep learning models, and deploying them to embedded and edge computing devices, allows us to address these issues.
Due to the above-mentioned fact, we plan to develop our prediction models for shelf life estimation using Tiny Machine Learning supported by Edge Impulse Cloud MLOPs.

2.8. TinyML Development Using Spectral Sensor and Edge Impulse Platform

This research work proposes a low-cost portable exploiting TinyML models deployable on Arduino Nano 33 BLE Sense microcontroller for real-time prediction of shelf life in fresh date fruits, also known as “SSLED”. Visible- Short Wave Near Infrared range Spectrometric TinyML model; “SSLED”—Spectral Shelf Life Estimator for Dates. The developed models are targeted at the Arduino Nano33 BLEsense–Cortex M4 microcontroller that can run neural network models using TensorFlow Lite for microcontrollers (TFLM). Nano33 BLE sense board hosts numerous sensors (microphone, temperature, humidity, pressure, vibration, orientation, color, brightness, proximity, gesture, etc.) that enable a wide range of TinyML applications.
The end-to-end model development and deployment were carried out with the help of the Edge Impulse platform. The self-explanatory five stages used in TinyML model development are represented by flow diagram as in Figure 4.

2.9. Architecture of SSLED

The schematic diagram displaying the complete architecture is presented in Figure 5. The 18-band spectral vis-SWNIR sensor captures the features (attributes) in reflectance values, indicating the amount of light reflected from the collected samples. These samples are transmitted to the Edge Impulse cloud platform through Arduino CLI on the Nano 33 BLE Sense (Edge Device).
The Edge Impulse cloud training platform performs the necessary training and deploys the model to the Edge device. The Nano 33 BLE then conducts real-time inference to estimate the shelf life, also called the “Freshness Index”.
The reflectance ratio is calculated using the measurement of incident light and the reflected light values obtained from the AS7265x—18-channel optical sensor. To measure incident light, we utilize a calibration process where we expose the sensor to a known light source. This allows us to establish a baseline value for incident light. The calibration ensures that we have a consistent reference point for measuring the reflectance of the dates.
Regarding the measurement of reflected light, the AS7265x sensor provides photonic values rather than direct reflectance values. However, these photonic values are proportional to the light the dates reflect. The sensor detects and quantifies light intensity across different channels, or spectral bands. By analyzing the photonic values for each channel, we can determine the reflectance characteristics of the dates and calculate the reflectance ratios.

2.10. Structure of Neural Network Used for Spectral Shelf Life Estimator for Dates (SSLED)

In this study, Tiny Machine Learning-based ANNs have been used to predict the shelf life of fresh date fruit. The reflected light from the AS7265x chipset corresponding to major physicochemical properties, i.e., date fruits’ pH, TSS, sugar, tannin, and MC, were taken as input for the regression NN model.
The input layer acquires data from the AS7265x Triad optical sensor through the I2C port of the Arduino Nano33 BLE sense microcontroller (Edge Device). The connection diagram illustrating the spectral sensor to Arduino is shown in Figure 6. The neural network diagram of the TinyML SSLED prediction model is shown in Figure 7. The hidden layer performs the data transformation and feature extraction, and the output layer delivers the continuous predicted values and the shelf life/freshness index based on the major attributes of fresh date fruit.
This study utilized the Edge Impulse Cloud platform [37,38] to develop TinyML prediction models and assess their accuracy. Edge Impulse offers a straightforward approach to gathering data using built-in or external sensors in smart devices like mobile and embedded devices compared with other machine learning development platforms. It boasts a user-friendly interface, assists in data analysis, model design, and testing, and provides a deployable version of the model without requiring extensive coding knowledge, facilitating rapid prototype development.
The neural networks in the multilayer perceptron module were trained using a back-propagation learning algorithm with the Adam optimizer. The Adam optimization method adaptively estimates first- and second-order moments in stochastic gradient descent, efficiently updating the weights to minimize the error function.
The dataset was randomly divided into three subsets to train and evaluate the models: 60% for training, 20% for testing, and 20% for the holdout subset. The training dataset was used to determine the weights and build the model, while the testing data helped identify errors and prevent overtraining during the training process. Finally, the holdout data validated the artificial neural network prediction model.

2.11. Model Evaluation

In this work, we used root mean square error and mean absolute percentage error to evaluate the TinyML prediction model using the following equation:
RMSE = i = 1 n O i P i 2 n
M A P E = 100 × 1 n × i = 1 n O i P i O i
where R M S E is the relative error, M A P E is the mean absolute percentage error, Oi is the measured value, n is the number of the measured values, and Pi is the predicted value of the target parameter data, i.

3. Results and Discussion

The importance of this study is to estimate the shelf life of fresh dates using low-cost, real-time machine learning-assisted sensing techniques.
The samples (Khalas cv.) collected were tested for major attributes with Laboratory standard tests, and the low-cost AS7265x Triad—18-channel spectral optical sensor was calibrated using the benchmark results. The AS7265x chipset was calibrated with diffused light and a pre-stored Hexadecimal string stored in EPROM given by the vendor before data acquisition.

3.1. Major Attributes for Shelf Life

The mean values of the major attributes of dates during the fruit ripening stage were tested in the DPRC laboratory, and their values are given in Table 4. These values were used as a guide to label the dataset. In the current study, we focused on the three main stages of fruit maturity to capture a representative range of date fruit properties spanning from the Khalal to the Tamr stage. These stages were carefully selected to include dates at various ripeness levels, allowing us to observe variations in fresh fruit shelf life estimations. We considered that the shelf life expires after the fresh fruits turn into the second maturity stage (Rutab) or the fruits are spoiled. To determine the shelf life intervals for the fresh or Khalal stage, we conducted measurements throughout the entire storage of the dates. The measurements were taken at regular intervals, weekly for specific periods, depending on the change in the significant attributes we monitored under each storage temperature and method. By incorporating measurements throughout the entire ripening stage period, we aimed to comprehensively understand the attribute variations and their correlations with the shelf life of fresh dates. This information allowed us to accurately label the values of significant attributes based on the specific shelf life intervals for the fresh fruits.

3.2. Major Attributes

The reflectance value (photon count) from samples read by 18 channels of optical sensors was recorded with an optical current source drive of 12.5 mA and a receiver gain of 64×. The 18-channel optical filters were swept at 20 nm incrementally from 410 nm up to 940 nm for each setting mentioned above (current and gain). Figure 8 presents the reflectance values from 18 spectral channels for three different stages of fruit maturity. The reflected photon count of the spectral sensor is reported on the y-axis for different wavelength settings of the sensor. All samples were tested under the same environmental light conditions.
From the laboratory results and reported results from related works [10,11,12,13,36,57], we found the following spectral bands sensitive to the significant attributes of date fruits, which are listed in Table 5. We termed the spectral band sensitive to each attribute as pH-SWNIR, TSS-SWNIR, Sugar-SWNIR, MC-SWNIR, and Tan-SWNIR.
The spectral measurements were conducted on the same day when the laboratory tests were conducted on the samples as they progressed through different maturity stages of date fruit, and the results matched the attributes of date fruits. The results were very convincing, and they prove the robustness of the Triad Spectrometer used for experimentation. The three-spectral sensor used is the AS7265x—triad sensor, which has three optical sensors (As72651, As72652, and AS72653), and hence we sum up all the three reflectance photon count values from the samples driven from White LED sources, NIR LEDs, and UV.
Having verified the correctness/matching of spectral bands with measurement results and identified the range of values for all major attributes during the fruit maturity stages, the dataset was used to train the neural network. At first, we verified the correctness or matching of the spectral bands. Spectral bands are specific ranges of wavelengths captured by the sensors used in the study. It is essential to validate that the spectral bands correspond accurately to the specific attributes or characteristics of the measured date fruit.
Next, we identified the range of values for all major attributes during various stages of fruit maturity. These attributes include moisture content, sugar level, pH, and other quality parameters relevant to the shelf life of date fruits. By determining the appropriate range of values for these attributes at different maturity stages, we established the target variables for the neural network to predict accurately.
Once the correctness and range of attribute values were confirmed, this dataset became the input for training the neural network. The neural network learns from this dataset by iteratively adjusting its internal parameters to minimize the difference between predicted and actual attribute values. Through this training process, the neural network becomes better at estimating the shelf life of date fruits based on the captured spectral information.
Even though we chose five attributes to estimate the shelf life of fruit, the moisture content is primarily responsible for fruit freshness/shelf life. So, we tried to plot the reflectance ratio of moisture content related to four treated samples maintained at 5 °C and 24 °C, totaling eight samples. Figure 9 shows the reflectance ratio for moisture content for various treatments. Reflectance ratio is the measure between incident light and reflected light; it gives the measure of absorption by sample under target. The Khalal stage (fresh fruit) reflected 80% of the incident light on the first day. When the fruit matures/ripens, the reflectance ratio deteriorates, indicating the degradation of freshness and, in turn, shelf life. The vacuum-sealed bags maintained at 5 °C showed the strongest resilience to fruit maturity/ripening, and it took 53 days to transform from khalal into the Tamr stage. In other words, we can say that the Glycemic Index of cv. Khalas was under control for 53 days. Whereas the unsealed sample kept at room temperature (24 °C) has lost its freshness in 10 days. From this graph, we can conclude that the cheapest and most affordable treatment is a vacuum-sealed bag, which is kept at room temperature and retains shelf life for 24 days. Figure 10 shows the plot for the cumulative reflectance value from the spectral sensor of five major attributes, and one can notice the same trend as in Figure 9 since moisture content is a major reason for fruit maturity and TSS and sugar content are influenced by moisture content.

3.3. Datasets for TinyML Model Development

The Edge Impulse platform provides a well-structured and simple step to building a model. It allows users to upload different types of preprocessed data. For this experiment on a predictive model, the raw data were uploaded and indicated as time series data. Since our data were used for regression problems, the data upload technique may differ from the familiar classification method. The dataset structure requires separate files (CSV), each named under its label, for all data points as integer values.
The reflectance value from spectral sensors of four categories of treated samples, respectively unsealed, vacuum sealed bags, MAP1, MAP2, and unsealed bags, was coded as a time series of data representing the significant attributes of fruit quality and labeled as a continuous value to represent the shelf life in the number of days as an integer value. The sample-labeled dataset structure coded as time series steps used for uploading the datasets to the Edge Impulse platform for untreated samples is shown in Table 6. Similarly, we labeled all categories of samples and uploaded them to the Edge Impulse cloud training platform. In all our discussions, if shelf life is 0, it is fresh fruit (Khalal—0th/starting day of ripening stage; 14th/nth day the fruit has fully ripened, that is matured to Tamr stage).

3.4. TinyML Model Development

The next step is model building. Regression models with the hyperparameters used for implementation are shown in Table 7. The model has to predict the shelf life of fruits, which are continuous values; hence, regression models were chosen. In addition, the edge device has memory limitations, and lightweight regression models were used.
Regression models are used for prediction, forecasting, and understanding the impact of independent variables on the dependent variable. They are widely used in various fields, including medical sciences, finance, social sciences, and machine learning. Here, regression models were utilized in shelf life estimation to understand the relationship between various factors and the deterioration of a product over time. In this work, we used continuous independent variables for regression models. These models help predict the remaining shelf life of a product based on factors such as temperature, humidity, packaging, and storage conditions. Here, the independent variables used are TSS, pH, water content, sugar, and tannin. The above features are extracted from the reflectance values of AS7265x sensors. The model parameters for the Neural Network block used to implement regression models are listed in Table 7.
The number of samples taken for VSB (5) (Vacuum Sealed Bag maintained at 5 °C) was 960 because the shelf life of the VSB samples is the longest (57 days for fruit ripening). Every week, we need samples for laboratory testing to validate the attributes of dates during the ripening stages. Similarly, untreated samples kept at room temperature have the least shelf life (10 days); 120 samples were sufficient for training. The batch size of 32 was chosen to reduce memory during the training and inference phases. The learning rate of 0.005 was chosen based on batch size and for better convergence. The ADAM optimizer is used because it has fast convergence.
The current study used the ReLU activation function, widely adopted in various ML applications, including neural networks. ReLU is an activation function used in neural networks, especially convolutional and deep neural networks. It is defined as y = max (0, x), which means it outputs the input value if it is positive and zero if it is negative. It is simple yet far superior to previous activation functions like sigmoid or tanh. ReLU has become the default activation function for many types of neural networks because a model that uses it is easier to train and often performs better. ReLU has shown superior performance in many scenarios and offers computational efficiency compared with other activation functions such as sigmoid or tanh. However, using adaptive activation functions is an interesting avenue to explore for enhancing the convergence and performance of neural networks. Adaptive activation functions adjust their parameters during the learning process and can adapt to the specific characteristics and complexity of the given dataset [58].
The Edge Impulse cloud platform is designed to deploy models for real-time applications on the edge device (Arduino Nano 33 BLE). Based on the hyperparameter used for the neural network model, the inference time is 1 milli second, and the RAM usage is 1.8k out of 256 KB to store model parameters. Also, the neural network model consumes only 10.9 KB out of the 1 MB of flash available. These numbers show that this model is optimized for TinyML implementation and for real-time inferencing.
The performance results, accuracy, and MSE for various confidence threshold settings for all treated categories of samples after training using all validation set samples are shown in Table 8.
The range of attribute values (moisture content, total soluble solids, and sugar) was almost 16 to 60 and was responsible for fruit maturity/ripening. However, the tannin value range changed between 0.3 and 6.19 and the pH value between 5.30 and 6.9, which were responsible for fruit maturity/ripening. Even though it looks linear, there is a small amount of nonlinearity during the lab test and a visible short wave near the infrared sensor. Hence, we introduced a nonlinear activating function (ReLu) in the neural network introduced in the tinyML flow. The accuracy plots for all modified atmosphere samples at different confidence levels were plotted with and without reluctant activations, and we conclude that ReLu is much needed for the SSLED sensor. To satisfy both the accuracy and lightweight model of the tiny sensor proposed, which is not a shallow network, we performed a sensitivity analysis for various hyperparameters (batch size, number of hidden layers, Adam optimizer, momentum), and from the results, we conclude that a bat with a size of 32, two hidden layers, and momentum of 0.9 offered better accuracy. The learning rate and epochs are not very sensitive. The learning rate was chosen as 0.005, and # epochs was 100 to converge.
Figure 11 presents the sensitivity analysis results for hyperparameters: momentum, batch size, and layer numbers. This analysis is crucial to understanding these hyperparameters’ impact on the model’s performance. The sensitivity analysis provides valuable insights into how changes in these hyperparameters affect the overall performance and accuracy of the model. The study assesses their influence on the model’s predictive capabilities by systematically varying each hyperparameter while keeping others constant. The results in Figure 11 allow us to identify optimal values for each hyperparameter, which can significantly enhance the model’s performance. This information is vital for fine-tuning the model and achieving the best possible accuracy while considering resource constraints.
Figure 12 compares the model accuracy with and without the activation function. Figure 12A shows that the activation function significantly benefits the model’s accuracy. The activation function introduces nonlinearity to the neural network, enabling the model to capture complex patterns and relationships within the data. As a result, the model’s accuracy improves, demonstrating the importance of selecting the appropriate activation functions for this task. Figure 12B shows the plot for the model accuracy without the activation function. Without an activation function, the model might struggle to learn complex patterns and perform poorly on the given task. This is because linear models can only learn linear relationships between features, limiting the model’s representation power. The results indicate that activation functions are crucial for higher accuracy and better generalization in the ANN models.
The confidence threshold setting suggested by Edge Impulse based on the number of samples in the dataset is 4.3, but we restricted it to lower levels. Increasing confidence threshold values will always yield better results. Since shelf life is reported in the number of days with a resolution of 1 day, the ideal confidence threshold should be 1. Out of all four treated samples maintained at 5 °C and 24 °C, MAP2(24) gives 97.13% accuracy with a MSE of 0.15. On the other hand, MAP1(24)-MAP trays sealed with 10% O2, 20% CO2, and N balance at room temperature yield 76.4% accuracy with a MSE of 0.68. The model accuracy plot is plotted for various confidence thresholds starting from ideal case 1 up to 2, with an increment of 0.25, as shown in Figure 13. This plot shows that even all the samples show more than 93% accuracy for a confidence threshold of 1.5, and even for an ideal threshold setting of 1, most of the sample’s model accuracy is greater than 85 percent, except for the MAP1(24) and unsealed (5) categories of samples. This proves that the model is robust. The reason for poor accuracy related to the MAP1(24) and unsealed (5) categories of samples could be that some of the samples could have been spoiled in that sealed bag due to bruises/friction during the cleaning process or some other internal attributes.
Using the feature explorer option of the Edge Impulse platform, the RMS value of reflectance concerning spectral sensors AS7261 and AS7262 and shelf life RMS are plotted for better data visualization for all eight samples and are given in Figure 14. From all those plots, we can see the linear relationships between the reflectance value of the spectral sensor and shelf life, confirming the robustness of the model. In all the following plots, the X-axis shows the shelf life over several days. From right to left, marked from 0–fresh fruit (Khalal)/starting day of ripening to last day/fully ripened (Tamr stage), the RMS value of reflectance (a.u) wrt AS7262 is marked as Rb RMS. Similarly, the RMS value of reflectance for AS7261 is marked as Refl RMS. The colors (blobs) given for the samples in Figure 14 were (VIBGYOR) and reported by the Edge Impulse studio application for better visualization. Violet for ripened fruit (more days) to Red for Khalal/fresh date fruit (0th day).
Figure 15 shows a snapshot of live classification results from Edge Impulse studio. The sample taken for the demonstration is from unsealed trays kept at 24 °C. The sample was labeled as having a shelf life of 6, predicted as 5.16, and is pretty accurate with a confidence of 0.99. The light blue color blob (bigger size) shows the live sample classification in the screenshot. The shelf life of samples kept in an unsealed tray at room temperature ranges from 1 to 10 days. Here, a shelf life of 0 days means the fruit matures fully (Tamr), whereas a shelf life of 10 days means it will take 10 days to reach the Tamr stage from the Khalal stage.
Figure 16 shows the eight subplots of model test results—data visualization covering four treated samples kept at a cold storage room (5 °C) and a normal temperature (24 °C). The green blobs are correctly predicted, and the red ones are wrongly predicted.
To have better insight in reading and interpreting the model test result performance, the results for all samples in unsealed (5 °C) and unsealed (24 °C) (the top two of the subplots of Figure 15) are plotted for shelf life in the number of days versus all the samples in that category and shown in Figure 17 and Figure 18, respectively.
Figure 17 shows the model test results of the unsealed sample kept at 5 °C. The observation is that samples 1 up to 4 are labeled (the test sample) as having a shelf life of 0, but the model predicted 1.78 days with an error of more than 100 percent. Similarly, sample numbers 36 to 39 are supposed to predict that a shelf life of 9 has an error of more than 100 percent. For samples 5–9 and 57–59, the error is less than 100 percent. The remaining other samples are predicted correctly, and these results are obtained with a confidence threshold of 1.5.
Figure 18 shows the model test results of the unsealed samples kept at 24 °C. The observation is that samples 1 up to 4 are labeled as having a shelf life of 0, but the model predicted 1.78 days, which has an error of more than 100 percent. The remaining samples are predicted correctly, and these results are obtained with a confidence threshold of 1.5.
From the subplots of Figure 16, we validate that the model performs adequately for most of the sample in four categories: VSB, MAP2, MAP1, and unsealed. There were few wrong predictions highlighted in Figure 17 and Figure 18; other than that, most samples were predicted correctly. We believe the wrong prediction is due to some other internal attribute of date fruit.
The plot showing the accuracy and loss curve for both training and validation for 100 epochs during the training cycle is shown in Figure 19. After 90 epochs, the model converges very well and is the correct fit. This plot is generated with a seed of 31 (the initial weights and bias during training are random and vary with different seeds) during the training stage to report the model accuracy consistently.
We validated our model with lab results from the DPRC laboratory when we did live testing. To the best of our knowledge, we did not find any papers working on shelf life prediction using the TinyML regression model for shelf life prediction of fresh dates. However, several related studies exist for Royal Galas, strawberries, mangos, bananas, musk melons, and grapes using Computer Vision models and other classification models. Most of the work has reported around 95% accuracy. Our model results are also good, ranging from 95% to 100% for different confidence threshold settings. The selected microcontroller, Nano 33 BLE, was tested on a Cr2032 Lithium ion 3v3 battery (225 mAH) and consumes much less inferencing power. The TinyML kit will consume only 1–2 mA; however, during the sampling time, the spectral sensor LED is taking 12.5 mA. The battery will last for a week without recharging, assuming 10 min of sampling/inferencing per day. The data acquisition time is just 3 s with calibration, the inference time is less than 100 ms, and with a 225 mAH battery, it will last for a minimum of a week.
The challenge we faced in the TinyML training phase using the Edge Impulse platform was only uploading data for training models. Edge Impulse supports only the onboard sensors of selected microcontrollers/edge devices to acquire the data directly (live upload). The AS7265X sensor we used was an off-the-shelf sensor, and hence we had to acquire the data and store it on an SD card, then convert the reflectance value corresponding to all the attributes for shelf life prediction as a comma separated value (csv), which took a considerable amount of time in weekly sampling and testing. However, the model deployment was easy due to the Edge Impulse platform.

4. Conclusions

We conclude that simple vacuum packaging and low-cost shelf prediction—lightweight models with a low-cost spectral sensor (40 USD)—support edge computing, a key enabler to predict shelf life, thus ensuring sustainable nutrient food availability throughout the year. Consumers in food and agro-industry verticals such as quality management, production, storage, logistics, supply chain, and processing can choose the type of treatment and ML models (cloud/edge). A low-cost handheld spectral sensor integrated with an Arduino Nano 33 BLE microcontroller able to predict the shelf life of fresh fruit at all stages of the fruit ripening process has been experimentally verified for its robustness by validating against lab results. The accuracy of the lightweight regression model for all the treated samples was above 93% for a confidence threshold of 1.5. The reported performance shows that this TinyML sensor can be used as a handheld device for real-time prediction of the shelf life and freshness of the fruit.

5. Future Works

Ensemble Machine learning techniques that accommodate both vision and spectral-based sensors for shelf life estimation, which can cover all perishable food items in the supply chain and benefit a broad category of customers in the supply chain, may be attempted.

Author Contributions

Conceptualization, M.M., R.S., and A.A.; methodology, M.M. and R.S.; software, R.S. and M.M.; validation, M.M., R.S., and A.A.; formal analysis, M.M.; investigation, M.M. and R.S.; resources, R.S., M.M., and A.A.; data curation, M.M. and R.S.; writing—original draft preparation, M.M., R.S., and A.A.; writing—review and editing, M.M., R.S., and A.A.; visualization, M.M.; project administration, R.S., M.M. and A.A.; funding acquisition, R.S., M.M., and A.A. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the Deputyship for Research and Innovation, Ministry of Education in Saudi Arabia [Grant No. INST031].

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data are available upon request from the corresponding author.

Acknowledgments

The authors thank the Deputyship for Research and Innovation, Ministry of Education in Saudi Arabia, for funding this research work (Project number INST031).

Conflicts of Interest

The authors declare no conflict of interest.

Nomenclature

A. U.Arbitrary Unit
AIArtificial Intelligence
ANNArtificial Neural Network
CNNConvolutional Neural Network
DTDecision Trees
ETEnsemble Technique
GIGlycemic Index
IoTInternet of Things
IRInfrared Red
ITSBLERPInference, Training, Scalability, Bandwidth, Latency, Economics, Reliability, and Privacy Characteristics
K-MCK-Means Clustering
K-NNK-Nearest Neighbor
LDALinear Discriminant Analysis
LILifelong Learning (Ll)
LRLinear Regression
LSTMLong Short-Term Memory
MAEMean Absolute Error
MAPModified Atmosphere Packaging
MCMoisture Content
MLMachine Learning
NBNaïve Bayes
NIRNear-Infrared Red
PCAPrincipal Component Analysis
MAPEMean absolute percentage error
RFRandom Forest
RLMReinforcement Learning Models
RMSERoot Mean Square Error
RNNRecurrent Neural Network
SCSugar Content
SSLEDSpectral Shelf Life Estimator For Dates
SVMSupport Vector Machines
SWNIRShort-Wave Near-Infrared
TCTannin Content
TFLMTensor Flow Lite for Microcontrollers
TinyMLTiny Machin Learning
TSSTotal Soluble Solids
waWater Activity
XgboostExtreme Gradient Boosting

References

  1. United Nation Environment Programme Food Waste Index Report 2021. Available online: https://wedocs.unep.org/bitstream/handle/20.500.11822/35280/FoodWaste.pdf (accessed on 1 April 2023).
  2. Chao, C.C.T.; Krueger, R.R. The Date Palm (Phoenix dactylifera L.): Overview of Biology, Uses, and Cultivation. HortScience 2007, 42, 1077–1082. [Google Scholar] [CrossRef] [Green Version]
  3. Dhehibi, B.; Ben Salah, M.; Frija, A. Date Palm Value Chain Analysis and Marketing Opportunities for the Gulf Cooperation Council (GCC) Countries. In Agricultural Economics—Current Issues; Kulshreshtha, S., Ed.; IntechOpen: Rijeka, Croatia, 2019; pp. 11–17. [Google Scholar]
  4. Mirghani, H.O. Dates Fruits Effects on Blood Glucose among Patients with Diabetes Mellitus: A Review and Meta-Analysis. Pak. J. Med. Sci. 2021, 37, 1230–1236. [Google Scholar] [CrossRef] [PubMed]
  5. Alkaabi, J.M.; Al-Dabbagh, B.; Ahmad, S.; Saadi, H.F.; Gariballa, S.; Ghazali, M. Al Glycemic Indices of Five Varieties of Dates in Healthy and Diabetic Subjects. Nutr. J. 2011, 10, 59. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  6. AlGeffari, M.A.; Almogbel, E.S.; Alhomaidan, H.T.; ElMergawi, R.; Barrimah, I.A. Glycemic Indices, Glycemic Load and Glycemic Response for Seventeen Varieties of Dates Grown in Saudi Arabia. Ann. Saudi Med. 2016, 36, 397–403. [Google Scholar] [CrossRef] [Green Version]
  7. Gallagher, M.J.S.J.S.; Mahajan, P.V.V. The Stability and Shelf Life of Fruit and Vegetables. In Food and Beverage Stability and Shelf Life; Kilcast, D., Subramaniam, P., Eds.; Woodhead Publishing: Cambridge, UK, 2011; pp. 641–656. ISBN 9781845697013. [Google Scholar]
  8. Thompson, A.K.A.K. Fruit and Vegetable Storage. In Food, Health and Nutrition; SpringerBriefs in Food, Health, and Nutrition; Springer International Publishing: Cham, Switzerland, 2016; pp. 1–126. ISBN 978-3-319-23590-5. [Google Scholar]
  9. Suriati, L.; Utama, I.M.S.; Harjosuwono, B.A.; Wayan Gunam, I.B. Physicochemical Characteristics of Fresh-Cut Tropical Fruit during Storage. Int. J. Adv. Sci. Eng. Inf. Technol. 2020, 10, 1731–1736. [Google Scholar] [CrossRef]
  10. Giovenzana, V.; Tugnolo, A.; Casson, A.; Guidetti, R.; Beghi, R. Application of Visible-near Infrared Spectroscopy to Evaluate the Quality of Button Mushrooms. J. Near Infrared Spectrosc. 2019, 27, 38–45. [Google Scholar] [CrossRef]
  11. Beghi, R.; Giovenzana, V.; Brancadoro, L.; Guidetti, R. Rapid Evaluation of Grape Phytosanitary Status Directly at the Check Point Station Entering the Winery by Using Visible/near Infrared Spectroscopy. J. Food Eng. 2017, 204, 46–54. [Google Scholar] [CrossRef]
  12. Teena, M.A.; Manickavasagan, A.; Ravikanth, L.; Jayas, D.S. Near Infrared (NIR) Hyperspectral Imaging to Classify Fungal Infected Date Fruits. J. Stored Prod. Res. 2014, 59, 306–313. [Google Scholar] [CrossRef]
  13. Walsh, K.B.; Blasco, J.; Zude-Sasse, M.; Sun, X. Visible-NIR ‘Point’ Spectroscopy in Postharvest Fruit and Vegetable Assessment: The Science behind Three Decades of Commercial Use. Postharvest Biol. Technol. 2020, 168, 111246. [Google Scholar] [CrossRef]
  14. Dutta, J.; Deshpande, P.; Rai, B. AI-Based Soft-Sensor for Shelf Life Prediction of ‘Kesar’ Mango. SN Appl. Sci. 2021, 3, 657. [Google Scholar] [CrossRef]
  15. Pampuri, A.; Tugnolo, A.; Giovenzana, V.; Casson, A.; Pozzoli, C.; Brancadoro, L.; Guidetti, R.; Beghi, R. Application of a Cost-Effective Visible/Near Infrared Optical Prototype for the Measurement of Qualitative Parameters of Chardonnay Grapes. Appl. Sci. 2022, 12, 4853. [Google Scholar] [CrossRef]
  16. Suzuki, M.; Masuda, K.; Asakuma, H.; Takeshita, K.; Baba, K.; Kubo, Y.; Ushijima, K.; Uchida, S.; Akagi, T. Deep Learning Predicts Rapid Over-Softening and Shelf Life in Persimmon Fruits. Hortic. J. 2022, 91, 408–415. [Google Scholar] [CrossRef]
  17. Albert-Weiss, D.; Osman, A. Interactive Deep Learning for Shelf Life Prediction of Muskmelons Based on an Active Learning Approach. Sensors 2022, 22, 414. [Google Scholar] [CrossRef] [PubMed]
  18. Shao, Y.Y.; Wang, Y.X.; Xuan, G.T.; Gao, Z.M.; Liu, Y.; Han, X.; Hu, Z.C. Hyperspectral Imaging Technique for Estimating the Shelf-Life of Kiwifruits. Guang Pu Xue Yu Guang Pu Fen Xi/Spectrosc. Spectr. Anal. 2020, 40, 1940–1946. [Google Scholar]
  19. Basak, J.K.; Madhavi, B.G.K.; Paudel, B.; Kim, N.E.; Kim, H.T. Prediction of Total Soluble Solids and PH of Strawberry Fruits Using RGB, HSV and HSL Colour Spaces and Machine Learning Models. Foods 2022, 11, 2086. [Google Scholar] [CrossRef]
  20. Cao, M.; Wang, D.; Qiu, L.; Ren, X.; Ma, H. Shelf Life Prediction of ‘Royal Gala’ Apples Based on Quality Attributes and Storage Temperature. Hortic. Sci. Technol. 2021, 39, 343–355. [Google Scholar] [CrossRef]
  21. Mohd Ali, M.; Hashim, N.; Abd Aziz, S.; Lasekan, O. Shelf Life Prediction and Kinetics of Quality Changes in Pineapple (Ananas Comosus) Varieties at Different Storage Temperatures. Horticulturae 2022, 8, 992. [Google Scholar] [CrossRef]
  22. Albarrak, K.; Gulzar, Y.; Hamid, Y.; Mehmood, A.; Soomro, A.B. A Deep Learning-Based Model for Date Fruit Classification. Sustainability 2022, 14, 6339. [Google Scholar] [CrossRef]
  23. Bhole, V.; Kumar, A. A Transfer Learning-Based Approach to Predict the Shelf Life of Fruit. Intel. Artif. 2021, 24, 102–120. [Google Scholar] [CrossRef]
  24. Altaheri, H.; Alsulaiman, M.; Muhammad, G.; Amin, S.U.; Bencherif, M.; Mekhtiche, M. Date Fruit Dataset for Intelligent Harvesting. Data Brief 2019, 26, 104514. [Google Scholar] [CrossRef] [PubMed]
  25. Faisal, M.; Albogamy, F.; Elgibreen, H.; Algabri, M.; Alqershi, F.A. Deep Learning and Computer Vision for Estimating Date Fruits Type, Maturity Level, and Weight. IEEE Access 2020, 8, 206770–206782. [Google Scholar] [CrossRef]
  26. Faisal, M.; Alsulaiman, M.; Arafah, M.; Mekhtiche, M.A. IHDS: Intelligent Harvesting Decision System for Date Fruit Based on Maturity Stage Using Deep Learning and Computer Vision. IEEE Access 2020, 8, 167985–167997. [Google Scholar] [CrossRef]
  27. Nasiri, A.; Taheri-Garavand, A.; Zhang, Y.-D. Image-Based Deep Learning Automated Sorting of Date Fruit. Postharvest Biol. Technol. 2019, 153, 133–141. [Google Scholar] [CrossRef]
  28. Iorliam, I.B.; Ikyo, B.A.; Iorliam, A.; Okube, E.O.; Kwaghtyo, K.D.; Shehu, Y.I. Application of Machine Learning Techniques for Okra Shelf Life Prediction. J. Data Anal. Inf. Process. 2021, 9, 136–150. [Google Scholar] [CrossRef]
  29. Muhammad, G. Date Fruits Classification Using Texture Descriptors and Shape-Size Features. Eng. Appl. Artif. Intell. 2015, 37, 361–367. [Google Scholar] [CrossRef]
  30. Hymel, S.; Banbury, C.; Situnayake, D.; Elium, A.; Ward, C.; Kelcey, M.; Baaijens, M.; Majchrzycki, M.; Plunkett, J.; Tischler, D.; et al. Edge Impulse: An MLOps Platform for Tiny Machine Learning. arXiv 2022, arXiv:2212.03332. [Google Scholar] [CrossRef]
  31. Janapa Reddi, V.; Plancher, B.; Kennedy, S.; Moroney, L.; Warden, P.; Suzuki, L.; Agarwal, A.; Banbury, C.; Banzi, M.; Bennett, M.; et al. Widening Access to Applied Machine Learning with TinyML. Harvard Data Sci. Rev. 2022, 4, 1–38. [Google Scholar] [CrossRef]
  32. Yahia, E.M.; Lobo, M.G.; Kader, A.A. Harvesting and Postharvest Technology of Dates. In Dates: Postharvest Science, Processing Technology and Health Benefits; John Wiley & Sons Ltd.: Chichester, UK, 2013; pp. 105–135. ISBN 9781118292419. [Google Scholar]
  33. Mohammed, M.; Sallam, A.; Alqahtani, N.; Munir, M. The Combined Effects of Precision-Controlled Temperature and Relative Humidity on Artificial Ripening and Quality of Date Fruit. Foods 2021, 10, 2636. [Google Scholar] [CrossRef]
  34. Al-Mentafji, H.N. AOAC Official Methods of Analysis of AOAC, 18th ed.; AOAC International: Washington, DC, USA, 2005. [Google Scholar]
  35. Mohammed, M.; El-Shafie, H.; Munir, M. Development and Validation of Innovative Machine Learning Models for Predicting Date Palm Mite Infestation on Fruits. Agronomy 2023, 13, 494. [Google Scholar] [CrossRef]
  36. Mohammed, M.; Munir, M.; Aljabr, A. Prediction of Date Fruit Quality Attributes during Cold Storage Based on Their Electrical Properties Using Artificial Neural Networks Models. Foods 2022, 11, 1666. [Google Scholar] [CrossRef]
  37. AMS-OSRAM Datasheet. Available online: https://ams-osram.com/support/technical-support-form (accessed on 18 June 2023).
  38. Meshram, V.; Patil, K.; Meshram, V.; Hanchate, D.; Ramkteke, S.D. Machine Learning in Agriculture Domain: A State-of-Art Survey. Artif. Intell. Life Sci. 2021, 1, 100010. [Google Scholar] [CrossRef]
  39. Mohammed, M.; Hamdoun, H.; Sagheer, A. Toward Sustainable Farming: Implementing Artificial Intelligence to Predict Optimum Water and Energy Requirements for Sensor-Based Micro Irrigation Systems Powered by Solar PV. Agronomy 2023, 13, 1081. [Google Scholar] [CrossRef]
  40. Kumar, N.; Dahiya, A.K.; Kumar, K.; Tanwar, S. Application of IoT in Agriculture. In Proceedings of the 2021 9th International Conference on Reliability, Infocom Technologies and Optimization (Trends and Future Directions) (ICRITO), Noida, India, 3–4 September 2021; pp. 1–4. [Google Scholar]
  41. Ejaz, N.; Elhag, M.; Bahrawi, J.; Zhang, L.; Gabriel, H.F.; Rahman, K.U. Soil Erosion Modelling and Accumulation Using RUSLE and Remote Sensing Techniques: Case Study Wadi Baysh, Kingdom of Saudi Arabia. Sustainability 2023, 15, 3218. [Google Scholar] [CrossRef]
  42. Lavanya, G.; Rani, C.; Ganeshkumar, P. An Automated Low Cost IoT Based Fertilizer Intimation System for Smart Agriculture. Sustain. Comput. Inform. Syst. 2020, 28, 100300. [Google Scholar] [CrossRef]
  43. Garcia Furuya, D.E.; Ma, L.; Faita Pinheiro, M.M.; Georges Gomes, F.D.; Gonçalvez, W.N.; Junior, J.M.; de Castro Rodrigues, D.; Blassioli-Moraes, M.C.; Furtado Michereff, M.F.; Borges, M.; et al. Prediction of Insect-Herbivory-Damage and Insect-Type Attack in Maize Plants Using Hyperspectral Data. Int. J. Appl. Earth Obs. Geoinf. 2021, 105, 102608. [Google Scholar] [CrossRef]
  44. Yu, X.; Wang, Y.; Wu, L.; Chen, G.; Wang, L.; Qin, H. Comparison of Support Vector Regression and Extreme Gradient Boosting for Decomposition-Based Data-Driven 10-Day Streamflow Forecasting. J. Hydrol. 2020, 582, 124293. [Google Scholar] [CrossRef]
  45. Ramazi, P.; Kunegel-Lion, M.; Greiner, R.; Lewis, M.A. Predicting Insect Outbreaks Using Machine Learning: A Mountain Pine Beetle Case Study. Ecol. Evol. 2021, 11, 13014–13028. [Google Scholar] [CrossRef]
  46. Mohammed, M.; Munir, M.; Ghazzawy, H.S. Design and Evaluation of a Smart Ex Vitro Acclimatization System for Tissue Culture Plantlets. Agronomy 2022, 13, 78. [Google Scholar] [CrossRef]
  47. Mohammed, M.; Alqahtani, N.K. Design and Validation of Automated Sensor-Based Artificial Ripening System Combined with Ultrasound Pretreatment for Date Fruits. Agronomy 2022, 12, 2805. [Google Scholar] [CrossRef]
  48. Guillén, M.A.; Llanes, A.; Imbernón, B.; Martínez-España, R.; Bueno-Crespo, A.; Cano, J.C.; Cecilia, J.M. Performance Evaluation of Edge-Computing Platforms for the Prediction of Low Temperatures in Agriculture Using Deep Learning. J. Supercomput. 2021, 77, 818–840. [Google Scholar] [CrossRef]
  49. Bian, H.X.; Tu, P.; Hua-li, X.; Shi, P. Quality Predictions for Bruised Apples Based on Dielectric Properties. J. Food Process. Preserv. 2019, 43, e14006. [Google Scholar] [CrossRef]
  50. El-Shafie, H.; Mohammed, M.; Alqahtani, N. A Preliminary Study on Flight Characteristics of the Longhorn Date Palm Stem Borer Jebusaea Hammerschmidtii (Reiche 1878) (Coleoptera: Cerambycidae) Using a Computerized Flight Mill. Agriculture 2022, 12, 120. [Google Scholar] [CrossRef]
  51. Sagheer, A.; Kotb, M. Unsupervised Pre-Training of a Deep LSTM-Based Stacked Autoencoder for Multivariate Time Series Forecasting Problems. Sci. Rep. 2019, 9, 19038. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  52. Kashyap, P.K.; Kumar, S.; Jaiswal, A.; Prasad, M.; Gandomi, A.H. Towards Precision Agriculture: IoT-Enabled Intelligent Irrigation Systems Using Deep Learning Neural Network. IEEE Sens. J. 2021, 21, 17479–17491. [Google Scholar] [CrossRef]
  53. Mohammed, M.; Riad, K.; Alqahtani, N. Design of a Smart IoT-Based Control System for Remotely Managing Cold Storage Facilities. Sensors 2022, 22, 4680. [Google Scholar] [CrossRef] [PubMed]
  54. Eltawil, M.A.; Mohammed, M.; Alqahtani, N.M. Developing Machine Learning-Based Intelligent Control System for Performance Optimization of Solar PV-Powered Refrigerators. Sustainability 2023, 15, 6911. [Google Scholar] [CrossRef]
  55. Kapoor, A. Hands-On Artificial Intelligence for IoT: Expert Machine Learning and Deep Learning Techniques for Developing Smarter IoT Systems; Packt Publishing Ltd.: Birmingham, UK, 2019. [Google Scholar]
  56. Saha, D.; Manickavasagan, A. Machine Learning Techniques for Analysis of Hyperspectral Images to Determine Quality of Food Products: A Review. Curr. Res. Food Sci. 2021, 4, 28–44. [Google Scholar] [CrossRef] [PubMed]
  57. Wang, M.; Xu, Y.; Yang, Y.; Mu, B.; Nikitina, M.A.; Xiao, X. Vis/NIR Optical Biosensors Applications for Fruit Monitoring. Biosens. Bioelectron. X 2022, 11, 100197. [Google Scholar] [CrossRef]
  58. Jagtap, A.D.; Kawaguchi, K.; Karniadakis, G.E. Adaptive Activation Functions Accelerate Convergence in Deep and Physics-Informed Neural Networks. J. Comput. Phys. 2020, 404, 109136. [Google Scholar] [CrossRef] [Green Version]
Figure 1. The responsivity of AS7265x—18-channel optical sensor [37].
Figure 1. The responsivity of AS7265x—18-channel optical sensor [37].
Sensors 23 07081 g001
Figure 2. Methodology flow for the proposed shelf life estimation.
Figure 2. Methodology flow for the proposed shelf life estimation.
Sensors 23 07081 g002
Figure 3. The supply chain of fresh dates.
Figure 3. The supply chain of fresh dates.
Sensors 23 07081 g003
Figure 4. TinyML model workflow.
Figure 4. TinyML model workflow.
Sensors 23 07081 g004
Figure 5. Block diagram of spectral shelf life estimator for dates (SSLED).
Figure 5. Block diagram of spectral shelf life estimator for dates (SSLED).
Sensors 23 07081 g005
Figure 6. Connection schematic between spectral sensor and Arduino.
Figure 6. Connection schematic between spectral sensor and Arduino.
Sensors 23 07081 g006
Figure 7. TinyML-based spectral shelf life estimator for dates (SSLED) neural network architecture.
Figure 7. TinyML-based spectral shelf life estimator for dates (SSLED) neural network architecture.
Sensors 23 07081 g007
Figure 8. Reflected photon count versus wavelengths for three maturation stages of fruit.
Figure 8. Reflected photon count versus wavelengths for three maturation stages of fruit.
Sensors 23 07081 g008
Figure 9. Reflectance ratio for moisture content for various treatments vs. shelf life in # days.
Figure 9. Reflectance ratio for moisture content for various treatments vs. shelf life in # days.
Sensors 23 07081 g009
Figure 10. Cumulative reflectance value from the spectral sensor of five major attributes vs. shelf life in # days.
Figure 10. Cumulative reflectance value from the spectral sensor of five major attributes vs. shelf life in # days.
Sensors 23 07081 g010
Figure 11. Sensitivity analysis for hyperparameters (momentum, batch size, and layer numbers).
Figure 11. Sensitivity analysis for hyperparameters (momentum, batch size, and layer numbers).
Sensors 23 07081 g011
Figure 12. Model accuracy with activation function (A) and model accuracy without activation function (B).
Figure 12. Model accuracy with activation function (A) and model accuracy without activation function (B).
Sensors 23 07081 g012
Figure 13. Model accuracy for treated samples for various confidence thresholds.
Figure 13. Model accuracy for treated samples for various confidence thresholds.
Sensors 23 07081 g013
Figure 14. Data visualization plots covering four treated samples kept at cold storage room (5 °C) and at normal temperature (room temperature 24 °C). (A) unsealed at 5 °C, (B) unsealed at 24 °C, (C) MAP1 at 5 °C, (D) MAP1 at 24 °C, (E) MAP2 at 5 °C, (F) MAP2 at 24 °C, (G) VSB at 5 °C, and (H) VSB at 24 °C.
Figure 14. Data visualization plots covering four treated samples kept at cold storage room (5 °C) and at normal temperature (room temperature 24 °C). (A) unsealed at 5 °C, (B) unsealed at 24 °C, (C) MAP1 at 5 °C, (D) MAP1 at 24 °C, (E) MAP2 at 5 °C, (F) MAP2 at 24 °C, (G) VSB at 5 °C, and (H) VSB at 24 °C.
Sensors 23 07081 g014
Figure 15. Live classification results for sample from unsealed tray kept at room temperature.
Figure 15. Live classification results for sample from unsealed tray kept at room temperature.
Sensors 23 07081 g015
Figure 16. Model test results for all treated samples when confidence threshold was set to 1.5: (green blobs are correct; red ones are incorrect prediction). (A) unsealed at 5 °C, (B) unsealed at 24 °C, (C) MAP1 at 5 °C, (D) MAP1 at 24 °C, (E) MAP2 at 5 °C, (F) MAP2 at 24 °C, (G) VSB at 5 °C, and (H) VSB at 24 °C.
Figure 16. Model test results for all treated samples when confidence threshold was set to 1.5: (green blobs are correct; red ones are incorrect prediction). (A) unsealed at 5 °C, (B) unsealed at 24 °C, (C) MAP1 at 5 °C, (D) MAP1 at 24 °C, (E) MAP2 at 5 °C, (F) MAP2 at 24 °C, (G) VSB at 5 °C, and (H) VSB at 24 °C.
Sensors 23 07081 g016
Figure 17. Model test results for unsealed samples at cold storage (5 °C).
Figure 17. Model test results for unsealed samples at cold storage (5 °C).
Sensors 23 07081 g017
Figure 18. Model test results for unsealed samples at room temperature.
Figure 18. Model test results for unsealed samples at room temperature.
Sensors 23 07081 g018
Figure 19. Training and validation accuracy and loss curves for VSB samples at room temperature.
Figure 19. Training and validation accuracy and loss curves for VSB samples at room temperature.
Sensors 23 07081 g019
Table 1. Multiband spectral sensor wavelengths.
Table 1. Multiband spectral sensor wavelengths.
SensorsWavelengths
AS72653410 435 460 485 510 535
AS72652560 585 645 705 900 940
AS72651610 680 730 760 810 860
Table 2. Agricultural activity and AI model chart.
Table 2. Agricultural activity and AI model chart.
TaskActivitiesModels
Preharvest
(Health of Crop)
Soil, seed quality, fertilizer/pesticide application, pruning, cultivar selection, genetic and environmental conditions, irrigation, crop load, weed detection, and disease detection.Artificial Neural Network (ANN), Fuzzy
logic, decision trees, Naïve Bayes, k-means clustering, support vector machines (SVM), random forest (RF), k-Nearest Neighbor (k-NN), and XGBoost, Ensemble technique [35,39,40,41,42,43,44,45,46].
HarvestingFruit/crop size, skin color, firmness, taste, quality, maturity stage, market window, fruit detection, and classification.Convolutional neural network (CNN), Resnet, Mobilenet, Densenet, long-short-term memory (LSTM), Recurrent Neural Network (RNN), Alexnet, LeNet, Linear Discriminant Analysis (LDA), and Principal Component Analysis (PCA) [12,16,22,23,25,27,36,39,47,48,49]
Post HarvestingFactors affecting the fruit shelf-life include temperature, humidity, moisture conditions, gasses used in fruit containers, usage of chemicals in postharvest and fruit handling processes to retain quality, and fruit grading as per quality.Linear Regression (LR), RNN, LSTM. Reinforcement Learning Models [47,50,51,52,53,54,55].
Table 3. Computing Decision Parameters.
Table 3. Computing Decision Parameters.
ParametersCloud AI ComputingEdge AI Computing
Inference time--++
Training time++--
Scalability+++
Bandwidth--++
Latency--+++
Economics-++
Reliability-++
Privacy---+++
+/- represent the favorable or not-so-favorable choice. Most of the Food and Agriculture chain activities favor Edge AI computing except for training.
Table 4. Attributes of dates during ripening stages.
Table 4. Attributes of dates during ripening stages.
Maturity Stage of Date FruitThe Mean Value of Major Attributes of Dates
pHTSS (Brix)Sugar (%)MC (%)Tannin (%)
Khalal5.3024.8624.9671.476.19
Rutab6.1551.2952.0246.541.05
Tamr6.6460.5863.3516.940.3
Table 5. Wavelength table for attributes of fresh fruit.
Table 5. Wavelength table for attributes of fresh fruit.
Major AttributeWavelength in nm
NumberTerminology/Name
1MC-SWNIR535, 705, 940
2pH-SWNIR510, 680, 900
3Sugar-SWNIR460, 645, 810
4Tan-SWNIR560, 585, 610
5TSS-SWNIR410, 560, 730
Table 6. Labeled dataset for untreated sample (control) at 5 °C.
Table 6. Labeled dataset for untreated sample (control) at 5 °C.
MC-SWNIRpH-SWNIRTSS-SWNIRSugar-SWNIRTan-SWNIRShelflife
10872807877974300
10652827978074171
10432858088174032
10212878198273883
9992898298373764
9772928408473605
9552948508573496
9332978618673337
9112998728773228
8893028828873059
86730489389729310
84530790390727711
82330991491725912
80131292492724313
77931493593723114
Table 7. Model parameter for NN Block.
Table 7. Model parameter for NN Block.
ParametersSpecifications
Model TypeSequential
Input layer15 major features + 3 (Vacuum, MAP2, MAP1)
First level Hidden Dense layer20 neurons
Second level Hidden Dense Layer10 neurons
Dropout rate0.2
Output Layer1 neuron (Y-Predicted, no activation function)
Learning Rate0.005
Activation function for all layersReLu
Batch Size32
Epochs100
OptimizerAdam
Loss functionMSE (Mean Squared Error)
Number of Training Cycles100
TreatmentsVSB (5)VSB (24)MAP2(5)MAP2(24)MAP1(5)MAP1(2)Unsealed (5)Unsealed (24)
Training
Dataset
(80%)
960706706448416272240120
Testing and
Validation
Dataset (20%)
240178178112104686030
Table 8. Evaluation of the prediction accuracy for the TinyML model.
Table 8. Evaluation of the prediction accuracy for the TinyML model.
Packing TypeTemperatureThreshold
Metrics11.251.51.752
VSB5MAPE89.3996.697.8798.398.3
RMSE0.390.390.390.390.39
24MAPE96.6596.6599.44100100
RMSE0.230.230.230.230.23
MAP25MAPE85.897.73100100100
RMSE0.390.390.390.390.39
24MAPE97.13100100100100
RMSE0.150.150.150.150.15
MAP15MAPE83.6590.3896.1596.1596.15
RMSE0.610.610.610.610.61
24MAPE76.488.292.1894.1696.12
RMSE0.680.680.680.680.68
Unsealed5MAPE75.284.6792.7694.195.2
RMSE0.690.690.690.690.69
24MAPE86.3693.1893.1895.45100
RMSE0.650.650.650.650.65
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

Srinivasagan, R.; Mohammed, M.; Alzahrani, A. TinyML-Sensor for Shelf Life Estimation of Fresh Date Fruits. Sensors 2023, 23, 7081. https://doi.org/10.3390/s23167081

AMA Style

Srinivasagan R, Mohammed M, Alzahrani A. TinyML-Sensor for Shelf Life Estimation of Fresh Date Fruits. Sensors. 2023; 23(16):7081. https://doi.org/10.3390/s23167081

Chicago/Turabian Style

Srinivasagan, Ramasamy, Maged Mohammed, and Ali Alzahrani. 2023. "TinyML-Sensor for Shelf Life Estimation of Fresh Date Fruits" Sensors 23, no. 16: 7081. https://doi.org/10.3390/s23167081

APA Style

Srinivasagan, R., Mohammed, M., & Alzahrani, A. (2023). TinyML-Sensor for Shelf Life Estimation of Fresh Date Fruits. Sensors, 23(16), 7081. https://doi.org/10.3390/s23167081

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