AI-Powered Multi-Class Deep Learning Model for Early Detection of Aflatoxins: Enhancing Food Safety and Market Access in Ugandan Groundnuts
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Aflatoxin contamination in groundnuts remains a critical challenge to food safety, trade compliance, and farmer livelihoods across sub-Saharan Africa. In Uganda, up to 40% of groundnut harvests are rejected annually, resulting in estimated economic losses exceeding USD 1.2 billion. This study presents an AI-powered multi-class deep learning model for early detection of aflatoxin-related defects in groundnuts. The model employs the Inception-ResNet-V2 architecture to classify images into four categories: Healthy, Moldy, Pest-Infested, and Physiological disorders achieving a classification accuracy of 99.29% and class-specific AUC scores of 1.00 (Moldy), 0.98 (Healthy), 0.97 (Pest-Infested), and 0.99 (Physiological Disorders).Unlike traditional binary classifiers, this multi-class approach enables fine-grained identification of contamination sources such as fungal molds and minute pest damage (≈ 0.2 mm) often overlooked by conventional inspection methods. The model’s development followed the Design Science Research (DSR) methodology and CRISP-DM process, integrating class-specific augmentation, transfer learning, and customized loss functions to address data imbalance. Optimized for real-time edge deployment, the model operates 140 times faster than manual inspection, processing over 200 samples per minute while reducing training data requirements by 60% compared to end-to-end models.Results demonstrate strong potential for mobile-based screening in smallholder farming contexts, offering a scalable and low-cost alternative to laboratory testing. The deployment of this AI system could reduce aflatoxin-related export rejections by up to 50%, cut laboratory testing costs by 60%, and improve regulatory compliance by 90%. Beyond its technical contributions, this research underscores the transformative role of artificial intelligence in advancing food safety, market access, and public health within agricultural value chains.