Cannabis Seeds Classification Using HOG Feature Extraction Based SVM Optimization
Downloads
Cannabis is the second most common psychoactive drug in the world, and Thailand is the only country in Southeast Asia that allows people to use it. To maintain the integrity of different cannabis varieties and get the most out of their crops, growers, seed sellers, and farmers need to be able to accurately classify cannabis seed kinds. This paper presents a method for categorizing Thai cannabis seeds through the integration of Histogram of Oriented Gradients (HOG) feature extraction and Support Vector Machine (SVM) optimization, utilizing k-fold cross-validation and grid search methodologies. The suggested method worked well for smartly sorting different types of cannabis seeds. The regular SVM classifier got 94.11% accuracy, the k-fold cross-validation (K=10) got 94.00%, and the grid search optimization got 93.91%. These results indicate that the proposed method is both reliable and efficient for distinguishing cannabis seed varieties. Beyond its direct application to Thailand’s cannabis industry, the approach demonstrates the potential of combining HOG-based feature extraction with SVM optimization for other seed classification tasks in agriculture. By providing a scalable and accurate tool for seed identification, this work supports quality control, traceability, and productivity improvement in legal cannabis cultivation and trade.
Downloads
[1] Bahji, A., & Stephenson, C. (2019). International perspectives on the implications of cannabis legalization: A systematic review & thematic analysis. International Journal of Environmental Research and Public Health, 16(17), 3095. doi:10.3390/ijerph16173095.
[2] Yimsaard, P., Lancaster, K. E., & Sohn, A. H. (2023). Potential impact of Thailand’s cannabis policy on the health of young adults: current status and future landscape. The Lancet Regional Health - Southeast Asia, 10, 100145. doi:10.1016/j.lansea.2023.100145.
[3] Thailand approves medical marijuana in New Year’s “gift”, CNBC, (2018). Available online: https://www.cnbc.com/2018/12/25/thailand-approves-medical-marijuana-in-new-yearsgift.html (accessed on November 2025).
[4] Medical cannabis is gaining momentum in Asia, G. Shao, CNBC, (2019). Available online: https://www.cnbc.com/2019/07/15/medical-cannabis-is-gaining-momentum-in-asia.html (accessed on November 2025).
[5] ElMasry, G., ElGamal, R., Mandour, N., Gou, P., Al-Rejaie, S., Belin, E., & Rousseau, D. (2020). Emerging thermal imaging techniques for seed quality evaluation: Principles and applications. Food Research International, 131, 109025. doi:10.1016/j.foodres.2020.109025.
[6] Sarker, T. T., Islam, T., & Ahmed, K. R. (2024). Cannabis Seed Variant Detection Using Faster R-CNN. 10th International Conference on Advanced Computing and Communication Systems, ICACCS 2024, 1, 1403–1408. doi:10.1109/ICACCS60874.2024.10716962.
[7] Islam, T., Sarker, T. T., Ahmed, K. R., & Lakhssassi, N. (2024). Detection and Classification of Cannabis Seeds Using RetinaNet and Faster R-CNN. Seeds, 3(3), 456–478. doi:10.3390/seeds3030031.
[8] Jena, B., Saxena, S., Nayak, G. K., Saba, L., Sharma, N., & Suri, J. S. (2021). Artificial intelligence-based hybrid deep learning models for image classification: The first narrative review. Computers in Biology and Medicine, 137, 104803. doi:10.1016/j.compbiomed.2021.104803.
[9] Fabiyi, S. D., Vu, H., Tachtatzis, C., Murray, P., Harle, D., Dao, T. K., Andonovic, I., Ren, J., & Marshall, S. (2020). Varietal Classification of Rice Seeds Using RGB and Hyperspectral Images. IEEE Access, 8, 22493–22505. doi:10.1109/ACCESS.2020.2969847.
[10] de Medeiros, A. D., Capobiango, N. P., da Silva, J. M., da Silva, L. J., da Silva, C. B., & dos Santos Dias, D. C. F. (2020). Interactive machine learning for soybean seed and seedling quality classification. Scientific Reports, 10(1), 11267. doi:10.1038/s41598-020-68273-y.
[11] Javanmardi, S., Miraei Ashtiani, S. H., Verbeek, F. J., & Martynenko, A. (2021). Computer-vision classification of corn seed varieties using deep convolutional neural network. Journal of Stored Products Research, 92, 101800. doi:10.1016/j.jspr.2021.101800.
[12] Loddo, A., Loddo, M., & Di Ruberto, C. (2021). A novel deep learning based approach for seed image classification and retrieval. Computers and Electronics in Agriculture, 187, 106269. doi:10.1016/j.compag.2021.106269.
[13] Luo, T., Zhao, J., Gu, Y., Zhang, S., Qiao, X., Tian, W., & Han, Y. (2023). Classification of weed seeds based on visual images and deep learning. Information Processing in Agriculture, 10(1), 40–51. doi:10.1016/j.inpa.2021.10.002.
[14] Sabanci, K., Aslan, M. F., Ropelewska, E., & Unlersen, M. F. (2022). A convolutional neural network-based comparative study for pepper seed classification: Analysis of selected deep features with support vector machine. Journal of Food Process Engineering, 45(6), 13955. doi:10.1111/jfpe.13955.
[15] Khojastehnazhand, M., & Roostaei, M. (2022). Classification of seven Iranian wheat varieties using texture features. Expert Systems with Applications, 199, 117014. doi:10.1016/j.eswa.2022.117014.
[16] Ma, X., Li, Y., Wan, L., Xu, Z., Song, J., & Huang, J. (2023). Classification of seed corn ears based on custom lightweight convolutional neural network and improved training strategies. Engineering Applications of Artificial Intelligence, 120, 105936. doi:10.1016/j.engappai.2023.105936.
[17] Rahmani, N., & Mani-Varnosfaderani, A. (2023). Excitation-emission fluorescence spectroscopy and sparse chemometric methods for grape seed oil classification and authentication. Chemometrics and Intelligent Laboratory Systems, 241, 104939. doi:10.1016/j.chemolab.2023.104939.
[18] Zhang, L., Huang, J., Wei, Y., Liu, J., An, D., & Wu, J. (2023). Open set maize seed variety classification using hyperspectral imaging coupled with a dual deep SVDD-based incremental learning framework. Expert Systems with Applications, 234, 121043. doi:10.1016/j.eswa.2023.121043.
[19] Chen, B., Shi, B., Gong, J., Shi, G., Jin, H., Qin, T., Yang, Z., Lim, K. J., Liu, W., Zhang, J., & Wang, Z. (2024). Quality detection and variety classification of pecan seeds using hyperspectral imaging technology combined with machine learning. Journal of Food Composition and Analysis, 131, 106248. doi:10.1016/j.jfca.2024.106248.
[20] Bai, R., Zhou, J., Wang, S., Zhang, Y., Nan, T., Yang, B., Zhang, C., & Yang, J. (2024). Identification and Classification of Coix seed Storage Years Based on Hyperspectral Imaging Technology Combined with Deep Learning. Foods, 13(3), 498. doi:10.3390/foods13030498.
[21] Ekramirad, N., Doyle, L., Loeb, J., Santra, D., & Adedeji, A. A. (2024). Hyperspectral Imaging and Machine Learning as a Nondestructive Method for Proso Millet Seed Detection and Classification. Foods, 13(9). doi:10.3390/foods13091330.
[22] Leng, T., Wang, Y., Wang, Z., Hu, X., Yuan, T., Yu, Q., Xie, J., & Chen, Y. (2025). Rapid classification of Camellia seed varieties and non-destructive high-throughput quantitative analysis of fatty acids based on non-targeted fingerprint spectroscopy combined with chemometrics. Food Chemistry, 474, 143181. doi:10.1016/j.foodchem.2025.143181.
[23] Kılıç, İ., & Yalçın, N. (2025). A Novel Hybrid Methodology Based on Transfer Learning, Machine Learning, and ReliefF for Chickpea Seed Variety Classification. Applied Sciences (Switzerland), 15(3), 1334. doi:10.3390/app15031334.
[24] Song, S., Chen, Z., Yu, H., Xue, M., & Liu, J. (2024). Rapid and accurate classification of mung bean seeds based on HPMobileNet. Frontiers in Plant Science, 15, 1474906. doi:10.3389/fpls.2024.1474906.
[25] Isles, M. C. A., Pagkaliwangan, D. L. A., & Caya, M. V. C. (2025). Sunflower Seed Variety and Quantity Identification Using YOLOv8 and DeepSORT Algorithm. Proceedings of the 2025 19th International Conference on Ubiquitous Information Management and Communication, IMCOM 2025, 1–6. doi:10.1109/IMCOM64595.2025.10857435.
[26] Jafari, F., & Basu, A. (2023). Saliency-Driven Hand Gesture Recognition Incorporating Histogram of Oriented Gradients (HOG) and Deep Learning. Sensors, 23(18), 7790. doi:10.3390/s23187790.
[27] Sharma, S., Raja, L., Bhatnagar, V., Sharma, D., Bhagirath, S. N., & Poonia, R. C. (2022). Hybrid HOG-SVM encrypted face detection and recognition model. Journal of Discrete Mathematical Sciences and Cryptography, 25(1), 205–218. doi:10.1080/09720529.2021.2014141.
[28] Bai, K., Zhou, Y., Cui, Z., Bao, W., Zhang, N., & Zhai, Y. (2022). HOG-SVM-Based Image Feature Classification Method for Sound Recognition of Power Equipments. Energies, 15(12), 4449. doi:10.3390/en15124449.
[29] Dalal, N., & Triggs, B. (2005). Histograms of Oriented Gradients for Human Detection. IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), San Diego, CA, USA (20-25 June 2005), 886–893. doi:10.1109/cvpr.2005.177.
[30] Olgun, M., Onarcan, A. O., Özkan, K., Işik, Ş., Sezer, O., Özgişi, K., Ayter, N. G., Başçiftçi, Z. B., Ardiç, M., & Koyuncu, O. (2016). Wheat grain classification by using dense SIFT features with SVM classifier. Computers and Electronics in Agriculture, 122, 185–190. doi:10.1016/j.compag.2016.01.033.
[31] Yan, T., Shen, S. L., Zhou, A., & Chen, X. (2022). Prediction of geological characteristics from shield operational parameters by integrating grid search and K-fold cross validation into stacking classification algorithm. Journal of Rock Mechanics and Geotechnical Engineering, 14(4), 1292–1303. doi:10.1016/j.jrmge.2022.03.002.
[32] Belete, D. M., & Huchaiah, M. D. (2022). Grid search in hyperparameter optimization of machine learning models for prediction of HIV/AIDS test results. International Journal of Computers and Applications, 44(9), 875–886. doi:10.1080/1206212X.2021.1974663.
[33] Chumchu, P., & Patil, K. (2023). Dataset of cannabis seeds for machine learning applications. Data in Brief, 47, 108954. doi:10.1016/j.dib.2023.108954.
[34] Anwar, F., Latif, S., & Ashraf, M. (2006). Analytical characterization of hemp (Cannabis sativa) seed oil from different agro-ecological zones of Pakistan. JAOCS, Journal of the American Oil Chemists’ Society, 83(4), 323–329. doi:10.1007/s11746-006-1207-x.
[35] Jiao, Y., & Du, P. (2016). Performance measures in evaluating machine learning based bioinformatics predictors for classifications. Quantitative Biology, 4(4), 320–330. doi:10.1007/s40484-016-0081-2.
- The authors retain all copyrights. It is noticeable that authors will not be forced to sign any copyright transfer agreements.
- This work (including HTML and PDF Files) is licensed under a Creative Commons Attribution 4.0 International License.














