October 26, 2026
Classification of soybean seed hilum color using computer vision
Rafael Yuji Tani; Edilson José Rodrigues
DOI: 10.22167/2675-6528-202603387
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
The identification of hilum color in soybean seeds is crucial for agricultural productivity and genetic improvement. The objective was to apply computer vision techniques, using the MobileNetV2 architecture, to classify hilum color in soybean seeds. 500 images of seeds per class (“light brown”, “medium brown”, “black”, “imperfect black”) were collected and organized, forming a balanced database. The images were pre-processed and resized, and the model was trained in a TensorFlow/Keras environment. Performance was evaluated by accuracy, precision, recall, and F1-score. The results showed that the model classified the seeds with an overall accuracy of 52%, indicating limited performance. The “BLACK” class achieved the best precision (67%), while the “LIGHT-BROWN” class presented greater discrimination difficulty (recall of 72%). Low chromatic variability and dataset limitations negatively influenced performance. It was concluded that the approach is promising but requires improvements in the dataset and model architecture to achieve higher performance.
Keywords: Image classification; Plant phenotyping; MobileNetV2; Convolutional neural networks.
1. Introduction
Soybean (Glycine max (L.)) is one of the main agricultural crops in Brazil, accounting for over 40% of the gross value of national agricultural production (CONAB, 2024). The country has established itself as a world leader in the production and export of the grain, a result of decades of investment in genetic improvement, mechanization, and technological innovation (GAZZONI; DALL’AGNOL, 2018). Seed quality is one of the determining factors for productive success and for the competitiveness of the value chain, and the analysis of the hilum color is recognized as an important genetic and varietal marker (VERNETTI; VERNETTI JUNIOR, 2012).
Traditionally, thread evaluation is performed through visual inspection, a method that, although widely used, presents significant limitations related to subjectivity, variability among evaluators, and long execution time (ZHAO et al., 2021). This manual approach lacks objectivity and can introduce inconsistencies in classification, impacting the standardization and efficiency of evaluation processes.
In the context of artificial intelligence, convolutional neural networks (CNNs) have stood out as one of the main tools for pattern recognition in images. Unlike traditional machine learning methods, which depend on manual feature extraction, CNNs perform this process automatically, integrating the extraction and classification steps into a single model (HAMID et al., 2022).
The use of computer vision and deep learning techniques allows for the automation of seed quality analysis, reducing the subjectivity of traditional methods. In this context, optimized architectures, such as MobileNetV2, combine performance and low computational cost, being suitable for agricultural applications in controlled or field environments (ABRAHAMS et al., 2016). MobileNetV2 stands out for its computational efficiency and ability to maintain high performance with lower processing cost, being based on the concept of inverted residuals linear bottlenecks (SANDLER et al., 2018).
Additionally, research focused on plant phenotyping indicates that the application of computer vision and machine learning allows for the automated extraction of phenotypic characteristics with greater precision and efficiency compared to traditional methods, contributing to the support of genetic improvement programs (XING et al., 2022). Given the need for more objective methods, the application of computer vision and deep learning techniques has shown promise for automating the recognition and classification of seeds (RYBACKI et al., 2024). Thus, the present work aims to verify how a hilum color classification model can be applied to soybean seeds using computer vision techniques based on the MobileNetV2 architecture.
2. Material and Methods
This study adopted a computer vision and deep learning-based approach for the classification of the hilum color in soybean seeds, using convolutional neural networks (CNNs) and, specifically, the MobileNetV2 architecture. The research was characterized as applied, aiming to develop a technological solution for a practical problem in plant phenotyping, aligning with the objective of verifying the applicability of a hilum color classification model in soybean seeds.
The MobileNetV2 architecture was employed due to its computational efficiency and ability to maintain high performance with lower processing cost, making it suitable for applications in resource-constrained environments (SANDLER et al., 2018). Its operation was based on the combination of three fundamental principles: depthwise separable convolutions, inverted residuals, and linear bottlenecks.
Depthwise separable convolutions aim to reduce computational cost, while inverted residual blocks optimize information flow and feature reuse. Linear bottlenecks, in turn, preserve the integrity of information in compressed spaces, avoiding the loss of relevant data, since the final layer of the projection block is linear (SANDLER et al., 2018).
The unit of analysis consisted of soybean seeds (Glycine max (L.) Merr.). For data collection, the seeds were individually arranged on a standardized 3D-printed base. This base contained 100 cavities, organized in a 10 × 10 matrix, with holes of 4 mm radius, which allowed for regular seed positioning and standardization of photographic framing.
The 3D printed base was used on a flat surface to ensure geometric stability and repeatability between image captures. A camera was positioned on a fixed base, perpendicular to the plane of the seeds, maintaining a constant distance between the sensor and the photographed object. The images were captured under diffuse ambient lighting, without direct incidence of shadows, seeking to minimize variations in brightness and reflections.
The capture was performed with the same framing configuration, ensuring visual uniformity between the samples. The seeds were previously classified by selection of cultivars and confirmation of their phenotypic records, according to the national cultivar registry. Four classes of hilum color were defined: light brown, medium brown, black, and imperfect black, which constituted the reference base for image labeling.
From the original images, individual seed segmentation was performed, resulting in cropped images containing a single seed per file. For each of the four hilum color classes, 500 original images were obtained, totaling 2000 images in the initial set.
The images were subsequently standardized to a size of 96 × 96 pixels, preserving the original aspect ratio. This resizing was based on the recommendations of the MobileNetV2 architecture, which presents optimized performance for resolutions that are multiples of 32 (SANDLER et al., 2018). After resizing, the RGBA color space was converted to RGB, using controlled composition of the alpha channel.
Additionally, the database was augmented by rotating part of the images, a technique known as data augmentation. The final database, named DB_510_96x96, was organized in a didactic manner and compatible with TensorFlow’s import methods, being structured into three distinct subsets.
Seventy percent of the images were allocated for training, corresponding to 350 images per class. For model validation, 15% of the images were used, totaling 75 images per class. The remaining 15% of the images were reserved for the test set, also with 75 images per class.
The classification model was developed in a Python environment, using the TensorFlow and Keras libraries. For training, specific initial parameters were adopted: the “Adam” optimizer, with a learning rate of 0.001. The loss function used was categorical cross-entropy, and training was configured for 100 epochs with a batch size of 32.
The monitoring of the model’s performance during training was carried out through the TensorBoard platform. The complete code used for the development and training of the model is available in Annex I of the original work.
The performance evaluation of the classification model was carried out based on widely used metrics in computer vision studies applied to agriculture. The metrics employed included accuracy, precision, recall, and F1-score. Additionally, a confusion matrix was constructed to analyze classification errors and model robustness (ENKVETCHAKUL; SURINTA, 2021; YANG et al., 2024).
Accuracy measured the proportion of total correct classifications, precision indicated the reliability of positive predictions, and recall assessed the model’s ability to retrieve samples of a class (ZHAO et al., 2021). The F1-score, in turn, represented the harmonic mean between precision and recall, providing a balanced measure of the model’s performance (ZHAO et al., 2021).
3. Results and Discussion
The evaluation of the soybean seed hilum color classification model, using the MobileNetV2 architecture, revealed an overall accuracy of approximately 51.67% on the test set. Although this value is higher than the performance of random classification, which would be 25% for four classes, it indicates that the model showed limited performance in accurately distinguishing between the hilum color categories. This result suggests that, despite the model having captured general seed characteristics, it still faced significant challenges in discriminating subtle visual nuances between classes, as observed in similar plant phenotyping studies seeking high precision (XING et al., 2022).
The detailed analysis of the confusion matrix, which compares the actual classes with those predicted by the model, provided important insights into the patterns of errors and correct classifications. For the “LIGHT-BROWN” class, for example, out of 75 actual seeds, 54 were correctly classified. However, the model erroneously classified 23 “MEDIUM-BROWN” seeds, 18 “BLACK” seeds, and 30 “IMPERFECT-BLACK” seeds as “LIGHT-BROWN”, evidencing a tendency towards overclassification of this category. This difficulty in distinguishing classes with high visual similarity is a common challenge in fine-grained classification tasks, such as identifying seed characteristics (ZHAO et al., 2021).
The “MEDIUM-BROWN” class presented 42 correct classifications among the 75 actual seeds. However, 23 seeds of this class were erroneously identified as “LIGHT-BROWN”, 5 as “BLACK”, and 5 as “IMPERFECT-BLACK”. This mutual confusion between “MEDIUM-BROWN” and “LIGHT-BROWN” is particularly notable, indicating a significant visual overlap between these two shades. Such a phenomenon can be attributed to the low chromatic variability and reduced contrast between the classes, factors that compromise the neural network’s generalization capability (HAMID et al., 2022).
For the “BLACK” class, the model correctly classified 32 out of 75 actual seeds. It was observed that 18 “BLACK” seeds were erroneously classified as “LIGHT-BROWN” and 19 as “MEDIUM-BROWN”, in addition to 6 as “IMPERFECT-BLACK”. Finally, in the “IMPERFECT-BLACK” class, only 27 out of 75 seeds were correctly identified, with 30 being confused with “LIGHT-BROWN”, 10 with “MEDIUM-BROWN”, and 8 with “BLACK”. These confusion matrix results underscore the model’s limitations in handling the complexity of hilum color variations, especially where the differences are subtle.
The analysis of precision, recall, and F1-score metrics, which provide a more granular view of the model’s performance per class, complemented the evaluation of global accuracy. The “LIGHT-BROWN” class obtained a recall of 72%, the highest among the classes, indicating that the model was effective in identifying most seeds that actually belonged to this category. However, its precision was the lowest, at 43%, meaning that when the model predicted “LIGHT-BROWN”, it was correct less than half the time, due to a high number of false positives, i.e., seeds from other classes erroneously classified as “LIGHT-BROWN”.
In contrast, the “BLACK” class demonstrated the highest precision, reaching 67%. This means that when the model predicted “BLACK”, it was correct most of the time, indicating good reliability in positive predictions for this class. However, the recall for “BLACK” was only 43%, suggesting that many actual “BLACK” seeds were not identified by the model, resulting in a high number of false negatives. This characteristic points to a more conservative approach by the model when classifying seeds as “BLACK”, preferring not to classify rather than making a mistake, but missing many true instances.
The “MEDIUM-BROWN” and “IMPERFECT-BLACK” classes showed a slightly better balance between precision and recall, but still with room for improvement. “MEDIUM-BROWN” recorded a precision of 50% and a recall of 56%, while “IMPERFECT-BLACK” achieved a precision of 63% and a recall of 36%. The low recall for the “IMPERFECT-BLACK” class was particularly noteworthy, indicating that the model had significant difficulty in correctly identifying seeds of this category, with 64% of them being false negatives. This difficulty may be attributed to visual characteristics that were not adequately learned during training or that are easily confused with other classes.
The F1-score, which represents the harmonic mean between precision and recall, offering a balanced performance metric, also reflected the observed difficulties. The “LIGHT-BROWN” class obtained an F1-score of 0.54, influenced by low precision, despite high recall. The “IMPERFECT-BLACK” class presented the lowest F1-score, with 0.46, due to its low recall. These average values indicate that, although the model demonstrated some identification capability, the quantity of errors in predictions or the inability to retrieve all relevant instances pulled the metrics down, as the literature highlights the importance of the balance between precision and recall (ZHAO et al., 2021).
When comparing the obtained results with the interpretation intervals of performance metrics for classification models, it was observed that all accuracy, precision, recall, and F1-score values were below the minimum limits considered acceptable. For example, an acceptable accuracy would be 85% or higher, while the model achieved 51.67%. Similarly, acceptable precision, recall, and F1-score would be 0.85 or more, but the obtained values ranged between 0.36 and 0.72. This discrepancy indicates that, although the approach is technically feasible, the current model’s performance is limited for the task of classifying the hilum color in soybean seeds, according to the analysis by Sandler et al. (2018) on the evaluation of classification models.
The main source of confusion among classes lies in the visual similarities between the shades of yarn, especially between “LIGHT-BROWN” and “MEDIUM-BROWN”, and between “IMPERFECT-BLACK” and “LIGHT-BROWN”. These chromatic overlaps hinder the model’s ability to extract robust discriminatory features, even with the MobileNetV2 architecture, which is optimized for computational efficiency (SANDLER et al., 2018). Low chromatic variability and reduced contrast between classes directly impacted the neural network’s generalization capability, compromising its effectiveness in fine distinction.
Despite the observed performance limitations, the application of computer vision techniques based on the MobileNetV2 architecture for classifying the color of the thread in soybean seeds proved to be technically feasible. The results indicate that the approach allows for the automatic identification of the analyzed classes, representing an advancement over traditional visual inspection methods, which are subjective and time-consuming (ZHAO et al., 2021). The ability to automate this process holds significant potential for the field of plant phenotyping, contributing to the standardization of classification and the reduction of human errors.
To improve the model’s performance and overcome the identified limitations, methodological adjustments and refinements in the training process are necessary. Expanding the quality and volume of the dataset, for example, is crucial, as the 500 images per class used may not have sufficiently represented the intra-class and inter-class variability. The inclusion of greater diversity of materials and the application of data augmentation techniques, such as rotation, variations in brightness, contrast, saturation, noise insertion, and reflections, are promising for artificially expanding the dataset and improving the network’s generalization capability (ENKVETCHAKUL; SURINTA, 2021).
Furthermore, the investigation of deeper or hybrid neural network architectures, with greater representation capacity, can be an effective strategy to overcome the limitations observed in the classification of subtle visual patterns. The application of this approach, once enhanced, can significantly assist in soybean genetic improvement programs, increasing the efficiency of evaluation processes and providing more objective data for cultivar selection (RYBACKI et al., 2024). Thus, the findings of this study, although pointing to limited performance under current conditions, confirm the promise of computer vision for plant phenotyping, highlighting the need for future optimizations to achieve higher levels of accuracy and robustness.
4. Conclusion
This study sought to verify the application of a hilum color classification model in soybean seeds, using computer vision techniques based on the MobileNetV2 architecture. It was found that the model demonstrated the ability to classify the seeds, achieving an overall accuracy of 52% on the test set. Although this performance is superior to random classification, it indicated limitations in precisely distinguishing between color categories. It was observed that the “BLACK” class achieved the best precision, with 67%, while the “LIGHT BROWN” class presented greater discrimination difficulty, with a recall of 72% and the lowest precision of 43%. This discrepancy in per-class metrics revealed a tendency towards overclassification of “LIGHT BROWN” and a more conservative approach for “BLACK”. Detailed analysis indicated that low chromatic variability and reduced contrast between classes, especially between shades of brown and imperfect black, were factors that compromised the generalization capability of the neural network.
Despite performance limitations, the computer vision approach with MobileNetV2 for soybean seed thread color classification proved technically feasible, representing an advancement over traditional visual inspection methods, which are subjective and time-consuming. The main contribution lies in the potential to automate plant phenotyping, standardizing classification and reducing human errors, which can significantly aid soybean breeding programs. However, the current model’s performance is limited for the task, with all metrics below acceptable ranges. For future improvements, it is suggested to expand the quality and volume of the dataset, including greater diversity of materials and applying data augmentation techniques, such as rotation and brightness variation. It is also recommended to investigate deeper or hybrid neural network architectures with greater representation capacity to overcome difficulties in classifying subtle visual patterns.
Bibliographic References
ABRAHAMS, S.; HAFNER, D.; ERWITT, E.; SCARPINELLI, A. TensorFlow for Machine Intelligence: A Hands-On Introduction to Learning Algorithms. Santa Rosa, CA: Bleeding Edge Press, 2016. Disponível em: https://www.hlevkin.com/hlevkin/45MachineDeepLearning/DL/TensorFlow-for-Machine-Intelligence-A-Hands-On-Introduction-to-Learning-Algorithms.pdf. Acesso em: 2 out. 2025.
CONAB – COMPANHIA NACIONAL DE ABASTECIMENTO. Acompanhamento da Safra Brasileira de Grãos: Safra 2023/2024. Brasília, DF: Conab, 2024. Disponível em: https://www.gov.br/conab/pt-br/atuacao/informacoes-agropecuarias/safras/safra-de-graos. Acesso em: 2 nov. 2025.
ENKVETCHAKUL, Prem; SURINTA, Olarik. Effective data augmentation and training techniques for improving deep learning in plant leaf disease recognition. Applied Science and Engineering Progress, 2021. DOI: https://doi.org/10.14416/j.asep.2021.01.003. Disponível em: http://ojs.kmutnb.ac.th/index.php/ijst/article/view/3810. Acesso em: 12 nov. 2025.
GAZZONI, D. L.; DALL’AGNOL, A. A saga da soja: de 1050 a.C. a 2050 d.C. Brasília, DF: Embrapa, 2018. Disponível em: https://www.embrapa.br/busca-de-publicacoes/-/publicacao/1093166/a-saga-da-soja-de-1050-ac-a-2050-dc. Acesso em: 10 out. 2025.
HAMID, Yasir; WANI, Sharyar; SOOMRO, Arjumand Bano; ALWAN, Ali A.; GULZAR, Yonis. Smart seed classification system based on MobileNetV2 architecture. In: 2022 2nd International Conference on Computing and Information Technology (ICCIT), 25 – 27 January 2022, Saudi Arabia. Disponível em: https://irep.iium.edu.my/101722/. Acesso em: 2 out. 2025.
RYBACKI, M. et al. Three-Dimensional Convolutional Neural Networks (3D-CNN) in the Classification of Varieties and Quality Assessment of Soybean Seeds (Glycine max L. Merrill). Computers and Electronics in Agriculture, v. 215, p. 108437, 2024. DOI: 10.1016/j.compag.2024.108437. Disponível em: https://pmc.ncbi.nlm.nih.gov/articles/PMC11547699/. Acesso em: 25 out. 2025
SANDLER, M. et al. MobileNetV2: Inverted Residuals and Linear Bottlenecks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018. Disponível em: https://openaccess.thecvf.com/content_cvpr_2018/papers/Sandler_MobileNetV2_Inverted_Residuals_CVPR_2018_paper.pdf. Acesso em: 10 fev. 2026.
VERNETTI, F. de J.; VERNETTI JUNIOR, F. de J. Genética da soja: caracteres qualitativos e diversidade genética. 2. ed. Brasília, DF: Embrapa, 2012.
XING, Y.; LV, P.; HE, H.; LENG, J.; YU, H.; FENG, X. Traits expansion and storage of soybean phenotypic data in computer vision-based test. Frontiers in Plant Science, v. 13, 2022. DOI: https://doi.org/10.3389/fpls.2022.832592. Disponível em: https://www.frontiersin.org/journals/plant-science/articles/10.3389/fpls.2022.832592/full. Acesso em: 24 jan. 2026.
YANG, Xu; MA, Kejia; ZHANG, Dejia; SONG, Shaozhong; AN, Xiaofeng. Classification of soybean seeds based on RGB reconstruction of hyperspectral images. PLOS ONE, v. 19, n. 9, 2024. DOI: 10.1371/journal.pone.0307329. Disponível em: https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0307329. Acesso em: 13 nov. 2025.
ZHAO, G.; LIU, X.; ZHANG, Y.; et al. Real-time recognition system of soybean seed full-surface defects based on deep learning. Computers and Electronics in Agriculture, v. 187, 2021. DOI: https://doi.org/10.1016/j.compag.2021.106230. Disponível em: https://www.sciencedirect.com/science/article/abs/pii/S0168169921002477?via%3Dihub. Acesso em: 3 nov. 2025
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform