Comparative Analysis of Vision Transformer (ViT) and Traditional Machine Learning Models for the Automatic Classification of Grape Varieties
摘要
This study evaluates the performance of a Vision Transformer (ViT) as a feature extractor for classifying grapevine leaf images into five classes, using four conventional classifiers: Multi-Layer Perceptron (MLP), K-Nearest Neighbors (KNN), Support Vector Classifier (SVC), and Random Forest. The dataset was split 80% for training and 20% for testing, preserving class proportions. Results showed that MLP and Random Forest achieved a training accuracy of 1.00, while SVC reached 0.97 and KNN 0.91. On the test set, SVC and MLP maintained the best balance between fit and generalization, with accuracy of 0.86 and 0.93, respectively; both attained average precision, recall, and F1-score above 0.85. By contrast, Random Forest and KNN exhibited greater performance degradation, with accuracies of 0.83 and 0.74, respectively. These findings indicate that, although the ViT provides a robust and consistent feature space, classifier selection remains a key factor for optimizing predictive performance and ensuring model stability on unseen data.