In modern agriculture, optimizing crop yield is vital amidst weed-related challenges. We tackle this by innovatively employing π§ CNNs and π Darknet to distinguish crops from weeds
Develop and optimize a tailored object detection model by seamlessly integrating π YOLO architecture into π Darknet. Leveraging π§ CNNs enhances accuracy and efficiency, enabling precise crop and weed differentiation in agricultural images. This project aims to establish a foundation for effective weed management and cultivation strategies.
We have collected 2000 images containing a diverse representation of both weed and crop. This dataset includes prior information regarding bounding boxes and class labels, recorded within a dedicated text file. This text file provides essential information, including class labels, Normalized coordinates (X and Y), as well as dimensions (Width and Length).
1. Training
2. Performig detection
- Using jupyter and openCV
- First, π git clone and upload the
WeedDetection
folder into Google Drive. - Now, in Google Drive, open the
main.ipynb
file, underWeedDetection->WeedDetectionSystem
, where you will find comprehensive documentation regarding training the model. - Note : The image dataset is placed in the following link. Copy the file and place it in the following path
WeedDetection->WeedDetectionSystem
in google drive. - (DO NOT UNZIP AFTER PLACING IT)
- Images-with-bounding-boxes
-
First of all you need anaconda, if you don't have click here for the installation. Anaconda here
-
Next download and save the
testing_and_detection
folder to your local system from google drive located under the folderWeedDetection
. -
Open Anaconda launcher and upload the folder
testing_and_detection
.- Select the "file option" --> Open from path --> provide path --> Open.
- path example: C:\Users\SHIVAAMRUTH UPPALA\OneDrive\Desktop\WeedDetectionSystem\testing_and_detection.
- For detection, you need weights for π§ CNN.
- These weights file must be placed in the below mentioned path in your local system once the model is trained:
- WeedDetection-->testing_and_detection-->data-->weights.
- Now, open
Weed_Image_Recognition.ipynb
underWeedDetection-->testing_and_detection-->detection
and run each cell for results.
Important: We have already generated the weight file and placed it in the designated Google Drive link. This step was taken to minimize the training time required. If you decide not to conduct the training, you can utilize this file. Please be aware that training this model typically takes 6-7 hours.
- LOSS CURVE:
- Weed Detection:
- Metrics for trained Weights:
- Average IOU (Intersection Over Union): 71%
- Mean Average Precision: 77%
- Redmon, J. (2015, June 8). You Only Look Once: Unified, Real-Time Object Detection. arXiv:1506.02640.
- Wang, C. Y. (2022, July 6). YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv:2207.02696.
- Alexey. βAlexeyAB/Darknet.β GitHub, 21 Aug. 2020, DARKNET