# Assessment of Aquatic Weed in Irrigation Channels Using UAV and Satellite Imagery
## 2 Materials and Methods
### Image Processing
#### 2.4.6 Classification  
The images were classified into areas of water, land and weed. A number of supervised classification methods provided in GEE were tested. The obvious way to classify the images is to define geometries identifying areas of water, land and weed for each image, sample the pixels of the image within each geometry, and pass these labelled samples to the classification algorithm. However, it quickly became apparent that this is both time-consuming and prone to error once multiple images need to be processed (for example, a time series of multiple stretches of channel to detect weed area change over time). If a classifier is trained on one image, and applied to another, it is likely that water colour changes, weed variation and land vegetation variation on the channel banks will cause the classification of the new image to be inaccurate. This was observed in this study. One alternative is to train the classifier using samples from many images over multiple areas and times; however, this is time consuming as new polygons need to be manually drawn for each image. There is also no guarantee that the images chosen to train the classification on will cover all the spectral characteristics of the classes that will be encountered in future images. Clearly, a method is needed to enable robust classification of images that does not rely on users spending significant time drawing new polygons identifying classes for each new image. To this end, a semi-automatic method to re-train the classifier for each new image was developed using a combination of unsupervised and supervised classification. The unsupervised classification automatically finds geometries of water and weed to sample within to train the supervised classifier. The steps are as follows (illustrated in Figure 3):  
* For land areas, a number of polygon geometries covering land areas around the edges of the channels are drawn. Land areas do not change with time, so they can be used for all new images. These areas were then used as the sampling geometries to generate training data for the land class. * For water areas, clustering analysis (unsupervised classification) is used to automatically find areas of water in the image:
* The clustering is performed using the band with best separability between the water class and the other classes. The K-Means clustering method implemented in GEE was used with three clusters. * The mean NDWI of each of the clusters is calculated (as NDWI was found to give the best separability between water and other classes, shown in Section 3.1.1 below). The cluster with the maximum NDWI is used as the sampling geometry to generate training data for the water class. * To find weed areas, polygons were drawn covering only channel areas with reasonable distribution between water and weed (excluding land). These areas thus only contained water and weed. Clustering analysis was again performed on the NDWI of these channel areas with a similar method as that described above. The cluster with minimum NDWI was used as the sampling geometry to generate training data for the weed class. This combination of unsupervised classification and supervised classification results in a robust and time-efficient method, where a new classifier is generated for each new image. The definition of training polygons is simple, as only polygons covering some of the land in an image, and some of the channel area in an image are needed. These same polygons can be used over multiple images of the same area in a time series, as the clustering automatically separates the water and weed areas for sampling (the user does not need to manually define weed/water areas for each new image). To validate this classification procedure, manual validation geometries were drawn on selected images defining areas of land, water and weed. These geometries were separate to the land and channel polygons used for training the classifier to ensure fair assessment of classifier performance.