Intelligent Weed Detection and Crop Classification Using a ResNet50-Based Convolutional Neural Network for Precision Agriculture
Keywords:
Precision agriculture, ResNet50, Transfer learning, Weed detection, Crop classification, Deep learning, Computer visionAbstract
The increasing impact of weed infestation on crop production has created the need for intelligent and automated weed detection systems capable of improving agricultural productivity while reducing excessive herbicide application. This study developed and evaluated an intelligent weed detection and crop classification system based on a Convolutional Neural Network (CNN) using the ResNet50 architecture with transfer learning. A diverse image dataset comprising maize, rice, beans, soybeans, groundnuts, and weed samples was collected and prepared through image preprocessing, normalization, and data augmentation techniques. All images were resized to 224 × 224 pixels, and the dataset was partitioned into training, validation, and testing subsets using a stratified ratio of 80%, 10%, and 10%, respectively. Transfer learning using the ResNet50 architecture was adopted, followed by fine-tuning of the upper network layers to enhance feature extraction and classification performance while class weighting and optimization strategies were applied to address class imbalance and enhance learning performance. The developed model was evaluated using accuracy, precision, recall, F1-score, confusion matrix, and validation loss. The results showed that the proposed model achieved a classification accuracy of 94.86%, demonstrating its ability to distinguish weeds from crops under varying illumination, background complexity, and plant growth stages. Rice achieved perfect classification performance, while Beans, Groundnuts, Maize, and Soybeans also recorded high precision, recall, and F1-score values. Although the Weed class exhibited relatively lower recall due to limited sample availability and morphological variability, it maintained perfect precision, indicating highly reliable predictions whenever weeds were detected. The results further demonstrate that the residual learning mechanism of ResNet50 effectively captured discriminative visual features, including leaf morphology, texture, and plant structure, thereby enhancing classification performance under varying agricultural field conditions. The developed model outperformed comparable CNN-based weed detection approaches reported in the literature with a classification accuracy of 89.30%, confirming the effectiveness of ResNet50 and transfer learning for agricultural image classification. The study concludes that the proposed system provides a robust, accurate, and computationally efficient solution for intelligent weed detection and crop classification, with significant potential for deployment in precision herbicide spraying, agricultural robotics, and real-time smart farming applications.

