3.1. Phenotyping of Green Cowpea Pod Varieties
Digital images of green cowpea pods reveal significant morphological variability among the analyzed genotypes (
Figure 2). Significant contrasts are observed in morphological attributes such as length, thickness, and degree of curvature (ranging from straight to strongly arched pods). Regarding colorimetry, a wide range of patterns was observed, including uniform green tones, greenish variations with purplish pigmentation, and darker colors. Additionally, variations in surface texture were identified, including longitudinal striations and differences in the degree of morphological uniformity. These phenotypic discrepancies provide a basis for visual features that enable machine learning algorithms to make robust distinctions between genotypes.
The comparative analysis of different classification algorithms for identifying green cowpea pods, using four embedded architectures for feature extraction, is detailed in
Table 1. Using InceptionV3 as a feature extractor, the Neural Network (NN) and Support Vector Machine (SVM) models showed the best performance, with maximum metrics (1.000) for the area under the receiver operating characteristic (ROC curve (AUC), classification accuracy (CA), weighted harmonic mean accuracy (F1), precision, recall, Matthews Correlation Coefficient (MCC), and specificity.
Additionally, both exhibited low cross-entropy (log-loss) values of 0.001 and 0.403, respectively. Although the SVM demonstrated predictive effectiveness similar to that of the NN, its training time (TT) was significantly shorter (10.295 s). The kNN algorithm also achieved high performance (AUC of 0.998); however, it showed lower accuracy (0.942) compared to the top-down models. In contrast, the tree-based model (Decision Tree) showed the lowest overall performance (AUC = 0.878; CA = 0.750) and the highest log-loss (8.076), indicating lower predictive reliability.
Gradient Boosting, despite achieving reasonable metrics (AUC = 0.987; CA = 0.896), had the longest training time among all models (1,422,669 s), which may limit its applicability in systems with computational constraints.
The SqueezeNet architecture demonstrated remarkable performance as a feature extractor, especially when integrated with Neural Network (NN) and Support Vector Machine (SVM) classifiers. Both models achieved metrics close to unity across all indicators, including AUC-ROC, accuracy (CA), F1-score, precision, sensitivity, and specificity, demonstrating high discriminative power and a balanced class distribution. The log-loss values obtained (0.008 for NN and 0.394 for SVM) reinforce the robustness of the predictions, indicating low penalty and a high probability of success.
Random Forest also showed stability (AUC = 0.999; CA = 0.965), with a marginal increase in log-loss (0.449). In contrast, the Decision Tree model showed the lowest overall performance (AUC = 0.872; CA = 0.746) and the highest log-loss (8.484). Finally, kNN stood out for its computational speed (TT = 2.269 s). At the same time, Gradient Boosting, despite its strong predictive performance (AUC = 0.996), incurred a significantly higher computational cost (TT = 830.300 s) than other models in the same class.
When using VGG16 as a feature extractor, both NN and SVM demonstrated superiority, with metrics close to perfect. The NN model achieved unit results across all indicators (AUC-ROC, CA, F1-score, MCC, and specificity = 1.000) and the lowest log-loss (0.001). However, it required high training (TT) and testing times (36.035 s and 12.437 s, respectively). SVM showed comparable performance (AUC = 0.999; CA = 0.962), with a log-loss of 0.461. Random Forest also demonstrated excellent adaptability to VGG16, achieving an accuracy of 0.992 and a low log-loss (0.354).
On the other hand, Gradient Boosting, despite achieving a competitive accuracy (CA = 0.954), had the longest training time in the study (1,364.514 s), suggesting limitations for real-time applications or those with hardware constraints. The tree-based model (Decision Tree) showed the worst overall performance (CA = 0.831; log-loss = 5.575), while kNN showed intermediate results (CA = 0.954; log-loss = 0.257), although it was inferior to those of more robust models.
The use of VGG19 as an embedder underscored the superiority of NNs and SVMs, with their metrics approaching perfection. Notably, the NN model achieved the highest performance (1.000 across all indicators), registering the lowest log-loss in the study (0.000), although it required the longest processing time (TT = 40.057 s; Test Time = 15.503 s). SVM presented comparable results (CA = 0.981; F1-score = 0.985) and a training time of 24.156 s. Random Forest demonstrated its efficiency and a balanced trade-off between precision and computational cost (CA = 0.988; F1-score = 0.989).
In contrast, Gradient Boosting, despite its satisfactory predictive performance (AUC = 0.997), had the longest training time (1,727.015 s), underscoring its impracticality in hardware-constrained scenarios. Finally, the Decision Tree model replicated the low-performance pattern observed in the other extractors (CA = 0.819; log-loss = 6.249), while kNN maintained an intermediate performance level (CA = 0.946).
The Neural Network (NN) and Support Vector Machine (SVM) models showed high performance with all embedders. The Neural Network performed best with all embedders, with metrics close to 1. The Inception V3 embedder achieved the best metric among the Neural Network models and had the lowest training and testing times. Given the optimal parameters, the Inception V3 embedder was chosen.
The confusion matrix (
Table 2) details the performance of the Neural Network (NN) model with the InceptionV3 embedder in classifying green pods of 13 cowpea genotypes. The model achieved perfect accuracy (100%) in 12 of the 13 materials evaluated, with all samples correctly assigned to their respective classes. Only one classification error was observed in the Sempre Verde cultivar (G13), where a sample was incorrectly labeled as BRS Pajeú (G5). The absolute predominance of predictions on the main diagonal of the matrix confirms the model's effectiveness in discriminating genotypes, even among those with similar morphological characteristics. These results consolidate the robustness of InceptionV3 in feature extraction and the high precision of Neural Networks in precision digital phenotyping applications.
The comparative analysis of the activation functions (
Table 3) demonstrated that ReLU, in conjunction with the L-BFGS-B optimizer, showed superior performance, reaching the unitary level (1,000) in all classification metrics. This combination resulted in a very low log-loss, highlighting the model's robustness and the consistency of its predictions. Although the Logistic and Hyperbolic Tangent (tanh) functions presented satisfactory results, a slight degradation in accuracy and an increase in classification error were observed when associated with the SGD (Stochastic Gradient Descent) algorithm.
In contrast, the Identity function showed the lowest overall performance, attributable to its inability to model the complex nonlinear relationships inherent in pod morphology. Therefore, the combination of ReLU with L-BFGS-B proved to be the ideal configuration, offering the best balance between predictive effectiveness, convergence stability, and mitigation of overfitting.
The confusion matrix obtained for the NN configured with the ReLU activation function and the L-BFGS-B optimizer showed absolute performance in classifying the 13 cowpea genotypes (
Table 4). All classes registered 20 correct classifications, with no false positives or negatives. This result indicates that the attributes extracted by the model were highly discriminative, enabling a clear, linear, or non-linear separation between the classes in the feature space. Although the ideal performance validates the effectiveness of the proposed architecture, it also reinforces the need for future tests on external datasets (external validation) to ensure the model's robustness and rule out potential overfitting.
The comparison between the different embedders and classifiers (
Table 5) indicates that the SVM and v-SVM (linear, polynomial, and RBF kernels) obtained superior performance metrics (AUC, accuracy, F1-score, and MCC), demonstrating high discriminatory capacity. However, the high LogLoss values suggest poor probabilistic calibration: although the classifications are mostly correct, the model is overconfident in its inaccurate predictions. Therefore, the selection of the ideal model should balance classification effectiveness with the reliability of the estimated probabilities, prioritizing configurations that minimize LogLoss.
The confusion matrix (
Table 6) of the SVM classifier with a linear kernel confirms that, despite satisfactory overall performance, classification errors persist in specific classes. It is noted that, while most cultivars were accurately identified, specific genotypes showed overlap (misclassification), with samples incorrectly assigned to similar courses. These results indicate that linear separation in the extracted feature space is insufficient to discriminate among all varieties, suggesting the presence of complex morphological patterns that require non-linear decision functions or models with greater representational capacity.
3.3. Phenotyping of Green Cowpea Genotypes
Phenotyping of green cowpea varieties (
Figure 3) indicates high phenotypic diversity among genotypes. Consistent variations are observed in morphological and chromatic attributes, including dimensions (size and rounded or elongated shape), seed coat shades, and distinct hilum patterns. Furthermore, heterogeneity in surface texture and batch uniformity reflects specific genotypic traits. These visual contrasts provide fundamental discriminating attributes, which were extracted and processed by machine learning models to enable accurate classification of the materials.
Table 11 demonstrates that, using the InceptionV3 embedder, the Neural Network and SVM models were the most effective, both achieving an AUC of 1.000 and a CA of 0.977. However, the Neural Network achieved a significantly lower LogLoss (0.075) than the SVM (0.413), indicating superior probabilistic calibration. The kNN model had intermediate performance (CA = 0.892), while the Gradient Boosting and Random Forest models showed lower accuracies and higher LogLoss, reflecting greater predictive uncertainty. The Decision Tree model was the least efficient (CA = 0.681; LogLoss = 10.586). Therefore, for green grain classification, the Neural Network may be the preferred option due to the balance between precision and reliability. At the same time, the SVM is a robust alternative, although less calibrated.
The results obtained with the SqueezeNet embedder confirm the superiority of the Neural Network and the SVM. Both achieved high performance metrics, with AUCs of 0.998 and 0.995 and a CA of 0.962, demonstrating consistent recognition of green grain classes. However, the Neural Network's LogLoss (0.204) was significantly lower than the SVM's (0.497), indicating superior probabilistic calibration despite similar classification performance. The kNN showed intermediate performance (CA = 0.865), while Gradient Boosting and Random Forest obtained lower results. The Decision Tree model showed limited effectiveness (CA = 0.581; LogLoss = 13.79). Thus, as observed with InceptionV3, the Neural Network consolidates itself as the most suitable model when using SqueezeNet, harmonizing high accuracy with greater predictive reliability.
Using VGG16 as a feature extractor, the Neural Network again demonstrated superior overall performance, with an AUC of 0.998 and a CA of 0.962, accompanied by a low LogLoss (0.204), ensuring robust calibration. The SVM achieved identical classification metrics (CA = 0.962) but a higher LogLoss (0.493), indicating greater predictive uncertainty than the Neural Network. Ensemble Learning models, such as Gradient Boosting and Random Forest, showed intermediate performance, while the kNN showed reduced effectiveness. The Decision Tree model consistently obtained the lowest performance, with a critical LogLoss of 13.379. This evidence confirms that the Neural Network is the most consistent and reliable classifier among the embedders tested, closely followed by the SVM.
Using the VGG19 embedder, the Neural Network maintained outstanding performance, with an AUC of 0.978 and a CA of 0.977, achieving the lowest LogLoss (0.122) among all models and demonstrating superior probabilistic calibration and reliability. The SVM achieved slightly superior classification accuracy (CA = 0.985) but a considerably higher LogLoss (0.436), indicating greater uncertainty in the predicted probabilities. Models such as Gradient Boosting and Random Forest achieved intermediate performance, while kNN achieved lower performance. Once again, the Decision Tree model was the least efficient (CA = 0.681). These results reinforce the Neural Network's consistency as the most robust model from a calibration perspective, followed by the SVM.
Neural Network and Support Vector Machine (SVM) models demonstrated superior performance in all embedders tested for identifying green cowpea grains. The Neural Network outperformed the other classifiers, regardless of the feature extraction architecture, achieving its maximum performance when combined with InceptionV3, with the lowest recorded LogLoss index (0.075). Consequently, the InceptionV3 extractor was selected as the ideal architecture for this phenotyping system due to its superior balance between classification accuracy and probabilistic reliability.
The confusion matrix generated by the Neural Network with the InceptionV3 extractor (
Table 12) demonstrates superior performance in classifying green grains from 13 cowpea genotypes. Most genotypes were correctly identified, with values close to the total number of instances per class (20), with BRS Verdejante, Corujinha, and Rabo de Tatu standing out, achieving full classification (20.0). Slight discrepancies were observed between morphologically similar genotypes, such as BRS Pajeú and Paulistinha, which exhibited mutual overlap (1.3 and 1.9 instances, respectively). Despite these marginal discrepancies, the robustness of the model is supported by high overall indices (CA = 0.977; AUC = 1.000), confirming the effectiveness of the InceptionV3 architecture, combined with neural networks, for accurate phenotyping of the evaluated genotypes.
The performance metrics of the Artificial Neural Network with the InceptionV3 extractor (
Table 13) revealed high robustness in all combinations of activation functions and solvers. The L-BFGS-B solver showed superior results, particularly with the Tanh and ReLU functions, achieving an AUC of 1.000 and a CA of 0.977, along with the lowest LogLoss values (0.061 and 0.075, respectively), demonstrating excellent predictive stability. The SGD solver showed inferior performance, especially in the Logistic function (CA = 0.892; LogLoss = 0.918). On the other hand, the Adam solver showed intermediate effectiveness, with emphasis on the Logistic function (CA = 0.981; LogLoss = 0.090). Therefore, the results confirm that the synergy between InceptionV3 and MLP is consistent, with the combination of the L-BFGS-B solver with the ReLU activation function being the most efficient for the proposed phenotyping.
The confusion matrix of the Artificial Neural Network, configured with the ReLU activation function and the L-BFGS-B solver (
Table 14), showed results consistent with the previously observed overall performance. This stability demonstrates that the choice of these specific hyperparameters ensures maximum accuracy in classifying varieties, without degrading predictive metrics.
The performance metrics of the SVM algorithm (
Table 15) under different kernel functions demonstrate that the Linear and Polynomial kernels were the most effective. Both achieved maximum performance (AUC = 1.000; CA = 0.977; F1 = 0.977), with LogLoss values of 0.408 and 0.400, respectively. The RBF kernel showed slightly lower effectiveness (CA = 0.954), while the Sigmoid kernel showed the lowest performance, with sharp reductions in accuracy (CA = 0.769) and the highest LogLoss (1.035), indicating predictive instability. Analogous results were obtained with v-SVM, reaffirming the superiority of the Linear and Polynomial kernels. Therefore, the polynomial kernel in the SVM algorithm has proven to be the best choice for this model.
The SVM confusion matrix with a polynomial kernel (
Table 16) shows consistent performance in classifying green grain genotypes. Residual confusion rates are observed between specific classes (e.g., G6 and G5; G7 and G6; G13 and G12), suggesting overlap in morphological characteristics within the representations extracted by the embedder. Nevertheless, the incidence of errors remains marginal relative to the total number of samples, confirming the robustness of the polynomial kernel compared with the other basis functions tested. These results confirm the high CA, F1-score, and MCC values, consolidating the polynomial kernel as the optimal configuration for this classification scenario.