# Edge Computing Architecture for the Management of Underwater Cultural Heritage
## 3 Conceptual Framework
### Edge Layer
These deep learning models are proficient in automatically extracting latent feature vectors from high-dimensional data, such as images of the UCH site. The encoder part of the VAE \(q_{\phi}(z\,|\,x)\) generates a probability distribution of latent variables \(z\), which encapsulates the site's characteristic values affected by the input parameters. The decoder part \(p_{\theta}(z\,|\,x)\), also known as the generative model, reconstructs the input data from these latent variables. In the context of training the VAE model, the loss function \(L_{\text{VAE}}\) is employed, which is a weighted combination of the Kullback-Leibler (KL) divergence \(L_{\text{KL}}\) and the reconstruction loss \(L_{rec}\), as shown in Equation (3):  
* \(L_{\text{KL}}\): The KL divergence quantifies the dissimilarity between the learned distribution of latent variables \(q(z|x)\) and a prior distribution \(p(z)\). This ensures that the latent space remains well structured and follows the desired prior distribution. * \(L_{\text{rec}}\): The reconstruction loss measures how accurately the decoder reconstructs the original input data from the latent variables, capturing the fidelity of the reconstructed data compared to the input. \[L_{KL}=D_{KL}(q(x|z)||p(z))\] (1) \[L_{rec}=-E_{q(Z|X)}[logp(x|z)]\] (2) \[L_{VAE}=\gamma_{1}L_{KL}+\gamma_{2}L_{rec}\] (3)  
Here, \(\gamma_{1}\) and \(\gamma_{2}\) are hyperparameters that weigh the significance of each term in the overall loss function. The model uses this loss function to learn a latent scale ranging from 1 to 10, quantifying the risk of degradation or, in this case, the rate of corrosion at the UCH site. Thus, employing a CNN VAE can provide a nuanced and precise assessment of the corrosion rate, enabling more targeted and efficient conservation strategies. In this study, a variational autoencoder (VAE) with specialised 1D convolutional layers was used to process the one-dimensional signals originating from marine sensors. These one-dimensional signals serve as the input to the VAE model. The encoder part of the VAE architecture returns distribution variables \(\mu\) and \(\sigma\), which are subsequently used to \begin{table}
\begin{tabular}{l l} \hline \hline
**Climate Change Stressor** & **Input Parameter** \\ \hline Increase in the surface water temperature & T, pH, salinity (sensors) \\ Changes in the ocean currents & Thermohaline circulation (database) \\ Rising sea levels & Sea level (database) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Stressors related to climate change and how they are measured, whether via in situ measuring using sensors or by combining databases. generate latent variables \(z\). These latent variables \(z\) are then input into a fully connected classification layer. The classifier was designed to output a categorical score ranging from 1 to 10, reflecting the risk of degradation of the selected UCH elements. The VAE is trained unsupervised using TensorFlow's (www.tensorflow.org) capabilities for 1D convolutional networks. The latent variables \(z\) obtained are then employed to train a supervised classification layer. The layer uses a SoftMax activation function and is trained using a categorical cross-entropy loss function, thus enabling the model to assign degradation levels in a supervised context [53]. The proposed model is illustrated in Figure 3.  
Certainly, if the fully connected layer is focused on classifying the degradation risk scale of underwater elements and the VAE is targeted towards capturing sensor signals related to climate change, then the latent space plays a crucial role in information sharing between these two aspects. \(L_{\text{degrad}}\) represents the loss from the fully connected layer, designed specifically for classifying the degradation scale, and it employs a categorical cross-entropy loss. \(L_{\text{climate}}\) reflects the VAE's performance in capturing sensor-based signals indicative of climate changes, combining the KL divergence and reconstruction loss.