3.1 Image feature extraction
The purpose of this study was to improve the detection of yam quality using computer vision in the context of Internet of Things (IoT) and robotics applications. To achieve this goal, the study utilized computer vision techniques to analyze and develop computer codes for deployment using various features from images of yams. These features were then used to categorize the yams into different quality classes.
The extracted features for the yam images, along with their corresponding quality classes, are presented in Table S1 (included as a supplementary document). These features include the Red, Green, Blue, and Grey scale pixel values, as well as the width and height of the yam images.
The study found that yams classified as "Good" had higher pixel values for Red, Green, Blue, and Grey scale compared to those classified as "Diseased" or "Insect Infected." This suggests that healthy yams tend to have more intense coloration and higher grey scale values, while yams with diseases or insect infestations have lower pixel values, indicating a loss of color intensity.
Moreover, the research observed that the width and height of the yam images for the "Good" quality class were generally larger than those of the "Diseased" and "Insect Infected" classes. This finding suggests that larger yams are more likely to be of better quality, while smaller yams may be more susceptible to diseases or insect attacks.
Additionally, during the analysis of the extracted features, it was noticed that there is some overlap in the feature values between the different quality classes, which could lead to misclassifications. This underscores the significance of refining the classification algorithm further and including more diverse and informative features to enhance accuracy.
3.2 Development of yam tuber detection codes for deployment to IoT devices
3.2.1 Machine Learning Algorithm Selection
. In this section, the research presents the results of evaluating different machine learning algorithms to develop yam tuber detection codes for IoT devices. Now, each algorithm's performance was assessed based on accuracy, prediction speed, training time, and the use of Principal Component Analysis (PCA) for dimensionality reduction.
Table 1 displays the test results for various machine learning algorithms, their respective classifier algorithm settings, and the performance metrics obtained during evaluation.
The study evaluated decision trees, linear discriminant analysis, quadratic discriminant analysis, support vector machines (SVM), kernel nearest neighbor (KNN), boosted trees, subspace discriminant, and RUSBoosted trees. Each algorithm underwent specific settings and parameter tests to determine its suitability for yam tuber detection.
Among the decision tree algorithms, the "Simple Tree" achieved the highest accuracy of 96.7%, closely followed by the "Complex Tree" and "Medium Tree" with 95% accuracy. Decision trees showed computational efficiency, with prediction speeds ranging from 1300 to 2000 observations per second. The training times for decision trees were relatively low, with the "Simple Tree" requiring only 1.065 seconds.
Linear discriminant analysis and quadratic discriminant analysis both demonstrated an accuracy of 95%, showing their effectiveness in yam tuber detection. However, linear discriminant analysis performed better in terms of prediction speed, requiring only 720 observations per second, while quadratic discriminant analysis achieved 1300 observations per second.
The study also evaluated support vector machines (SVM) with different kernel functions. The "Medium Gaussian SVM" and "Linear SVM" achieved the highest accuracy of 96.7%, while other SVM variants achieved accuracies ranging from 83.3% to 95%. The "Medium Gaussian SVM" demonstrated the fastest prediction speed, processing 1700 observations per second. The training times for SVM algorithms were relatively low, with the "Medium Gaussian SVM" requiring only 0.776 seconds.
Kernel nearest neighbor (KNN) algorithms were tested with different distance metrics. The "Cubic KNN" outperformed other KNN variants, achieving an accuracy of 96.7%. The "Medium KNN" followed closely with an accuracy of 96.7%. KNN algorithms generally showed fast prediction speeds, with the "Medium KNN" processing 1700 observations per second. The training times for KNN were also low, with the "Medium KNN" requiring only 0.661 seconds.
Boosted trees, bagged trees, subspace discriminant, and RUSBoosted trees achieved accuracies of 93% to 95%, showcasing their effectiveness for yam tuber detection. Boosted trees demonstrated relatively fast prediction speeds and training times, making them suitable candidates for deployment on IoT devices.
Additionally, Principal Component Analysis (PCA) was used to reduce the dimensionality of the feature space. PCA effectively preserved essential variance while reducing computational complexity. Notably, PCA with the "Simple Tree" algorithm resulted in a slightly reduced accuracy of 95% compared to the original 96.7%, indicating a minimal loss of information during the dimensionality reduction process.
The evaluation of different machine learning algorithms for yam tuber detection revealed several viable options with high accuracy and fast processing speeds. The Simple Tree, Linear SVM, Medium Gaussian SVM, Medium KNN, and Cubic KNN achieved the highest accuracy of 96.7%. Also, the use of Principal Component Analysis (PCA) proved beneficial in reducing dimensionality without significant loss of accuracy. These findings provide a foundation for developing efficient and accurate yam tuber detection codes suitable for IoT devices with limited resources. This will enable real-time quality assessment and enhance overall productivity in the yam industry.
Several studies have explored the use of machine learning algorithms for detecting and classifying tubers. For instance, a study on intelligent determination of potato and sweet potato quality using imaging spectroscopy and machine learning found that the Random Forest algorithm achieved the highest accuracy of 96.7% (Su & Xue, 2021). Another study on predicting end-of-season tuber yield and tuber set in potatoes using UAV-based hyperspectral imagery and machine learning found that the Random Forest algorithm achieved an accuracy of 91.9% (Sun et al. 2020). These results are comparable to our yam tuber detection study, which found that the Simple Tree, Linear SVM, Medium Gaussian SVM, Medium KNN, and Cubic KNN achieved the highest accuracy of 96.7%. The use of Principal Component Analysis (PCA) for dimensionality reduction was also found to be effective in both studies, reducing computational complexity without significant loss of accuracy (Sun et al. 2020; Su & Xue, 2021; Audu et al., 2023).
Table 1: Test for different machine learning algorithms performance
S/N
|
Machine learning Algorithm
|
Classifier Algorithm Setting
|
Accuracy (%)
|
Prediction speed (obs/sec)
|
Training Time (secs)
|
Principal component Analysis (PCA)
|
1
|
Complex Tree
|
Gini's diversity index
|
95.000
|
750
|
10.608
|
PCA is keeping enough components to explain 95% variance.
|
2
|
Medium Tree
|
Gini's diversity index
|
95.000
|
1300
|
1.248
|
3
|
Simple Tree
|
Gini's diversity index
|
96.700
|
2000
|
1.065
|
4
|
Linear Discriminant
|
Diagonal covariance
|
95.000
|
720
|
2.066
|
5
|
Quadratic Discriminant
|
Diagonal covariance
|
95.000
|
1300
|
1.182
|
6
|
*Linear SVM
|
Kernel function
|
96.700
|
360
|
5.722
|
7
|
Quadratic SVM
|
Kernel function
|
95.000
|
1300
|
1.295
|
8
|
Cubic SVM
|
Kernel function
|
83.300
|
1600
|
9.509
|
9
|
Fine Gaussian SVM
|
Kernel function
|
95.000
|
1800
|
0.919
|
10
|
*Medium Gaussian SVM
|
Kernel function
|
96.700
|
1700
|
0.776
|
11
|
Coarse Gaussian SVM
|
Kernel function
|
93.300
|
1800
|
0.769
|
12
|
Fine KNN
|
Euclidean distance
|
93.300
|
1200
|
1.378
|
13
|
*Medium KNN
|
Euclidean distance
|
96.700
|
1700
|
0.661
|
14
|
Coarse KNN
|
Euclidean distance
|
95.000
|
2000
|
0.726
|
15
|
Cosine KNN
|
Cosine distance
|
66.700
|
1800
|
0.758
|
16
|
*Cubic KNN
|
Minkowski (cubic) diatance
|
96.700
|
1900
|
0.680
|
17
|
Weighted KNN
|
Euclidean distance
|
93.000
|
2100
|
0.562
|
18
|
Boosted Trees
|
AdaBoost
|
93.000
|
480
|
4.277
|
19
|
Bagged Trees
|
Bag
|
93.000
|
500
|
2.903
|
20
|
Subspace Discriminant
|
Subspace dimension
|
95.000
|
440
|
3.326
|
21
|
Subspace KNN
|
Subspace dimension
|
93.000
|
240
|
2.525
|
22
|
RUSBoosted Trees
|
RUSBoost
|
95.000
|
540
|
2.897
|
*highest accuracy, SVM = Support Vector Machine, KNN = Kernel Nearest Neighbor, Tree = Decision Tree
3.2.2 Training, Testing and Validation of the Chosen Algorithms
The performance of the selected machine learning algorithms was discussed based on “Receiver Operating Characteristic” (ROC) curve analyses (Table 2). The study evaluated the ROC curve parameters, which include “True Positive Rate” (TPR), “False Positive Rate” (FPR), and “Area Under the Curve” (AUC), for each algorithm across three different yam quality classes: good, diseased, and insect infected. A typical “Receiver Operating Characteristic” (ROC) Curve plot is displayed in Figure 1. The (ROC) Curve plot for the selected machine learning algorithms are displayed in figure S1 (included as a supplementary document)
Simple Tree: The ROC curve analysis for the Simple Tree algorithm showed excellent performance across all yam quality classes. It achieved a TPR of 1 (100% sensitivity) for identifying good, diseased, and insect infected yams. The FPR was very low, indicating high specificity for identifying true negatives. The AUC values were also exceptional, with AUCs of 0.99 for good and diseased yams and 0.95 for insect infected yams. These results demonstrate that the Simple Tree algorithm is robust and accurate in classifying yam quality.
Linear SVM: The ROC curve analysis for the linear SVM algorithm exhibited a TPR of 1 for identifying good yams and 0.95 for diseased and insect infected yams. The FPR for identifying diseased and insect infected yams was very low, while it was slightly higher at 0.03 for good yams. The AUC values were high, with AUCs of 0.99 for good and insect infected yams and a perfect AUC of 1 for diseased yams. These results indicate that the linear SVM algorithm is effective in distinguishing diseased yams from other classes.
Medium Gaussian SVM: The ROC curve analysis for the “Medium Gaussian SVM” algorithm demonstrated a TPR of 1 for identifying good yams and 0.95 for diseased and insect infected yams. Similar to “Linear SVM”, the FPR for identifying diseased and insect infected yams was low, with a slightly higher value of 0.03 for good yams. The AUC values were excellent, with a perfect AUC of 1 for good yams, 1 for diseased yams, and 0.99 for insect infected yams. These findings indicate that the “Medium Gaussian SVM” algorithm has high accuracy and reliability in classifying yam quality.
Medium KNN: The ROC curve analysis for the “Medium KNN” algorithm achieved a TPR of 1 for identifying good and diseased yams and 0.9 for insect infected yams. The FPR was very low for all three classes, indicating excellent specificity. The AUC values were high, with AUCs of 0.99 for good and insect infected yams and 0.98 for diseased yams. This indicates that the “Medium KNN” algorithm exhibits strong performance in classifying yam quality.
Cubic KNN: The ROC curve analysis for the “Cubic KNN” algorithm displayed a TPR of 1 for identifying good and diseased yams and 0.9 for insect infected yams. Similar to “Medium KNN”, the FPR was very low across all classes. The AUC values were high, with AUCs of 0.99 for good and insect infected yams and 0.98 for diseased yams. These results illustrate the effectiveness of the Cubic KNN algorithm in yam quality classification.
The selected machine learning algorithms, including the “Simple Tree”, “Linear SVM”, “Medium Gaussian SVM”, “Medium KNN”, and “Cubic KNN”, all exhibited strong performance in classifying yam quality based on the ROC curve analyses. These algorithms demonstrated high sensitivity and specificity, as reflected in their TPR and FPR values. Also, the AUC values indicated the algorithms' ability to discriminate between the different yam quality classes. These findings validate the suitability of these algorithms for yam quality assessment, paving the way for their deployment on IoT devices to facilitate real-time and accurate yam tuber detection and sorting in the agricultural industry (Sun et al. 2020; Su & Xue, 2021; Khazaee et al., 2022; Nakatumba-Nabende et al., 2023; Audu et al., 2023).
Table 2: The Receiver Operating Characteristic (ROC) Curve Performances for the chosen algorithms
Selected Machine learning Algorithm
|
Receiver Operating Characteristic (ROC) Curve Parameter
|
Yam Quality
|
Good
|
Diseased
|
Insect infected
|
Simple Tree
|
True positive rate
|
1
|
1
|
0.9
|
False positive rate
|
0.03
|
0.03
|
0
|
Area Under Curve (AUC)
|
0.99
|
0.99
|
0.95
|
Linear SVM
|
True positive rate
|
1
|
0.95
|
0.95
|
False positive rate
|
0.03
|
0
|
0.03
|
Area Under Curve (AUC)
|
0.99
|
1
|
0.99
|
Medium Gaussian SVM
|
True positive rate
|
1
|
0.95
|
0.95
|
False positive rate
|
0.03
|
0
|
0.03
|
Area Under Curve (AUC)
|
1
|
1
|
0.99
|
Medium KNN
|
True positive rate
|
1
|
1
|
0.9
|
False positive rate
|
0.03
|
0.03
|
0
|
Area Under Curve (AUC)
|
0.99
|
1
|
0.98
|
Cubic KNN
|
True positive rate
|
1
|
1
|
0.9
|
False positive rate
|
0.03
|
0.03
|
0
|
Area Under Curve (AUC)
|
0.99
|
1
|
0.98
|
SVM = Support Vector Machine, KNN = Kernel Nearest Neighbor, Tree = Decision Tree
Parallel coordinates plot analysis was also used for the visualizations analysis of the multivariate numerical data of the image features extracted. A 6D parallel coordinates plot for the six image extracted features was plotted for selected algorithms. This plots are displayed in Figure S2 (included as a supplementary document). Nevertheless, a typical 6D parallel coordinates plot for image extracted features of different scaling conditions is displayed in Figure 2. The plots show similar behaviours for all the chosen algorithms plotted. This behaviour also changes similarly when the scaling conditions changes from normalization to standardization. The parallel coordinates plots show that there is a big different between the pixel’s amount in red, blue, green, grayscale features to that of the size and width features. So, normalizing or standardizing the features scale equalize these features for better output.
3.2.3 Yam quality classification Performance of the chosen algorithms for IoT application
The summary result of the performance evaluation of the selected machine learning algorithms for yam quality classification based on the confusion matrix analysis is presented in Table 3. The complete result of the performance evaluation confusion matrix plots are shown in Figure S3 (included as a supplementary document). The confusion matrix provides valuable insights into the algorithms' classification accuracy by considering the number of observations, correctly classified samples, wrongly classified samples, true positive rate (sensitivity), false negative rate, positive predictive value, and false discovery rate. The evaluation was conducted for three yam quality classes: good, diseased, and insect infected.
Table 3: Confusion matrix classification for the chosen algorithms
Selected Machine learning Algorithm
|
Validation Parameter considered
|
Yam Quality
|
Good
|
Diseased
|
Insect infected
|
Simple Tree
|
No of Observation
|
20
|
20
|
20
|
Correctly Classified as
|
20
|
20
|
18
|
Wrongly Classified as
|
1
|
1
|
0
|
True positive rate (%)
|
100
|
100
|
90
|
False negative rate (%)
|
0
|
0
|
10
|
Positive predictive value (%)
|
95
|
95
|
100
|
False discovery rate (%)
|
5
|
5
|
0
|
Linear SVM
|
No of Observation
|
20
|
20
|
20
|
Correctly Classified as
|
20
|
19
|
19
|
Wrongly Classified as
|
1
|
0
|
1
|
True positive rate (%)
|
100
|
95
|
95
|
False negative rate (%)
|
0
|
5
|
5
|
Positive predictive value (%)
|
95
|
100
|
95
|
False discovery rate (%)
|
5
|
0
|
5
|
Medium Gaussian SVM
|
No of Observation
|
20
|
20
|
20
|
Correctly Classified as
|
20
|
19
|
19
|
Wrongly Classified as
|
1
|
0
|
1
|
True positive rate (%)
|
100
|
95
|
95
|
False negative rate (%)
|
0
|
5
|
5
|
Positive predictive value (%)
|
95
|
100
|
95
|
False discovery rate (%)
|
5
|
0
|
5
|
Medium KNN
|
No of Observation
|
20
|
20
|
20
|
Correctly Classified as
|
20
|
20
|
18
|
Wrongly Classified as
|
1
|
1
|
0
|
True positive rate (%)
|
100
|
100
|
90
|
False negative rate (%)
|
0
|
0
|
10
|
Positive predictive value (%)
|
95
|
95
|
100
|
False discovery rate (%)
|
5
|
5
|
0
|
Cubic KNN
|
No of Observation
|
20
|
20
|
20
|
Correctly Classified as
|
20
|
20
|
18
|
Wrongly Classified as
|
1
|
1
|
0
|
True positive rate (%)
|
100
|
100
|
90
|
False negative rate (%)
|
0
|
0
|
10
|
Positive predictive value (%)
|
95
|
95
|
100
|
False discovery rate (%)
|
5
|
5
|
0
|
Simple Tree: The “Simple Tree” algorithm achieved impressive results in Yam quality classification. Out of 20 observations for each class, it correctly classified all 20 instances of good and diseased yams, achieving a true positive rate of 100% for both classes. For insect infected yams, the algorithm achieved a true positive rate of 90%, correctly identifying 18 out of 20 samples. The false negative rate for all three classes was 0%, indicating that no instances were wrongly classified as negative. The positive predictive value was high, with 95% for Good and diseased yams and 100% for Insect infected yams. The false discovery rate was low, with only 5% for good and diseased yams and 0% for Insect infected yams. These results highlight the Simple Tree's robustness and accuracy in yam quality classification.
Linear SVM: The “Linear SVM” algorithm demonstrated excellent performance in yam quality classification. For good yams, all 20 observations were correctly classified, resulting in a true positive rate of 100%. For diseased yams, 19 out of 20 observations were correctly classified, leading to a true positive rate of 95%. Similarly, for insect infected yams, 19 out of 20 observations were correctly classified, resulting in a true positive rate of 95%. The false negative rate was low, with 0% for diseased and insect infected yams and 5% for Good yams. The positive predictive value was high, with 95% for good and diseased yams and 100% for insect infected yams. The false discovery rate was 5% for good and diseased yams and 0% for Insect infected yams. These results indicate the Linear SVM's effectiveness in distinguishing between different yam quality classes.
Medium Gaussian SVM: The “Medium Gaussian SVM” algorithm exhibited performance similar to “Linear SVM” in yam quality classification. It correctly classified all 20 observations of good yams, resulting in a true positive rate of 100%. For diseased and insect infected yams, 19 out of 20 observations were correctly classified, leading to a true positive rate of 95% for both classes. The false negative rate was 0% for diseased and insect infected yams and 5% for good yams. The positive predictive value was high, with 95% for good and diseased yams and 100% for insect infected yams. The false discovery rate was 5% for good and diseased yams and 0% for insect infected yams. These findings demonstrate the Medium Gaussian SVM's accuracy and reliability in yam quality classification.
Medium KNN: The “Medium KNN” algorithm performed well in Yam quality classification. It correctly classified all 20 observations of good yams, achieving a true positive rate of 100%. For diseased yams, all 20 observations were correctly classified, resulting in a true positive rate of 100%. However, for insect infected yams, the algorithm achieved a true positive rate of 90%, correctly identifying 18 out of 20 samples. The false negative rate was 0% for Good and diseased yams and 10% for insect infected yams. The positive predictive value was high, with 95% for good and diseased yams and 100% for insect infected yams. The false discovery rate was 5% for good and diseased yams and 0% for Insect infected yams. These results illustrate the Medium KNN's effectiveness in Yam quality classification.
Cubic KNN: The “Cubic KNN” algorithm demonstrated performance similar to “Medium KNN” in yam quality classification. It correctly classified all 20 observations of good and diseased yams, resulting in a true positive rate of 100% for both classes. For insect infected yams, the algorithm achieved a true positive rate of 90%, correctly identifying 18 out of 20 samples. The false negative rate was 0% for good and diseased yams and 10% for insect infected yams. The positive predictive value was high, with 95% for good and diseased yams and 100% for insect infected yams. The false discovery rate was 5% for good and diseased yams and 0% for insect infected yams. These findings underscore the Cubic KNN's effectiveness in Yam quality classification.
The selected machine learning algorithms, all demonstrated strong Yam quality classification performance. The algorithms achieved high true positive rates and positive predictive values while maintaining low false negative rates and false discovery rates (Zawbaa et al., 2014; Fakir et al., 2020; Sun et al. 2020; Su & Xue, 2021; Nakatumba-Nabende et al., 2023; Audu et al., 2023). These results are comparable to those of other studies that have explored the use of machine learning algorithms for the classification and quality assessment of tubers, such as Irish potatoes, sweet potatoes and yams (Sun et al. 2020; Nakatumba-Nabende et al., 2023; Audu et al., 2023). These results validate the suitability of these algorithms for accurate and reliable yam tuber quality assessment, making them viable candidates for deployment on IoT devices in the agricultural industry.
3.2.3 Developed computer codes from the chosen algorithms for deployment into IoT devices
Five separate computer codes were written for deployment into IoT devices. These codes are named CIoT1, CIoT2, CIoT3, CIoT4, CIoT5 for Simple Tree, Linear SVM, Medium Gaussian SVM, Medium KNN, Cubic KNN algorithms respectively. These written codes are included and submitted as a supplementary document.
i. CIoT1: Developed code using Simple Tree Algorithms
CIoT1the computer code for training and deploying the “Simple Tree” algorithm, which has achieved impressive results in Yam quality classification, into IoT devices. The provided code is essential for recreating the classification model trained in the Classification Learner app. It consists of various functions and options that can be utilized to make predictions on new data. Additionally, the code allows for the retraining of the classifier with new data to adapt to evolving scenarios.
The developed code follows a modular structure and contains essential functionalities for data processing, feature extraction using Principal Component Analysis (PCA), training the classifier, and making predictions. The developed computer code enables the deployment of the Simple Tree algorithm, along with PCA, into IoT devices for Yam quality classification. It facilitates real-time predictions on new data and allows for potential retraining with updated datasets to maintain accuracy in dynamic environments. As IoT devices become increasingly prevalent in agriculture, the integration of this code can contribute to more efficient and accurate yam tuber quality assessment, benefiting farmers and stakeholders in the industry.
ii. CIoT2: Developed code using Linear SVM (Support Vector Machine) Algorithm
The CIoT2 computer code for training and deploying the “Linear Support Vector Machine” (SVM) algorithm, has demonstrated promising results in Yam quality classification. The provided code is essential for replicating the classification model trained in the “Classification Learner app” and enables the prediction of Yam quality classes on new data. Moreover, the code allows for retraining the classifier with updated datasets and is equipped with functionalities for automated deployment into IoT devices.
The developed code follows a modular structure and consists of several functions and options required for classifier training and predictions. This computer code facilitates the deployment of the Linear SVM algorithm, along with PCA, into IoT devices for yam quality classification. The code allows for real-time predictions on new data and potential retraining with updated datasets to maintain accuracy in dynamic environments.
iii. CIoT3: Developed code using Medium Gaussian SVM (Support Vector Machine) Algorithm
The CIoT3 is the computer code for training and deploying the “Medium Gaussian Support Vector Machine” (SVM) algorithm. The provided code facilitates the development of an accurate Yam quality classification model with a Gaussian kernel, making it suitable for deployment into IoT devices for real-time yam tuber quality assessment. This provided computer code offers a practical implementation of the “Medium Gaussian SVM” algorithm for yam quality classification. By deploying this code into IoT devices, farmers and stakeholders in the agricultural industry can benefit from efficient and accurate real-time assessment of yam tuber quality. The integration of multiple algorithms, including the previously discussed ‘Linear SVM: and “Simple Tree” algorithms, alongside this “Medium Gaussian” SVM, contributes to a robust and versatile classification system for addressing diverse challenges in yam farming and production.
iv. CIoT4: Developed code using Medium KNN (Kernel Nearest Neighbor) Algorithm
The CIoT4 is the computer code for training and deploying the “Medium KNN (Kernel Nearest Neighbor)” algorithm. This code enables the development of an efficient and accurate Yam quality classification model, making it suitable for deployment into IoT devices for real-time yam tuber quality assessment. The provided computer code offers a practical implementation of the “Medium KNN” algorithm for Yam quality classification. The deployment of this code into IoT devices empowers farmers and stakeholders in the agricultural industry with real-time and reliable yam tuber quality assessment capabilities. By integrating multiple algorithms, including the previously discussed “Linear SVM”, “Simple Tree”, and “Medium Gaussian SVM” algorithms, this “Medium KNN” classifier contributes to a comprehensive and versatile classification system to address diverse challenges in yam farming and production.
v. CIoT5: Developed code using Cubic KNN (Kernel Nearest Neighbor) Algorithm
The CIoT5 is the computer code for training and deploying the “Cubic KNN (Kernel Nearest Neighbor)” algorithm. This code facilitates the creation of an accurate and efficient Yam quality classification model, suitable for integration into IoT devices for real-time yam tuber quality assessment. This computer code offers a practical implementation of the “Cubic KNN” algorithm for yam quality classification. Integration of this code into IoT devices empowers stakeholders in the agricultural industry with real-time and reliable yam tuber quality assessment capabilities. Through the development and deployment of multiple algorithms, including “Linear SVM”, “Simple Tree”, “Medium Gaussian SVM”, “Medium KNN”, and “Cubic KNN”, this comprehensive classification system effectively addresses the diverse challenges faced in yam farming and production. The availability of such advanced and versatile classification tools is poised to revolutionize the yam farming landscape, leading to increased efficiency, enhanced productivity, and sustainable agricultural practices.
3.3 Development of yam tuber detection code for deployment to robotic devices
3.3.1 Artificial Neural Network Architecture
The development of a yam tuber detection code using the NNTOOL in MATLAB software was achieved using the artificial neural network algorithm. The code utilizes a neural network architecture with specific layers and features to achieve accurate and efficient detection of yam tubers, suitable for deployment to robotic devices.
The network architecture was a multi-layer perceptron (MLP) neural network, consisting of an input layer which takes six features (red pixels, green pixels, blue pixels, grayscale pixel, width pixels, and height pixels), 10 hidden layers for transforming features higher level output, and an output layer, which consist of 3 class of output (diseased, good, and insect infected) as shown in Figure 3. The activation functions used by the network include ReLU for hidden layers and Softmax for the output layer. The training and learning process of the network was achieved using the back propagation algorithm.
3.3.2 Artificial Neural Network Training, Testing and Validation Performance
The evaluation of the artificial neural network's performance when deployed for detecting yam quality in robotic devices has revealed compelling findings. The developed neural network demonstrates its capability to accurately assess yam quality, achieving an error rate of less than 10%. To visually track the network's learning progress, the study graphed the cross-entropy, a measure of prediction error, against the number of training epochs. Figure 4 illustrates how the loss function (cross-entropy) consistently decreases during training, testing, and validation phases as the number of epochs increases.
Throughout the comprehensive process of training, testing, and validation, spanning 13 epochs, a significant milestone emerged at the seventh epoch. Specifically, the cross-entropy during training and testing dropped below 0.11239, indicating a substantial enhancement in prediction accuracy. This pivotal moment aligns with the neural network's improved ability to differentiate yam quality attributes. These performance results the network is further amplified and displayed by the training state plot in Figure 5, error histogram plot in Figure 6 and receiver operating characteristic (ROC) Curve plot in Figure 7.
Interestingly, similar investigations conducted by Ehounou et al. (2021) and Audu et al. (2023) have pursued analogous paths in their pursuit of detecting yam tuber quality. Despite employing distinct methodologies, these studies also shared the common goal of evaluating yam quality. The convergence of training outcomes in these studies underscores the effectiveness of the neural network approach in discerning yam quality.
In a broader view of neural network performance, the research contributions of Yamashita et al. (1918), Chen et al. (2020), and Alzubaidi et al. (2021) provide valuable insights into optimizing and enhancing neural networks for various applications. The findings from this study align with the collective body of research exploring yam quality detection through different methodologies or trained neural network algorithms.
Therefore, the evaluation of the artificial neural network's performance in yam quality detection for integration into robotic devices highlights its potential to transform agricultural practices. The network's ability to reduce prediction errors validates its role in improving the accuracy and efficiency of yam tuber classification. Supported by parallel studies and consistent with established research trends, this study contributes to the broader field of yam quality detection and emphasizes the importance of neural network-driven solutions in modern agriculture.
3.3.4 Artificial Neural Network Identification and Classification Performance
The assessment of classification performance through the confusion matrix displayed in Figures 8 offers a comprehensive evaluation of the effectiveness of the developed robotic code for yam tuber detection. The confusion matrix is a valuable tool for quantifying the accuracy and dependability of the classification model throughout its deployment stages. In this context, the confusion matrix provides insights into the model's performance by considering key metrics such as accuracy, precision, recall, and F1-score.
Here are the results from the training, validation, and testing phases:
Training Overall Result: 94.8%; Validation Overall Result: 88.9%; Test Overall Result: 84.4% considering the combined performance from all the confusion matrices, an impressive overall accuracy of 92.3% is achieved. This indicates the robotic code's strong ability to accurately identify and classify yam tuber quality attributes.
Training Phase: During the training phase, an outstanding overall accuracy of 94.8% was achieved. This signifies the model's capacity to effectively learn and adapt to underlying patterns within the dataset. The confusion matrix for the training phase provides a visual representation of predicted and actual classes, demonstrating a robust alignment between the model's predictions and the actual data.
Validation Phase: In the validation phase, the overall accuracy was 88.9%. This phase assesses the model's performance on new, unseen data. The generated confusion matrix sheds light on the model's ability to generalize its learning. Although slightly lower than the training accuracy, the validation performance remains strong, indicating the model's capability to apply learned patterns to new data.
Test Phase: During the test phase, the overall accuracy reached 84.4%. This phase simulates real-world scenarios and tests the model's performance under operational conditions. The associated confusion matrix provides insights into the model's performance on independent data. While the accuracy is slightly lower than in the training and validation phases, the model continues to exhibit significant accuracy in classifying yam tuber quality.
Overall Performance: The collective performance across all confusion matrices, culminating in an overall accuracy of 92.3%, highlights the reliability of the robotic code in consistently distinguishing between various yam tuber quality categories. This achievement underscores the potential of the developed code to make a meaningful contribution to yam tuber detection within robotic applications.
Thus, the evaluation based on the confusion matrix reveals consistent and impressive performance throughout all phases. The training, validation, and test phases together contribute to an overall accuracy of 92.3%, confirming the code's effectiveness in accurate yam tuber quality detection. This success reaffirms the code's suitability for real-world robotic applications, ultimately enhancing agricultural practices and quality control efforts.
The developed robotic code, named "CRobotics," is displayed in the submitted supplementary document. This code harnesses the capabilities of the Artificial Neural Network (ANN) algorithm to offer a comprehensive solution for detecting yam quality within robotic systems. The architecture of the "CRobotics" code shines a spotlight on the capabilities of artificial neural networks in making accurate predictions about yam tuber quality within the realm of robotic applications. By leveraging meticulously determined weights, biases, and transfer functions, the code adeptly processes input data and generates meaningful predictions. The adoption of ANN models for yam quality detection aligns with contemporary research trends that harness AI and machine learning to elevate agricultural practices and quality control measures.
Thus, the "CRobotics" code assumes a pivotal role in empowering robotic systems to assess yam tuber quality attributes. Its reliance on the Artificial Neural Network algorithm, coupled with precisely defined constants and layer configurations, underscores its potential to redefine yam quality assessment in the agricultural context. As technological strides continue, codes like "CRobotics" stand as invaluable contributions to the wider domain of precision agriculture, fostering efficiency and accuracy in quality evaluation processes.
Therefore, deploying this neural network to robotic devices brings numerous benefits to the agricultural industry. Robotic devices equipped with the yam tuber detection code can autonomously identify and classify yam tubers, optimizing harvesting processes and improving agricultural productivity. The network's real-time capabilities allow efficient detection and sorting of yam tubers, reducing labor costs and minimizing waste.
Thus, the developed code demonstrates the potential of artificial intelligence in modern agriculture. The accurate Yam tuber detection capabilities, combined with deployment to robotic devices, offer a promising solution for enhancing Yam farming practices. As technology continues to advance, integrating AI-driven solutions in agriculture is expected to revolutionize the industry, promoting sustainable and efficient farming practices.
3.4 Codes deployment test
The outcomes of the deployment testing for the developed codes, aimed at detecting yam quality, are presented in Table 4. This table offers a thorough evaluation of how well the codes perform when applied to various samples of yam tubers. It outlines the features extracted from the images, the actual quality class of the yam, and the predictions generated by each of the developed codes: CIoT1, CIoT2, CIoT3, CIoT4, CIoT5, and CRobotics.
The results of the deployment testing provide insights into the accuracy of each code's predictions for yam quality classes. By comparing the predictions against the actual quality classes, the study can gauge how well the codes classify the yam tubers. This evaluation involves testing the codes on samples with different yam quality characteristics, including "Good," "Diseased," and "Insect Infected."
Upon examination, it becomes clear that there are instances of misclassification, denoted by the "*wrongly classified" annotations in Table 4. These occurrences highlight situations where a specific code made inaccurate predictions about the yam quality class. For instance, CRobotics wrongly classified some samples as "Good" when they were actually of the "Insect Infected" class.
The results of the deployment testing allow for a side-by-side comparison of how well each developed code performs. This comparison aids in understanding which code yields the most accurate predictions across the entire dataset. Additional notes specify the particular algorithm used by each code: CIoT1 to CIoT5 utilize various tree and SVM (Support Vector Machine) variants, while CRobotics employs the Artificial Neural Network (ANN) algorithm.
The outcomes of the testing showcase the real-world applicability of the developed codes in scenarios involving yam quality detection. The predictive capabilities of these codes play a crucial role in automating the assessment of quality, leading to time and resource savings while maintaining precise evaluations.
The table includes notes that highlight instances of incorrect predictions. For example, CIoT4 misclassified certain samples as "Good" when they were actually "Diseased." Similarly, CRobotics made incorrect predictions in certain cases, confusing "Insect Infected" samples as "Good." These instances underscore the importance of continually refining and fine-tuning the code models to enhance their accuracy.
In spite of a few misclassification instances, the deployment testing results cast a positive light on the performance of the developed codes. These codes exhibit the potential to significantly contribute to quality control efforts within the yam industry by automating the process of detecting yam quality attributes, thus minimizing the need for human intervention.
To conclude, the findings from the deployment testing provide a comprehensive understanding of how effectively the developed codes can practically detect yam quality attributes. While some misclassifications occurred, the overall accuracy and effectiveness of the codes hold promising prospects for automating yam quality assessment, thereby enhancing efficiency and accuracy in agricultural practices.
Table 4: Deployment Test of the Developed Codes for detecting yam quality
S/N
|
Yam Quality Class (Code)
|
Extracted Image Features
|
Developed Codes
|
Red
|
Green
|
Blue
|
Grey scale
|
Width
|
Height
|
CIoT1
|
CIoT2
|
CIoT3
|
CIoT4
|
CIoT5
|
CRobotics
|
1
|
Good
|
8600
|
8600
|
8600
|
8400
|
882
|
747
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
2
|
Good
|
9100
|
9100
|
9100
|
9100
|
765
|
964
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
3
|
Good
|
8800
|
8800
|
8800
|
8700
|
774
|
882
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
4
|
Good
|
9700
|
9700
|
9700
|
9600
|
860
|
1002
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
5
|
Good
|
7800
|
7800
|
7800
|
7600
|
874
|
1023
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
6
|
Good
|
8000
|
8000
|
8000
|
8100
|
900
|
791
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
7
|
Good
|
9000
|
9000
|
9000
|
9100
|
773
|
972
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
8
|
Good
|
8700
|
8700
|
8700
|
8500
|
901
|
697
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
9
|
Good
|
9200
|
9200
|
9200
|
9000
|
783
|
940
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
10
|
Good
|
8100
|
8100
|
8100
|
8000
|
760
|
886
|
Good
|
Good
|
Good
|
Good
|
Good
|
Good
|
11
|
Diseased
|
3800
|
3800
|
3800
|
3700
|
984
|
780
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
12
|
Diseased
|
4500
|
4500
|
4500
|
4300
|
984
|
900
|
Diseased
|
Insect Infected*
|
Insect Infected*
|
Diseased
|
Diseased
|
Insect Infected*
|
13
|
Diseased
|
2000
|
2000
|
2000
|
2100
|
790
|
934
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
14
|
Diseased
|
2700
|
2700
|
2700
|
2600
|
982
|
876
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
15
|
Diseased
|
3500
|
3500
|
3500
|
3300
|
882
|
903
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
16
|
Diseased
|
1900
|
1900
|
1900
|
2000
|
974
|
875
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
17
|
Diseased
|
4000
|
4000
|
4000
|
3800
|
956
|
687
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
18
|
Diseased
|
4200
|
4200
|
4200
|
4300
|
653
|
756
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
19
|
Diseased
|
2500
|
2500
|
2500
|
2400
|
1092
|
770
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
20
|
Diseased
|
3400
|
3400
|
3400
|
3300
|
1082
|
772
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
Diseased
|
21
|
Insect Infected
|
6300
|
6300
|
6300
|
6200
|
902
|
775
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
22
|
Insect Infected
|
7000
|
7000
|
7000
|
6900
|
1040
|
760
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
23
|
Insect Infected
|
6700
|
6700
|
6700
|
6600
|
1070
|
760
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
24
|
Insect Infected
|
7200
|
7200
|
7200
|
7100
|
980
|
758
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
25
|
Insect Infected
|
6700
|
6700
|
6700
|
6600
|
1070
|
761
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
26
|
Insect Infected
|
8500
|
8500
|
8500
|
8300
|
1070
|
770
|
Good*
|
Good*
|
Good*
|
Good*
|
Good*
|
Good*
|
27
|
Insect Infected
|
4800
|
4800
|
4800
|
4900
|
1079
|
768
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
28
|
Insect Infected
|
4600
|
4600
|
4600
|
4500
|
1081
|
764
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
29
|
Insect Infected
|
5700
|
5700
|
5700
|
5800
|
1081
|
772
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
30
|
Insect Infected
|
7700
|
7700
|
7700
|
7600
|
1082
|
773
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
Insect Infected
|
*Wrongly classified, CIoT1isthe developed code using simple tree algorithms, CIoT2 is the developed code using linear svm (support vector machine) algorithm, CIoT3 is the developed code using medium gaussian svm (support vector machine) algorithm, CIoT4 is the developed code using medium knn (kernel nearest neighbor) algorithm, CIoT5 is the developed code using cubic knn (kernel nearest neighbor) algorithm, CRobotics is the developed code using ann (artificial neural network) algorithm