PREPARATION OF SAMPLE AND METHODOLOGY
The experimental setup, as illustrated in Figure.3(a), is employed to evaluate the storage conditions of fresh fruits and vegetables. Fresh produce is acquired from the local market, washed, and sampled for a day. Subsequently, they are stored in cardboard boxes measuring 2.5 x 1.4 x 2.5 meters at room temperature (RT) of 20–25°C. For longer storage, they are placed in a refrigerator at a low temperature (LT) of 5–6°C, as specified in Table 3.Multiple sensor nodes (Temperature, Humidity, pH, Air quality) are strategically positioned within the storage containers to ensure comprehensive coverage of perishable items. These sensors are placed at different locations to capture variations in storage conditions. They continuously measure and record environmental parameters at regular one-second intervals, as illustrated in Figure.3(b). Specific threshold values, shown in Table 4, are utilized. If any of the conditioned parameters deviates from the threshold value, the system identifies and forecasts the state of rotting conditions for fruits and vegetables.The experiment spans a duration of 30 days. The collected data is stored in the CC3200 LAUNCHXL controller unit and displayed throughout transportation via a communication port to the PC or mobile user. Finally, the collected data is wirelessly transmitted in real-time to the cloud-based data analytics platform.After the 30-day period concludes, the dataset obtained from the sensors is used to both train and test the machine learning model. The primary goal of the model is to examine the correlation between environmental factors (pH, humidity, air quality, and temperature), as shown in Figure. 6(b), and potentially predict future variations or outcomes based on these parameters. Various evaluation metrics, including accuracy, precision, recall, F1-score, sensitivity, and specificity, are employed to measure the machine learning-based model's performance.Conducting this experiment and applying the machine learning algorithm can yield valuable insights into the interactions and influences of different environmental factors under varying temperature conditions. The selected materials and methodologies in the experimental configuration for the storage condition assessment system facilitate a thorough assessment of its effectiveness and potential influence.
Table 3
Experimental observation for storage
| Storage duration |
Temperature | 1 Day | 10 Days | 20 Days | 30 days |
Low Temperature (5–6) °C | 5.18 ± 1 | 5.73 ± 1 | 5.50 ± 1 | 5.21 ± 1 |
Room Temperature (20–25) °C | 21.09 ± 2 | 23.83 ± 2 | 21.64 ± 2 | 24.43 ± 2 |
Table 4
Experimental design for threshold value of good fruits and vegetable
S.No | Fruits/Vegetables | Temperature(°C) | Relative Humidity(%) | pH level | Air Quality (PPM) |
1 | Apple | 32 | 90–95 | 3.30-4.00 | 101–150 |
2 | Cabbage | 32 | 90–95 | 5.2–6.8 | 101–150 |
3 | Carrot | 32 | 90–95 | 5.8–6.4 | 101–150 |
4 | Cauliflower | 32 | 90–95 | 5.6–6.8 | 101–150 |
5 | Dry Beans | 32–50 | 65–70 | 5.1–6.02 | 101–150 |
6 | Garlic | 32 | 65–70 | 5.5–5.80 | 101–150 |
7 | Pears | 32 | 90–95 | 3.5–4.6 | 101–150 |
8 | Onion | 32 | 65–70 | 5.3–5.8 | 101–150 |
9 | Potato | 38–40 | 90–95 | 5.10–5.7 | 101–150 |
10 | Pumpkin | 50–55 | 70–75 | 4.9–5.5 | 101–150 |
11 | Tomato | 55–60 | 85–90 | 4.3–4.9 | 101–150 |
12 | Beets | 32 | 90–95 | 04-May | 101–150 |
13 | Broccoli | 32 | 90–95 | 6.3–6.8 | 101–150 |
14 | cucumbers | 32 | 90–95 | 5.1–5.7 | 101–150 |
15 | Grapes | 32 | 80–90 | 2.9–3.8 | 101–150 |
16 | Kiwifruits | 32 | 90–95 | 3.1–3.9 | 101–150 |
17 | Orange | 32 | 85–90 | 3.3–4.2 | 101–150 |
18 | Watermelon | 40–50 | 80–85 | 5.2–5.8 | 101–150 |
MODEL DEVELOPMENT AND MATHEMATICAL ANALYSIS FOR FRUITS AND VEGETABLE FRESHNESS
Designing and analyzing a storage conditions assessment model encompasses several pivotal steps. These include data collection, selecting an appropriate machine learning model, developing and training the model, performance evaluation, freshness prediction, mathematical analysis, results validation, and ultimately, enhancing supply chain management for fruits and vegetables.
Data collection and Analysis
Data is collected through the received output from the sensor node. The collected data spans a 30-day period and is processed using Microsoft Office Excel 2019 (Microsoft Corporation, USA). TensorFlow is employed for building, training, and deploying machine learning models, while simulations are performed using Python Generators.
Machine Learning: Machine learning refers to the ability of computer systems to autonomously learn from experiences without explicit programming. This research employs four machine learning algorithms: Support Vector Machine (SVM), Decision Tree, Logistic Regression, and K-Nearest Neighbor (KNN) algorithms. The output database generated by different sensors serves as the training data.A trained database is created for classifications based on storage parameters, as illustrated in the training set scatter plot in Fig. 9(a) and 9(b). After establishing the trained database, the output database undergoes testing to assess the storage conditions.To evaluate performance metrics, including accuracy, precision, recall, F1-score, and ROC-AUC score, the number of accurate predictions of a model is determined by accuracy. Precision counts the positive predictions that were actually correct. The F1-score is a comprehensive measurement that combines recall and precision, calculating the proportion of true positives out of all actual positives (recall) and out of all predicted positives (precision) using the harmonic mean of these two variables.In addition, the ROC-AUC score gauges the model's ability to differentiate between positive and negative classes. Sensitivity measures the true positive rate or the portion of true positives correctly identified, while specificity, the true negative rate, represents the percentage of true negatives accurately detected.The calculations are determined as follows:
Sensitivity or TPR = TP / (TP + FN)
Specificity or SPC = TN / (FP + TN)
Precision or PPV = TP / (TP + FP)
Accuracy or ACC = (TP + TN) / (P + N)
F1 Score or F1 = 2TP / (2TP + FP + FN)
Where TP- True positive, TN-True Negative, FP- False positive, FN- False negative, P-Positive, N-Negative.
Mathematical Analysis: The mathematical analysis encompasses multiple stages with the goal of categorizing fruits and vegetables into two classes: "Good" (fresh and safe for consumption) and "Rot off" (beginning to decay and unsuitable for consumption). The algorithm underwent training using data from 18 different types of fruits and vegetables, relying on sensor data collected from them every hour for a day, which was stored in a database. Volunteer experiments were conducted over 30 days to validate the algorithm's effectiveness.Based on the sensor output, a mathematical model has been developed for the quality assessment of fruits and vegetables, distinguishing between those that are "Good" and those that are "Rot off." To achieve this, we estimated the sensor data into mean (µ) and variance (σ).
$$\mu =\frac{1}{{N}_{t}}\sum _{n=1}^{{N}_{t}}{X}_{n}$$
1
$$\sigma =\frac{1}{{\text{N}}_{\text{t}}}\sum _{\text{n}=1}^{{\text{N}}_{\text{t}}}{({ \text{X}}_{\text{n}}-\mu )}^{2}$$
2
Where,\({N}_{t}\) = Total reading is taken by individual sensor
Let \({\mu }_{temp}\& {\sigma }_{temp}\) are the mean and variance of the temperature sensor
\({\mu }_{H}\& {\sigma }_{H}\) are the mean and variance of the relative humidity sensor
\({\mu }_{pH}\& {\sigma }_{pH}\) are the mean and variance of pH sensor
\({\mu }_{AQ}\& {\sigma }_{AQ}\) are the mean and variance of air quality sensor
We assume equal probabilities for fruits and vegetables being in good condition or having started to rot, which is P(good) = P(rot off) = 0.5. According to the Gaussian distribution, continuous values are associated with each class of distributed value. So, we can calculate the probability P for each sensor parameter with respect to good fruits and vegetables.. Hence, the probability P will be:
P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{t}\text{e}\text{m}\text{p}}\) |Good)= \(\frac{1}{{\sqrt {2\pi {\sigma _{temp}}} }}e\left( {\frac{{( - {{(Sampl{e_{temp}} - {\mu _{temp}})}^2}}}{{2{\sigma _{temp}}}}} \right)\) (3)
Where P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{t}\text{e}\text{m}\text{p}}\) |Good) = probability of temperature parameter of a sample of good fruits and vegetables.
Similarly, we calculate the probability, P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{H}}\) |Good) = for humidity parameter.
P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{p}\text{H}}\) |Good) = for pH parameter & P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{A}\text{Q}}\) |Good) = air quality parameter of a sample of good fruits and vegetables.
By using maximum posterior probability (MAP), we can estimate the probability of good fruits and vegetables concerning sample, i.e.;
P(Good|Sample) = P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{t}\text{e}\text{m}\text{p}}\)|Good) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{H}}\)|Good) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{p}\text{H}}\) |Good) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{A}\text{Q}}\) |Good) (4)
Where P(Good|Sample) = Probability of sample of good fruits and vegetables. Similarly,
P(Rot off |Sample) = P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{t}\text{e}\text{m}\text{p}}\) | Rot off ) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{H}}\) |Rot off) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{p}\text{H}}\) | rot off) x P(\({\text{S}\text{a}\text{m}\text{p}\text{l}\text{e}}_{\text{A}\text{Q}}\) | rot off) (5)
Where P(Rot off |Sample) = probability of sample of rot off fruits and vegetables.
Now we check whether fruits and vegetables are good or rot off
If P(Good|Sample) > P(Rot off |Sample), then the fruits and vegetables are good conditions otherwise, to have started to rot.