## 2 Materials and Methods
### Red Tide Detection Methods
To efficiently train the U-Net model, we split the PlanetScope image and ground-truth map into spatially non-overlapped patches of 32 \(\times\) 32 pixels. Then, we used only patches with more than one red tide pixel as the training dataset. As a result, we generated 24,958 valid patch pairs between the PlanetScope images and corresponding ground-truth maps. In 24,958 matched pairs, the percentages of red tide and non-red tide pixels were 55% and 45%, respectively. In order to identify the effect of randomness on patch selection and the proportion of red tide pixels, we constructed four different training and test datasets: (1) U-Net #1 (the ratio of randomly selected non-red tide pixels: red tide pixels = 0.45:0.55); (2) U-Net #2 (non-randomly selected non-red tide: red tide = 0.45:0.55); (3) U-Net #3 (randomly non-red tide: red tide = 0.66:0.34); and (4) U-Net #4 (non-randomly non-red tide: red tide = 0.66:0.34). Datasets of U-Net #1 and #2 only contained patches with at least more than one red tide pixel; on the other hand, U-Net #3 and #4 contained additional patches consisting of non-red tide pixels. To validate the trained U-Net model, test datasets were constructed in approximately 25% of the training datasets, maintaining a similar ratio of red tide and non-red tide pixels as that of the training datasets. U-Net was trained to classify four spectral bands of each pixel in 32 \(\times\) 32 PlanetScope patches to two labels of zero and one, corresponding to non-red tide and red tide, respectively. Here, U-Net was constructed with five convolutional layers and five deconvolutional layers to extract spectral features related to red tide waters from the four wavelength bands of the PlanetScope images. As shown in Figure 3, the encoder block is down from the top to the bottom layers on the left to extract from coarse to fine features. The extracted features pass through the decoder block from the bottom to the upper layers on the right side. The kernel size and number of convolutional layers at the encoder and decoder blocks are summarized in Table 3. We added a dropout layer in the end of the encoder block. The softmax and output layers determine whether each pixel is related to a red tide. The loss function (L) consist of a cross-entropy (\(L_{CE}\)) and L2 regularization (\(L_{2}\)) functions with a hyper-parameter (\(\lambda\)), as defined in Equations (1) and (2) [51]. In Equation (2), \(t_{ij}\) and \(y_{ij}\) are the indicators and the softmax output for the \(i\)-th sample and the \(j\)-th label, respectively. \(N\) and \(K\) are the number of samples and labels, respectively. \[\mathrm{L}(\theta)=L_{CE}(\theta)+\lambda L_{2}(w) \tag{2}\]  
\[L_{CE}(\theta)=\sum_{i=1}^{N}\sum_{j=1}^{k}t_{ij}\ln(y_{ij})\text{ and }L_{2}(w)= \frac{1}{2}w^{T}w \tag{3}\]  
To train the U-Net from the given datasets, a stochastic gradient descent with momentum (SGDM) optimizer [52] was used with different training options: 10, 25, and 50 mini-batches, and 10, 25, and 50 epochs. All batches were normalized. Datasets were shuffled at every epoch during training, and the learning rate and hyperparameter of L2 regularization were set to 0.05 and 0.0001, respectively. Figure 2: The percentage of red tide pixels in each PlanetScope image.