## 3 AI/ML Algorithm  
We now discuss the RS decoding algorithm. Figure 3a shows the RS pattern decoding flow diagram for the PMMA SGOF-based UWOCC system. First, different image frames obtained in the UWOCC system are divided into train images and test images, respectively. Then, these image frames are launched into the \"image processing module\", as shown in Figure 3b. This module is used in both the training and testing processes. We will discuss the \"image processing module\" in detail later in this section. Then, the processed images will be input into the ML models for training and testing, respectively. It is worth noting that the images are different for the model training and testing. Finally, BER will be calculated based on ML model prediction. \begin{table}
\begin{tabular}{c c} \hline
**Parameter** & **Feature** \\ \hline Resolution & 1920 \(\times\) 1440 \\ Shutter type & Rolling shutter \\ Optical format & 1/2.8\({}^{\prime\prime}\) optical format \\ Pixel size & 1.12 \(\upmu\)m \(\times\) 1.12 \(\upmu\)m \\ Frame rate & 30 fps \\ Shutter speed & 1/10,000 s \\ \hline \end{tabular}
\end{table} 
Table 2: Parameters of the CMOS image sensor. Figure 2: Photographs of the (**a**) PMMA SGOF and (**b**) proof-of-concept experiment, illustrating the PMMA SGOF emitting blue light homogeneously around its circumference. We will now discuss the \"image processing module\". The first step is the grayscale conversion. Because each pixel obtained in the CMOS image sensor consists of three colors, red, green, and blue, the images will be converted to grayscale format based on the equation grayscale value = 0.2989 \(\times\) Red + 0.587 \(\times\) Green + 0.114 \(\times\) Blue. As shown in Figure 4, grayscale 0 means dark and 255 means bright. We can observe two RS patterns in Figure 4, in which the lower one is the actual SGOF fiber image and the upper one is generated by the reflection of the water tank. We only need one fiber image to decode the signal. It is worth mentioning that we convert the rolling shutter pattern into grayscale values (i.e., a grayscale value of 0 means complete darkness and a grayscale value of 255 means complete brightness) to facilitate the subsequent signal processing, such as signal enhancement (i.e., enhancing the grayscale value), and thresholding (i.e., identify logic 1 or logic 0) in this work since only blue light is utilized and modulated. We believe that only extracting the blue light from the signal processing could be good enough. The image will be turned counterclockwise 90 degrees, and the actual SGOF RS pattern will be selected. There are several columns containing signals, so these columns will be added up, as shown in Figure 5. After this process, these columns will be averaged. The new column is the average column vector, as illustrated in Figure 6. The second step in Figure 3b is to find the average column vector. Then, we can locate the two headers from the average column vector; the OCC signal between headers is the data payload. After obtaining the payload, we can perform the last step in Figure 3b, which is the pixel-per  
Figure 4: Images of the RS pattern before and after the grayscale conversion. Figure 3: (**a**) RS pattern-decoding flow diagram for the PMMA SGOF-based UWOCC system. (**b**) The procedure of the module in the “image processing module”. bit (PPB) calculation and re-sampling. This process is performed to ensure that each bit contains the same number of pixels. This means that if a label of the neural network is composed of several pixels, the number of pixels is the PPB. For instance, if the payload length is 340 pixels and the input signal is 30 bits, the payload will be re-sampled to 360 pixels (i.e., it is divisible by 30), and the PPB is equal to 12. The twelve pixels are used as one label for the model. Figure 7a,b show the proposed architecture of the LSTM-NN and the LSTM cell, respectively. The first three layers are the LSTM layers, and the operation mechanism will be described later in this section.