## 2 Materials and Methods
### Experiments Description: Algorithm Training and Validation  
In order to evaluate the feasibility of implementing a computer vision water quality monitoring system in ports, three experiments have been carried out in the present study using a CNN type system. The experiments intend to evaluate the feasibility of a computer vision system in port environmental management and the performance impact of the results on image set size and distribution. The main characteristics of each experiment are shown in Table 1, including the research objectives. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Experiment Number** & **Research Objective** & **Number of Images** & **Image Resolution** \\  & & **(Spill/Waste/Clean Water)** & **(Pixels)** \\ \hline Experiment 1 & \begin{tabular}{c} Screening of computer vision system \\ overall performance and feasibility \\ for port environmental management \\ Investigating the performance impact \\ of image set distribution \\ \end{tabular} & 389/330/660 & 300 \(\times\) 300 \\ Experiment 2 & \
\begin{tabular}{c} Investigating the performance impact \\ of image set distribution \\ Investigating the performance impact \\ of image set size \\ \end{tabular} & 1320 images in different proportions & 256 \(\times\) 256 \\ Experiment 3 &
\begin{tabular}{c} Investigating the performance impact \\ of image set size \\ \end{tabular} & Different numbers in equal proportions & 256 \(\times\) 256 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of computer vision experiments in the current study. Figure 5: Example images for each class. Keras open-source software library for Python (version: 2.4.3) on Tensorflow Google developed open-source software library (version: 2.3.0) backend framework based on the Anaconda3 platform was used in these experiments. Python 3.8.10 programming language was used for training and validation process programming. The computer used was equipped with an Intel Core i7-6700 HQ CPU with 16 GB RAM and a NVIDIA GeForce GTX 960M graphics card. The computer operating system was the 64-bit Windows 10 home edition. In the three experiments, a neural network InceptionV3, with \"imagenet\" weights and a 3-channel resolution was deployed. InceptionV3 was chosen between Keras available models, after discarding models designed for mobile devices considering the compromise between accuracy and speed according to Keras documentation [28] and CNN research [29; 30]. An additional GlobalAveragePooling2D layer was added with 1024 additional neurons with ReLU activation (0.2 dropout), as well as another layer with 3 neurons with softmax activation. The latter layer is the one bearing the spill/waste/clean water class information. In order to feed the neural network, two image generators were used. For the training images, a series of transformations were applied (rotation, horizontal and vertical shifts, crop, zoom and horizontal reflex) including a standard normalization. In addition, data augmentation techniques were used on the image set [31]. For image validation purposes, only normalization was applied. Data ingestion was carried out in batches of 8 images. The training set images consisted of 80% of the set and the remaining 20% were used for validation purposes. Firstly, a training of additional layers was conducted and subsequently a fine-tuning was simultaneously carried out of both final inception blocks and additional layers. The cost function used was CategoricalCrosentropy (logit) and Adam was deployed as the optimization algorithm (learning rate of 0.001 and 0.00001 was each of the training phases described previously). For Experiment 2, 14 algorithms were trained, two for each image set distribution tested. The distributions of images considered in these experiments are the ones shown in Table 2.  
For Experiment 3, 82 trainings based on image sets formed randomly of different sizes (ranging between 18 and 990 total images). Here, one third of the total number of images corresponds to each class.