## 4 Methodology
### Data Generation Module
In the final output layer, the image is flattened into a vector, which is usually fed to a sigmoid function that outputs the discriminator's prediction for that image--a single value representing the probability of the image having the class of interest within the range of [0, 1]. Table 2 presents the hyperparameters used to train the DCGAN model. To speed up the DCGAN's convergence, we use spectral normalization, a novel method of initializing weights, that has been developed for GANs using (3) and (4) to enhance the stability of model training. \[\sigma=\|W_{v}\|=u^{T}W_{v} \tag{3}\]  
\[W_{SN}(W)=\frac{W}{\sigma(W)} \tag{4}\]  
The vectors \(u\) and \(v\), which have the same size, are randomly generated and used in a power iteration process for a specific weight during each learning step. This approach is more computationally efficient compared to simply penalizing the gradients. During the backpropagation step, we update the weights using \(W_{SN}(W)\) instead of \(W\). The convolutional and dense layers are initialized with the truncated normal distribution. Additionally, we removed the bias term from the convolutional layers, which helps to further stabilize the model. During training, label smoothing was used as a regularization technique to avoid the discriminator from becoming either too overconfident or underconfident in its predictions. If the discriminator becomes too certain that a particular image contains a driver with a helmet, the generator may exploit this fact and continuously generate only such images, thereby ceasing to improve its performance. To counteract this, we can set the class labels for the negative classes to be within the range of [0, 0.3] and [0.7, 1] for the positive ones. This strategy prevents the overall probabilities from approaching the two thresholds too closely. Additionally, we introduced some noise to the labels (5%), so the actual and predicted distributions become more dispersed and begin to intersect with each other. Consequently, creating a customized distribution of generated images during the learning phase becomes simpler. The Adam optimizer, with a standard learning rate of 0.0002 and a beta of 0.5, was the most effective optimization algorithm for this task. This learning rate is applied to both models. To assess the probability that the actual data is more \begin{table}
\begin{tabular}{c c} \hline \hline
**Hyperparameter** & **Value** \\ \hline batch\_size & 128 \\ weight\_init\_std & 0.02 \\ weight\_init\_mean & 0.0 \\ leaky\_relu\_slope & 0.2 \\ downsize\_factor & 2 \\ dropout\_rate & 0.5 \\ scale\_factor & 4 (downsize\_factor) \\ optimizer & Adam \\ lr\_initial\_d & tfe.Variable (0.0002) \\ lr\_initial\_g & tfe.Variable (0.0002) \\ lr\_decay\_steps & 1000 \\ noise\_dim & 128 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Hyperparameters for the trained DCGAN model. Figure 4: DCGAN generator and discriminator model architecture. realistic than the generated data, we use the relativistic average least squares (RaLSGAN) defined by (5) and (6). \[L_{D}^{RSGAN}=-E_{(x_{r},\ x_{f})}[\log\Big{(}sigmoid\Big{(}C(x_{r})-C\Big{(}x_{ f}\Big{)}\Big{)}\Big{)}] \tag{5}\]  
\[L_{G}^{RSGAN}=-E_{(x_{r},\ x_{f})}[log\Big{(}sigmoid\Big{(}C\Big{(}x_{f}\Big{)} -C(x_{r})\Big{)}\Big{)}] \tag{6}\]  
The objective is to evaluate the likeness between the real (\(r\)) and synthetic (\(f\)) data distributions. _RSGAN_ is considered to have reached the optimal point when \(D(x)\) equals 0.5, indicating that \(C(x_{r})\) and \(C\Big{(}x_{f}\Big{)}\) are equivalent. In addition to issues such as non-convergence and vanishing/exploding gradients, GANs may also encounter a significant problem known as mode collapse. This occurs when the generator begins generating a restricted range of samples. To address this issue, we applied a few techniques such as: label smoothing, instance noise, and weight initialization. Another technique that we employed during training is Experience Replay, which helped in retaining some of the recently produced images in memory.