# Black Ice Classification with Hyperspectral Imaging and Deep Learning
## 5 Model Architecture  
After using PCA, we have used the data augmentation technique for up-sampling the dataset, thereby enhancing both the training quality and the model's robustness. The total number of generated patches was \((\text{M}-\text{S}+1)\times(\text{N}-\text{S}+1)\), where M and N are the input image's width and height, respectively. X is defined as PCA reduced data cube. The input data for the 2D CNN were convolved with 2D kernels. To introduce non-linearity into the model, the convolved features passed through a ReLU activation function. The activation value at the \((\text{x},\text{y})\) spatial position, in the \(n\)th feature map of the \(m\)th layer, can be denoted as [26],  
\[v_{m,n}^{x,y}=\beta(b_{m,n}+\sum_{\tau=1}^{d_{l-1}}\sum_{\rho=-\gamma}^{\gamma }\sum_{\sigma=-\delta}^{\delta}w_{\sigma,m\tau}^{x,\rho}\times v_{m-1,\tau}^{ x+\sigma,y+\rho} \tag{1}\]  
where \(\beta\) is the activation function and \(b_{m,n}\) is the bias parameter. \(d_{l-1}\) is the number of feature maps in the \((l-1)\)th layer and the depth of kernel \(w_{m,n}\) for the \(n\)th feature map, \((2\delta+1)\) is the height, and \((2\gamma+1)\) is the width of the kernel. Similarly, 3D CNN was convolved with 3D kernels. For this layer, the activation value at \((\text{x},\text{y},\text{z})\) spatial position, in the \(n\)th feature map of \(m\)th layer, can be denoted as \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layers** & **Output Shape** & **Parameters** \\ \hline Input & [(None, 25, 25, 10, 1)] & 0 \\ Conv3D & [(None, 24, 24, 8, 8)] & 104 \\ Conv3D & [(None, 22, 22, 4, 16)] & 5776 \\ Reshape & [(None, 22, 22, 64)] & 0 \\ Conv2D & [(None, 20, 20, 64)] & 36,928 \\ Flatten & [(None, 25,600)] & 0 \\ Dense & [(None, 256)] & 6,553,856 \\ Dropout & [(None, 256)] & 0 \\ Dense & [(None, 128)] & 32,896 \\ Dropout & [(None, 128)] & 0 \\ Dense & [(None, 2)] & 258 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The summary of the whole model for black ice\[v_{m,n}^{x,y,z}=\beta(b_{m,n}+\sum_{r=1}^{d_{z-1}}\sum_{\lambda=-f}^{f}\sum_{\rho=- \gamma}^{\gamma}\sum_{\sigma=-\delta}^{\delta}w_{m,n}^{\sigma,\rho,\lambda} \times v_{m,n,r1}^{x+\sigma,y+\rho,z+\lambda} \tag{2}\]  
where (\(2\text{f}+1\)) is the depth of the kernel. Other parameters are the same as in the 2D CNN. The window size and the number of components were changed according to the data cube. Conv3D is intended for volumetric inputs, such as our 3D images, as opposed to Conv2D, which works with 2D images. Eight filters of size (2, 2) are input into the first Conv3D layer, which then uses the ReLU activation function to add non-linearity. This layer hunts for low-level features such as corners and edges. A total of 16 filters of sizes 3, 3, and 5 are present in the second Conv3D layer, which help extract even more intricate spatial characteristics. The depth of the filters enables the model to concurrently learn spectral and spatial characteristics. After the Conv3D layers, the output is reshaped to compress the final two dimensions (channels and filters) into one, making it appropriate to feed into Conv2D layers. The 3D and 2D convolution operations are connected by this. Conv2D layers search for patterns in the 2D space by applying filters to the 2D input. Compared to Conv3D layers, these are less computationally intensive. There are 64 filters of size (3, 3) in our model. The activation function of ReLU is utilized, just as in earlier layers. The Flatten layer is used to transform the 3D data to 1D after feature extraction by convolutions, making them appropriate for input into fully connected (dense) layers. Each neuron in these fully connected layers is linked to every neuron in the layer below it. These layers discover the data's broad patterns. The model employs two dense layers, each with 256 or 128 units and both with Dropout and ReLU activation. By randomly setting a portion of the input units to 0 during training, the regularization approach known as dropout works to prevent overfitting.