# Convolutional Neural Network for Measurement of Suspended Solids and Turbidity
## 2 Materials and Methods
### Experimental Setup  
A transparent container with a cubic shape of approximately \(5\times 5\times 5\) cm was filled using the liquid sample. A magnetic mixer was used to keep all the particles suspended, for preventing them from settling, and to allow the suspended particles to be recorded by the camera. The mixer speed used was 60 rpm during image registration (images from the training and validation dataset). The experimental setup used for this experiment is shown in Figure 5. The illumination distance was selected to prevent shadows on the liquid sample. The camera distance was selected to avoid imaging the edges of the container, so that the model does not learn the morphology of the container during the CNN training. The experiment was carried out in a dark room. The background was constant throughout the experiment; therefore, the CNN learned the information from the samples for each color, and it did not take information about the background. This is also corroborated in Figure 4, where the activations of the artificial neurons were focused, or the CNN took the information, for the classification of the suspended solid samples. The experiment setup implemented an RGB LED lamp. Red, green, blue, and white were used. Liquid samples illuminated with different colors are shown in Figure 6. The illumination of all colors was kept constant at an irradiance of 0.852 mW/cm\({}^{2}\). The spectral power distributions of the illumination used in this study are shown in Figure 7, which were measured using a spectrophotometer (USB2000, Ocean Optics, Orlando, FL, USA). The experimental setup was adjusted to the neural network by keeping constant all parameters (smartphone camera mode, LED lamp intensity, etc.) that were not under measurement. The neural network learned to identify the image changing characteristics, and since its training included samples with only distilled water (class 0), and considering that the only parameter which varied was the suspended solids, the effects of spurious light and other sources of noise were minimized. To create and record the liquid sample dataset, the rear-facing cameras of a Huawei Mate 20 Lite and an iPhone 6 were used. A total of 88,000 images were recorded. For samples with fish feed, 39,600 images were recorded with an Android operating system smartphone, and 48,400 images for paprika samples utilizing the smartphone with an IOS operating system. The size of the images recorded via the smartphones was 2448 \(\times\) 2448 pixels; however, the images were center-cropped at 224 \(\times\) 224 pixels, according to the input layer of the CNN. The smartphone camera was used in manual mode with a capture speed of 20 FPS (frames per second) in burst mode. The ISO level and the focus (focused at the container wall) option were kept constant during the experiment. Of \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline
**Classes** & **0** & **\(\lambda_{R}\)** & **\(\lambda_{R}\)** & **1** & **2** & **3** & **4** & **5** & **6** & **7** & **8** \\ \hline Fish mass (g) & 0.000 & - & - & 0.100 & 0.200 & 0.300 & 0.400 & 0.500 & 0.600 & 0.700 & 0.800 \\ Paprika mass (g) & 0.000 & 0.002 & 0.007 & 0.100 & 0.200 & 0.300 & 0.400 & 0.500 & 0.600 & 0.700 & 0.800 \\ \hline \end{tabular}
\end{table} 
Table 1: Concentration samples (fish feed and paprika mass) used for each class. the 88,000 recorded images, 80,000 images were randomly selected to create the training images dataset. The remaining 8000 images were used to build the validation dataset, i.e., 90% of the dataset was used for training, while the remaining 10% was used for validation or to test the operation of the CNN, that is, the validation images were not used in the validation process or training test. The training process was developed and implemented using Google Colaboratory, which is a free cloud service for machine learning education and provides a Python notebook (Jupyter) environment running in a dedicated virtual machine on an Nvidia Tesla K80 GPU with 2496 CUDA cores.