CoFly-Project / Weed-Detection

Weed detection on problematic areas in terms on vegetation health.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weed-Detection

The main objective of the Weed-Detection module is to provide a more thorough inspection on problematic areas, as have been extracted from the Problematic-Areas-Detection module in terms of plant health and provide valuable information to the end-user. In specific, the developed module is based on the pretrained DeepLabv3+ instance was pretrained on PASCAL VOC 2012 dataset and further trained on the CoFly-WeedDB dataset for the weed semantic segmentation task. The developed module is capable of semantically segmenting weed instances depicted on input RGB images and thus, provides accurate information regarding the location of detected weeds. In Figure 1, we present an overview of the Weed-Detection module.

Figure 1. Workflow of the Weed-Detection module. The detected weeds are annotated with pink color.

Concerning about the training and evaluation of the detector, the developed dataset (CoFly-WeedDB) was split to a training (80%) and a testing (20%) set where depicted weed clusters are labeled as “weed” while the rest of the image is annotated as “background”. The splitting process was repeated 3 times aiming to create subsets with different class distribution in order to conduct a more thorough evaluation of the employed detector. Also:

  • The model was trained for 500 epochs with a batch size of 12
  • As an optimization algorithm, Adam solver with a learning rate equal to 10−3 was selected
  • In order to tackle the imbalance issue among the dataset classes, focal loss was employed
  • Data augmentation techniques were utilized to enhance the generalization ability of the model. In specific, every input image of the training set was horizontally/vertical flipped and randomly resized in a scale between 0.5 to 1.5 times of the initial size with a chance of 50%

In Table 1, we present the results of the detector per split.

Background Weed mIoU
Split 1 95.44 44.93 70.18
Split 2 95.83 43.49 69.66
Split 3 96.62 43.96 70.29

Table 1. Model accuracy in terms of IoU (%).

How to run

  1. Clone this repo
  2. Open terminal on ~REPO_PATH
  3. Run:
python3 weed_detection.py --input_folder ~INPUT_FOLDER_PATH --output_folder ~OUTPUT_FOLDER_PATH

ARGUMEΝTS

  • --input_folder: refers to the path of the folder where the images are stored
  • --output_folder: refers to the path where the annotated images and the corresponding masks will be saved

Results

Visualizations

(a) Input RGB image (b) Ground truth (c) Predicted mask (d) Overlay

Figure 2. Results from the Weed-Detection module.

Dependencies

Install all the neccecary dependencies using pip3 install <package name>

Required packages:

  • argparse (version >= 1.1)
  • opencv-python (version >= 4.5.3)
  • numpy (version >= 1.19.5)
  • matplotlib (version >= 3.2.2)
  • tensorflow (version >= 2.7.0)
  • keras (version == 2.7.0)
  • segmentation-models (version == 1.0.1)

Note: The versions of tensorflow, keras and segmentation-models should be compatible.

Citation

(not published yet)

Acknowledgment

This research has been financed by the European Regional Development Fund of the European Union and Greek national funds through the Operational Program Competitiveness, Entrepreneurship and Innovation, under the call RESEARCH - CREATE - INNOVATE (T1EDK-00636).

About

Weed detection on problematic areas in terms on vegetation health.

License:MIT License


Languages

Language:Python 100.0%