## 3 Design of Proposed Intelligent FSO System
### Transmitter Module
```
1:Input: Eye diagram image \(\mathbf{I}\in\mathbb{R}^{64\times 64}\)(grayscale)
2:Output: Predicted Q-factor value \(\hat{Q}\in\mathbb{R}\)
3:ProcedurePredict Q-factor with Wide ResNet (\(\mathbf{I}\))
4://Preprocessing
5:Resize input image \(\mathbf{I}\) to shape (64 \(\times\) 64)
6:Normalize pixel values of \(\mathbf{I}\) to the range \([0,\ 1]\)
7:Reshape I\(\rightarrow\)(64, 64, 1) for LeNet input
8://Define Wide Residual Block
9:Function WideResBlock(x, filters)
10:shortcut \(\gets x\)
11:Conv2D: filters, 3 \(\times\) 3, stride = 1
12:BatchNorm\(\rightarrow\) Relu
13:Conv2D: filters, 3 \(\times\) 3, stride = 1
```
**Algorithm 5** Wide ResNet for Q-factor prediction
```
12 BatchNorm
13 If input channels \(\
eq\) filters:
14 Conv2D: filters, 1 \(\times\) 1, stride = 1 (for shortcut)
15 Element-wise Add: residual + shortcut
16 Relu
17 Return output
18 End Function
19//Build Wide ResNet Architecture
20 Define LeNet model \(\mathbf{\mathcal{F}}\) as follows:
21 Input : \(\mathbf{I}\in\mathbb{R}^{6\times 64}\)
22 Conv2D : 16 filters, 3 \(\times\) 3, \(\rightarrow\) BatchNorm \(\rightarrow\) Relu
23 WideResBlock with 32 filters
24 WideResBlock with 64 filters
25 WideResBlock with 128 filters
26 GlobalAveragePooling2D
27 Dense: 128 units, activation = Relu
28 Dropout: rate = 0.5
29 Output Layer: Dense(1), linear activation (for regression output)
30//Model Training
31 Split dataset into training and validation sets
32 Compile \(\mathbf{\mathcal{F}}\) with:
33 Loss function: MSE
34 Optimizer: Adam
35 Target values: Q-factor measurement
36 Train model with early stopping and validation loss monitoring
37//Prediction
38\(\hat{Q}\leftarrow\mathbf{\mathcal{F}}(\mathbf{I})\)
39 Return: \(\hat{Q}\in\mathbb{R}\)
40 End Procedure
```

**Algorithm 4**_Cont._

In this work, two datasets are constructed for training and evaluation purposes. The first dataset comprises 1000 black and white eye diagram images. The dataset is applied then to binary BER classification using a CNN model and BER/Q-factor regression using the LeNet architecture. The second dataset contains 5000 eye diagram frames and it is utilized exclusively for training the Wide ResNet model for Q-factor prediction. The larger dataset size for the Wide ResNet model is required due to its deeper and wider architecture, which generally necessitates a greater volume of training data to ensure robust generalization and to mitigate overfitting. ## 4 Simulation Results and Discussion

This section presents the evaluation outcomes of the proposed ML-driven power control framework of the proposed FSO communication system. The assessment is conducted under practical system settings, including a wavelength of 1550 nm, transmitter and receiver aperture diameters of 4 cm and 36 cm, respectively, optical efficiencies at both ends (\(\eta_{T}=\eta_{R}=0.99\)), and a beam divergence angle of 2 mrad. In the case of heavy fog, heavy rain, wet snow, and dry snow, the values of \(\alpha\) are 85 dB/km (0.2 km visibility), 19.28 dB/km, 13.73 dB/km, and 96.8 dB/km, respectively [23; 25]. The main objective of the proposed system is to ensure that the received signal at an FSO link of 0.6 km maintains a BER and Q-factor above their respective threshold valuesunder all-weather conditions. If the received signal falls below these thresholds due to factors such as atmospheric attenuation or FSO channel losses, the system triggers signal retransmission using optical amplification to restore signal quality. The eye diagram images used in both dataset 1 and dataset 2 are generated across various FSO link ranges and under diverse weather conditions, including heavy fog, heavy rain, wet snow, and dry snow. A CW laser source with an output power of 15 dBm is employed to simulate baseline signal degradation under these adverse atmospheric scenarios. Furthermore, each dataset of the eye diagram images is partitioned into 80% for training and 20% for testing to enable performance evaluation.