# A Metaheuristic Harris Hawks Optimization Algorithm for Weed Detection Using Drone Images
## 3 Proposed Framework
### Dataset Collection and Preprocessing  
A detailed description of the dataset of this study and the key pre-trained models is provided in this section. UAVs equipped with cameras are capable of capturing field crops using sensors. An autonomous aerial sprayer drone was used to capture the images of wheat crops in this study, and the dataset is freely available on Kaggle ([[https://www.kaggle.com/datasets/gavinarmstrong/open-sprayer-images](https://www.kaggle.com/datasets/gavinarmstrong/open-sprayer-images)]([https://www.kaggle.com/datasets/gavinarmstrong/open-sprayer-images](https://www.kaggle.com/datasets/gavinarmstrong/open-sprayer-images)), accessed on 4 February 2023). The  
Figure 1: DenseHHO Framework.  
\"Open Sprayer Images\" dataset includes images related to agricultural sprayers. The UAV type typically used in conjunction with sprayers is a multirotor UAV or a fixed-wing UAV. The \"Open Sprayer Images\" dataset provides sample images and visual representations associated with the dataset. However, the creator did not add any details about the UAV or Flight parameters. Furthermore, it is explained that all the collected photos should be retaken from a higher elevation. Based on the assumption that the sprayer will cover a 3 m width, he might be able to use one camera mounted high enough to view 3.5 m with 0.5 m of overlap. The resolution and size of the photos can be easily changed by changing the camera settings or dividing the photos into sections before processing. Dock leaves do stand out quite well from the grass background, so hopefully, a picture taken from a greater distance will provide enough information to classify the leaves. Images of broad-leafed docks and pictures of shorelines without broad-leafed docks are included in the dataset. In the context of weed detection, \"dock\" typically refers to a group of weed species belonging to the Rumex genus. Common dock species include broadleaf weeds such as curly dock (Rumex crispus) and broadleaf dock (Rumex obtusifolius) [19]. These plants typically have broad leaves with distinctive veining and are often considered undesirable in agricultural or landscaping settings. Figures 2 and 3 show examples of images from this dataset. The dataset is comprised of 1176 wheat and 4851 weed images, respectively. A total of 540 images of weeds and 130 images of wheat are included in the testing set.  
As the images were derived from various sources, there may be variations in shapes, brightness, and contrast. All Weed-Spray images were resized to (256, 256, 3), and augmented using a 2-layer augmentation. To increase the diversity of the gathered datasets and making our models more robust, all fused weed scans have undergone a two-layer augmentation process:  
1. Random Flip: This layer will perform horizontal and vertical mirroring through the reversal of rows/columns of pixels. \(tf\_keras.layers.RandomFlip\) (\(mode=\)_'horizontal_and_vertical'_).
2. Random Rotation: This layer will apply random rotations to each image. The factor here is a float represented as a fraction of 0.1.