\newpage
\setstretch{2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Please enter the Chapter Title in the following in place of xxxxx. Use a label in place of yyyyy to be
%% referred later.
%% Please write the text in between the braces in place of AAAAA

\chapter{Attention Map Computation}
\label{yyyyy}

%\newpage  % makes the chapter begins in a new page
%\chapter{}
%\label{Ch5: Proposal Idea 1}

% \section{Overview}
% \label{yyyyy}
%\section{}
%\label{Ch5: Overview}

%As we mentioned in Chapter 3, we will embed the secret image inside the cover image guided by the attention maps. 
In this chapter, we will explain how the attention maps are computed and predicted. We use two types of attention maps: edge-based and texture-based attention maps. To generate the edge attention maps, we need to create the soft edge maps that are generated through two deep learning algorithms, i.e., Holistically-Nested Edge Detection (HED) and Richer Convolutional Features (RCF). After generating these soft-edge maps, we need to merge these edge maps with distance maps to create the edge attention maps. On the other hand, to generate the texture attention maps, we use two texture detectors, i.e., Visual Geometry Group (VGG16) and Residual Networks (ResNet50), then we merge the texture maps with the distance maps to generate the final texture attention maps.
%Repeated

This research employed four deep learning detector models, which included HED, RCF, ResNet50, and VGG16, because these methods provide complete edge and texture detection for accurate image-based steganography feature representation. In terms of edge detectors, the HED method produces thick edge probability maps at various scales through deep supervision, which maintains both detailed information and faint boundary data. The  RCF method produces better edge continuity through shallow and deep layer convolutional response combination, and it outperforms HED by using all convolutional layer features to generate detailed and accurate edge maps with high noise resistance. On the other hand, in terms of texture detectors, the ResNet50 model generates deep hierarchical texture representations through its residual connections, which prevent gradient vanishing and allow the model to learn complex visual patterns. The VGG16 model achieves excellent local texture characterization through its small (3$\times$3) filters, and operates in simple yet effective convolutional blocks. The models were selected because they demonstrate proven performance in a pre-trained state, and they achieve optimal results between accuracy and robustness, and the computational requirements for this application.


Our developed system proceeds to predict attention maps for untested cover images through two deep learning models, i.e., CNN encoder-decoder and WGAN-GP (Conditional Wasserstein Generative Adversarial Network with Gradient Penalty) independently. These models use the initial computed attention maps (texture attention maps and edge attention maps) separately, and their corresponding cover images to predict final attention maps for any unseen cover image. The selection of these models occurred because they demonstrate superior performance in extracting both global and local spatial features from images. The CNN encoder-decoder architecture is based entirely on convolutional neural networks, which are highly effective at capturing the global and local spatial features. On the other hand, the WGAN-GP model was implemented to produce more realistic and stable attention maps. The Wasserstein distance with gradient penalty in WGAN-GP prevents mode collapse and stabilizes training while producing better quality generated outputs than conventional GANs. In the next sections, we will present the explanation of the soft edge map, texture map, distance map, and attention map computation and prediction. 



\section{Soft Edge Maps}
\label{yyyyy}

A \textbf{soft edge map} represents edges through continuous values, which show edge strength at each pixel point instead of making binary decisions. The soft edge map generation process employs two edge detection methods known as HED and RCF. The two edge detectors run separately to create soft edge maps, which we label as $P_{\mathrm{HED}}$ and $P_{\mathrm{RCF}}$, and we use them as pretrained models. The edge probability maps from both detectors get normalized to [0,1] through sigmoid transformations. The detectors operate independently because HED produces detailed thick edges, but RCF improves boundary smoothness in areas with texture.

As an example, the top row of Figure~\ref{fig:Soft-Edge-Maps Using HED Examples.} displays five grayscale cover images, which are followed by their HED-derived soft-edge maps in the bottom row. The soft-edge representations use continuous gray levels to show edge strength while focusing energy on important structural boundaries, for example, road traces, building facades, windows, mountain ridgelines, human silhouettes, etc. The edge detection system produces wide, smooth bands from gradual intensity changes, but creates thin, precise responses when detecting sudden transitions between areas. The dense and fragmented responses in highly textured scenes with dense vegetation allow dominant contours to remain easily visible. These HED soft edge maps show excellent spatial coherence and continuous contours, which makes them appropriate for subsequent operations, including attention-map generation and segmentation, and adaptive embedding. 
\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/HEDtoEdge.PNG} % بدون الامتداد عادةً
  \caption{ Soft-Edge-Maps Using HED Examples.}
  \label{fig:Soft-Edge-Maps Using HED Examples.}
\end{figure}

Again, the top section of Figure~\ref{fig:Soft-Edge-Maps Using RCF Examples.} displays five grayscale cover images which are paired with their corresponding RCF edge maps shown at the bottom. The RCF detection method produces thin localized contours that detect important structural elements while ignoring flat areas like sky and snow. The edge density produced by RCF depends on content because it creates high density near facades and grass while showing lower density in natural environments. These RCF edge maps function as optimal priors for image steganography to distribute payload bits between strong edges and textured areas for better stealth and for minimum embedding in smooth sections. The combination of per-image thresholding with light distance-transform/dilation operations helps maintain edge sparsity and produces coherent support areas for bit assignment.
\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/RCFtoEdge.PNG} % بدون الامتداد عادةً
  \caption{ Soft-Edge-Maps Using RCF Examples.}
  \label{fig:Soft-Edge-Maps Using RCF Examples.}
\end{figure}


\section{Texture Maps}
% Requires \usepackage{xcolor}
During this stage, texture maps are generated using pre-trained \textbf{VGG16} and \textbf{ResNet-50} models (no additional training). 
Both models load ImageNet weights, freeze all parameters, and run in evaluation mode to ensure deterministic behavior. 
For VGG16, feature maps taken immediately after the ReLU layers, \texttt{conv1\_2}, \texttt{conv2\_2}, and \texttt{conv3\_3} are converted to per-pixel $L_2$ energy maps; these three one-channel maps are then linearly fused with weights $(w_{c1},w_{c2},w_{c3})$, followed by an optional gamma adjustment $\gamma$ (contrast control). 
This training-free descriptor combines three scales of information (fine detail from \texttt{conv1\_2}, mesoscale texture from \texttt{conv2\_2}, and broader structure from \texttt{conv3\_3}). 
For ResNet-50, the early feature extractor uses frozen, pre-trained weights from the first three stages (\texttt{conv1/bn1/relu}, \texttt{maxpool}, \texttt{layer1}) to form two $L_2$ energy maps that are fused with weights $(w_{\text{conv1}},w_{\text{l1}})$ and optionally adjusted by $\gamma$. 
In both cases, the $L_2$ energy transform collapses multi-channel activations into a single channel per pixel; fusion weights set each layer’s contribution, and $\gamma<1$ boosts low responses while $\gamma>1$ compresses high responses. 
Finally, the fused texture map is min--max normalized to $[0,1]$ and combined with distance maps to produce a texture-attention map suitable for downstream use.


After merging the edges or texture maps with distance maps,the generated texture or edge attention map is converted into bits-per-pixel (BPP) values using three thresholds $\tau_1$, $\tau_2$, and $\tau_3$, which divide the attention range $a \in [0,1]$ into four levels. Pixels with low attention values ($a < \tau_1$) are assigned one bit, while regions with stronger texture or edge responses receive higher bit allocations: two bits for $\tau_1 \le a < \tau_2$, three bits for $\tau_2 \le a < \tau_3$, and four bits for $a \ge \tau_3$. 
This adaptive mapping ensures that visually complex or textured regions can safely carry more embedded information, while smoother areas use fewer bits to preserve high visual quality.

\begin{equation}
b(a)=
\begin{cases}
1 bit, & a<\tau_1,\\
2 bits, & \tau_1\le a<\tau_2,\\
3 bits, & \tau_2\le a<\tau_3,\\
4 bits, & a\ge \tau_3,
\end{cases}
\qquad a\in[0,1].
\label{eq:bits-mapping}
\end{equation}

%\begin{figure}[htbp]
  %\centering
 % \includegraphics[width=0.8\textwidth]{Figs/VGG16_Textures.PNG} % بدون الامتداد عادةً
 % \caption{ Textures Maps Using VGG16 Examples.}
 % \label{fig:Textures Maps Using HED Examples.}
%\end{figure}

As an example, the top section of Figure~\ref{fig:Textures Maps Using RCF Examples11.} and Figure~\ref{fig:Textures Maps Using RCF Examples22.} show five grayscale cover images which receive their VGG16-derived texture maps in the bottom section. The maps derive their values and get combined through $\ell_{2}$ texture energy calculation before upscaling and min--max normalization. The representation shows thin continuous boundaries and fine details through its ability to detect river banks and snow streaks (Cover~1), facade outlines and window frames (Cover~2), terrain/road ridges (Cover~3), human silhouettes and branch/snow interfaces (Cover~4), and dense grass micro-texture (Cover~5) while ignoring flat areas like sky and smooth snow. The VGG16 maps demonstrate superior line structure preservation when compared to standard ResNet-based maps because they produce more defined and less blob-like results. The maps function as successful attention priors for image steganography because they direct more payload to areas with strong visual masking through their textured appearance and reduce embedding in smooth dark regions. The combination of per-image normalization with distance-transform/dilation operations creates stable dynamic range and maintains spatial coherence before adaptive bit assignment.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/New_ResNet_Texture.PNG} % بدون الامتداد عادةً
  \caption{ Textures Maps Using ResNet50 Examples.}
  \label{fig:Textures Maps Using RCF Examples11.}
\end{figure}

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/VGG16_Texturess.PNG} % بدون الامتداد عادةً
  \caption{ Textures Maps Using VGG16 Examples.}
  \label{fig:Textures Maps Using RCF Examples22.}
\end{figure}

\section{Distance Maps}

During the attention map calculation process, we use the distance map. The distance map function identifies the distance of each pixel from important areas, which include edge or texture regions. The attention map process calculation uses distance information to distribute attention weights across pixels based on their proximity to edges. The benefit of using the distance map is to achieve better boundary area detection and spatial attention map consistency. Additionally, the distance map helps the model create smooth transitions between high and low attention areas, which results in better salient distance from each pixel x to any reference pixel y. For every pixel x, we find the shortest distance to any reference pixel y and record that value; this is the Euclidean Distance Transform (EDT)~\cite{krislock2012euclidean}. In the attention map computation, the distance map is often used as a spatial guidance signal. The method enables us to convert geometric data into numerical values, which become usable. Finally, the distance map functions as an image that contains pixel values representing their distance from reference pixels located at edges or feature detection. The distance map enables the network to understand spatial relationships and structural patterns, which results in improved attention map accuracy and perceptual coherence.

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/HEDtoDistance.PNG} % بدون الامتداد عادةً
  \caption{ Distance Maps Using HED Examples.}
  \label{fig:Distance-Edge-Maps Using HED Examples2.}
\end{figure}

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/RCFtoDistance.PNG} % بدون الامتداد عادةً
  \caption{ Distance Maps Using RCF Examples.}
  \label{fig: Distance Maps Using RCF Examples.}
\end{figure}

As an example, the top section of Figure~\ref{fig:Distance-Edge-Maps Using HED Examples2.}  and Figure~\ref{fig: Distance Maps Using RCF Examples.} show five grayscale cover images, while the bottom section displays their HED–distance maps using a hot colormap to represent higher edge–proximity weights. The pipeline starts by detecting soft edges through HED before transforming them into spatially organized proximity/attention maps through distance transformation. The output maps highlight important high-frequency elements, which include river banks and ridgelines (Cover~1), facade and window edges (Cover~2), terrain/road boundaries (Cover~3), human silhouettes and snow contours (Cover~4), and dense grass texture (Cover~5), while ignoring flat sections. The amount of edges, along with their length distribution, depends on the content of the scene because urban areas with grass show high density and fine details, but natural environments present fewer edges that extend over longer distances. The distance-based maps function as successful attention priors for image steganography because they direct more payload toward areas with strong edges and textured regions, which provide better visual masking of perturbations while minimizing embedding in flat sections such as sky and snow. The maps require per-image normalization and light smoothing and dilation operations to achieve stable dynamic range and connectedness before adaptive bit assignment.


\section{Attention Maps}

The attention map exists to determine both the locations and amounts of data insertion during steganography embedding and extraction operations. Hence, the attention map tells the model which region can safely hide more bits without visible distortion. The traditional steganography method distributes data equally across all pixels, which leads to waste capacity in flat regions (``small changes are easily noticed") and underuses complex regions (``changes can be hidden more effectively"). The attention map function assigns weights to each pixel, which determines the amount of data that can be embedded safely based on its attention values.

\begin{figure}[h]
  \centering
  \includegraphics[width=.8\textwidth]{Figs/PPP.PNG} % بدون الامتداد عادةً
  \caption{ Attention Maps Process.}
  \label{fig:Attention map process.}

\end{figure}

The attention maps in Figure~\ref{fig:Attention map process.} result from uniting the edge or texture map information with distance map data. The edge map (E) derives from HED and RCF models, which detect both boundary lines and detailed structural elements. The areas with high-intensity changes serve as essential indicators that help determine the structural value of each pixel. The texture map (T) derives from pre-trained convolutional networks, including VGG16 and ResNet50, which detect local texture patterns and detailed spatial details; pixels with elevated texture values work best for data hiding because minor changes become less noticeable in these areas.

 Additionally, the \textbf{distance map} (\(\text{invD}\)) is calculated as the inverse of the distance from edges, where 
pixels near strong edges have higher values and those far from edges have lower values, producing smoother 
attention transitions around boundaries. Finally, these maps are fused through a weighted combination:
\begin{equation}
A = \alpha \cdot E + \beta \cdot \text{invD},
\label{eq:edge_fusion}
\end{equation}
or equivalently using the texture map,
\begin{equation}
A = \alpha \cdot T + \beta \cdot \text{invD},
\label{eq:texture_fusion}
\end{equation}
where \(\alpha\) and \(\beta\) control the relative contribution of local detail (edges or textures) versus 
global smoothness (distance information). 


The combination of these elements produces an attention map that provides balanced perception for adaptive data embedding. The equations from Section~4.2 and Section~4.3 show that $\alpha = 0.4$ and $\beta = 0.6$. The selection of $\alpha = 0.4$ and $\beta = 0.6$ gives more importance to the inverse distance map (invD), which produces edge-based attention distribution while minimizing visual artifacts and making the data more difficult to detect. We selected these values through experimentation to achieve optimal results for image quality and embedding capacity, and detection resistance. The selection of $\alpha$ values controls the emphasis on edge and texture areas, which increases embedding capacity but may introduce slight distortion. In contrast, the selection of $\beta$ values governs the influence of distance information, enhancing visual quality and reducing the likelihood of detection.



The attention maps process workflow in Figure~4.7 consists of three sequential stages, which include normalization, followed by attention maps computation, and then attention maps prediction. The system performs normalization on both cover and secret images during the first stage to achieve uniform scale and intensity levels for subsequent processing steps. The normalized cover image undergoes two separate processing paths to obtain different attention data during the attention maps computation stage. The first processing branch applies edge detection models RCF and HED to create edge maps, which are merged with distance maps to generate edge attention maps. The second processing branch applies deep texture extraction models ResNet50 and VGG16 to produce texture maps, which get merged with distance maps to generate texture attention maps. This system uses two deep learning models, which include a CNN encoder–decoder and a WGAN (Generative Adversarial Network) to predict attention maps from edge and texture attention maps generated in the previous stage. 
The system achieves better attention map generation through its layered structure, which combines basic edge details with advanced texture information.

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/HED_Attention_Initial.PNG} % بدون الامتداد عادةً
  \caption{ HED Attention Maps.}
  \label{fig:HED_Attenntion_ Maps.}
\end{figure}

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/RCF_Attention_Initial.PNG} % بدون الامتداد عادةً
  \caption{ RCF Attention Maps.}
  \label{fig:RCF_Attention_ Maps.}
\end{figure}

Figures~\ref{fig:HED_Attenntion_ Maps.} and ~\ref{fig:RCF_Attention_ Maps.} show five grayscale cover images together with their HED and RCF-based attention maps. The maps derive from early convolutional features through channel-wise $\ell_{2}$ energy calculation followed by per-image min-max normalization before using a \texttt{hot} colormap for display. The highest attention points appear as white or yellow areas in the maps while orange and red sections show moderate attention, and dark red and black sections indicate low attention in smooth or uniform areas such as sky or flat snow. The attention maps focus on significant elements, including riverbanks, building facades, window frames, terrain, road details,  human silhouettes at branch-snow boundaries, and dense grass textures, while ignoring uniform sections of the image. The maps serve as a useful reference for adaptive embedding in image steganography by directing payload placement to bright textured areas for maximum visual masking and reducing it in dark smooth sections to enhance imperceptibility and decrease detection chances.

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/ResNet50_Attention.PNG} % بدون الامتداد عادةً
  \caption{ ResNet50 Attenntion Maps.}
  \label{fig:ResNet50 Attenntion Maps.}
\end{figure}

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/Vgg16_Attentions.PNG} % بدون الامتداد عادةً
  \caption{ VGG16 Attention Maps.}
  \label{fig:VGG16 Attention Maps.}
\end{figure}

The top section of Figures~\ref{fig:ResNet50 Attenntion Maps.} and ~\ref{fig:VGG16 Attention Maps.} show five grayscale cover images, which receive their VGG16-derived edge maps in the bottom section. The maps derive their values from early VGG16 responses (conv1\_2, conv2\_2, conv3\_3) which get combined through $\ell_{2}$ texture energy calculation before upscaling and min-max normalization. The representation shows thin continuous boundaries and fine details through its ability to detect riverbanks and snow streaks (Cover~1), facade outlines and window frames (Cover~2), terrain/road ridges (Cover~3), human silhouettes and branch/snow interfaces (Cover~4), and dense grass micro-texture (Cover~5) while ignoring flat areas like sky and smooth snow. The VGG16 maps demonstrate superior line structure preservation when compared to standard ResNet-based maps because they produce more defined and contiguous, thick, amorphous response regions. The VGG16-ResNet50 maps  function as successful attention priors for image steganography because they direct more payload to areas with strong visual masking through their textured appearance and reduce embedding in smooth dark regions. The combination of per-image normalization with distance-transform/dilation operations creates stable dynamic range and maintains spatial coherence before adaptive bit assignment.





\section{Description of Detection Algorithms }
\label{yyyyy}
%\section{Background}
%\label{Ch5: Background}

Our system depends on two separate model sets, which work together to produce attention maps through structural and textural data extraction. The edge detection process relies on HED and RCF models, which merge shallow and deep convolutional layer responses to achieve precise object boundary and fine contour detection. 
The system uses pre-trained VGG16 and ResNet-50 models as fixed feature extractors to extract texture information from images. The edge detection models (HED/RCF) and texture extraction models (VGG16/ResNet–50) work separately to generate accurate and visually consistent attention maps through their ability to detect precise boundaries and diverse texture patterns. The following subsections provide a detailed description of these algorithms.

\subsection{HED (Holistically-Nested Edge Detection)}

\begin{figure}[h]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/HED_New_Architecture.PNG} % بدون الامتداد عادةً
  \caption{ Basic HED Edge Network.}
  \label{fig:Basic HED Edge Network.}
\end{figure}


The \textbf{HED} system (shown in Figure~\ref{fig:Basic HED Edge Network.}) is a deep convolutional network designed for edge detection. 
It uses a VGG-like backbone and produces multiple \textit{side outputs} at different layers. Each side output is trained directly using deep supervision, and then all outputs are \textit{fused} together—typically through a \(1\times1\) convolution or weighted sum—to form the final edge map. The early layers detect fine, thin edges, while the deeper layers capture larger and more semantic contours.
A \textbf{class-balanced loss} helps manage the imbalance between edge and non-edge pixels, and a \textbf{sigmoid activation} generates per-pixel edge probabilities ranging from 0 to 1. Finally, the network can optionally apply upsampling so that the output edge map has the same resolution as the input image.


HED serves our needs because it generates precise boundaries that maintain their definition across different scales through deep side-output supervision and fusion. The edge detection capabilities of HED outperform traditional methods and single-scale approaches because it maintains thick, important contours while resisting noise and contrast variations. The reliable probabilistic edge maps from HED enable our attention and distance priors to locate payloads near important structures while staying away from abrupt boundaries, which results in better imperceptibility and reduced detectability without compromising performance.



\subsection{RCF (Richer Convolutional Features) Edge Detector }
\label{yyyyy}
%\subsection{ }

The RCF (shown in Figure~\ref{fig:Basic RCF Edge Network.}) that uses VGG-like hierarchy by adding side outputs to all convolutional stages and implements deep supervision at each stage before combining the multi-level responses through learned weights (1x1 convolution or weighted sum) to generate a single edge map. The combination of shallow features with deep features produces edge evidence that maintains high recall and shows good topological continuity in scenes with textured or cluttered environments. 

The selection of RCF occurred because this method unites information from all CNN layers through deep supervision to generate precise edges at various scales during a single processing step. The method delivers superior precision/recall performance and maintains strong resistance to noise and contrast variations while preserving thin contours better than single-scale approaches. The stable probabilistic edge maps produced by RCF enhance the attention/distance priors in our pipeline, which results in better imperceptibility and reduced detectability without compromising performance.



\begin{figure}
  \centering
  \includegraphics[width=1.0\textwidth,height=0.6\textheight,keepaspectratio]{Figs/New_newRCF (1).PNG}
  \caption{Basic RCF Edge Network.}
  \label{fig:Basic RCF Edge Network.}
\end{figure}

\subsection{VGG16 Texture Features Detector}
\label{yyyyy}

\noindent\textbf{VGG16} is a convolutional neural network built from many small \(3\times3\) convolution layers with ReLU, plus occasional \(2\times2\) max-pooling to reduce spatial size as shown in Figure~\ref{fig:hed22}. It has \textbf{5 blocks} where channels grow \(64 \rightarrow 128 \rightarrow 256 \rightarrow 512 \rightarrow 512\) for a total of \textbf{13} conv layers processing RGB images at \(224\times224\). After the conv blocks, features are flattened and passed through \textbf{3 fully connected layers} with dropout, and a \textit{softmax} outputs class probabilities. Stacking \(3\times3\) filters yields an effective receptive field of about \(7\times7\) while keeping the design simple. The trade-off is size: VGG16 has \(\sim\!138\) million parameters, which requires substantial memory and compute.

 
We use \textbf{VGG16} as our texture detector because its early convolution layers capture clear low-level and mid-level details such as edges, small patterns, and repeated textures. The stacked \(3\times3\) filters create texture–energy maps that are both effective and easy to interpret. Compared with hand-crafted methods like \textbf{Gabor} and \textbf{LBP}, VGG16 is more robust to noise, lighting changes, and scale. Compared with deeper models like \textbf{ResNet50}, it is lighter and faster to run. In addition, widely available ImageNet pretrained weights make results easy to reproduce and more reliable. For these reasons, VGG16 is a practical and efficient backbone for our texture-based attention.

 
In this work, the \textbf{VGG16Texture} module employs the \textbf{VGG16} network as a fixed feature extractor for texture mapping tasks. 
At initialization, the model loads ImageNet-pretrained weights and stores three fusion weights $(w_{c1}, w_{c2}, w_{c3})$ along with a contrast adjustment parameter $\gamma$. The module is set to evaluation mode, and all parameters are frozen (\texttt{requires\_grad=False}) to prevent updates during training. 
Texture features are extracted from the outputs of the ReLU layers in \texttt{conv1\_2}, \texttt{conv2\_2}, and \texttt{conv3\_3}, which capture information at different levels of abstraction. 
These feature maps are converted into per-pixel $L_2$ energy maps and then combined using the stored fusion weights to produce a single texture descriptor. 
This descriptor merges fine edges from \texttt{conv1\_2}, medium-scale textures from \texttt{conv2\_2}, and larger structural patterns from \texttt{conv3\_3}, resulting in a stable, training-independent texture representation with contrast controlled by $\gamma$.



\begin{figure}[!htbp]
  \centering
  \includegraphics[width=0.8\textwidth]{Figs/VGG16.PNG} % بدون الامتداد عادةً
  \caption{VGG16 Network.}
  \label{fig:hed22}
\end{figure}

We build a training-free, single-channel texture map using a pre-trained \textbf{VGG16} as a fixed feature extractor. 
Given an input batch \(x \in \mathbb{R}^{B\times 3\times H\times W}\) (i.e., \(B\) RGB images of size \(H\times W\)), we take feature activations 
\(f \in \mathbb{R}^{B\times C\times H\times W}\) from the post-ReLU layers \texttt{conv1\_2}, \texttt{conv2\_2}, and \texttt{conv3\_3}. 
Each activation tensor is converted to a per-pixel \(L_2\)-energy map by summing squares across channels and taking the square root:
\begin{equation}
E(b,x,y)=\sqrt{\sum_{c=1}^{C} f(b,c,x,y)^2 + \varepsilon},
\label{eq:energy}
\end{equation}
where \(\varepsilon\) is a small constant for numerical stability. 
We then bilinearly upsample each one-channel map to \((H,W)\) and min–max normalize it to \([0,1]\). 
The three normalized maps—\(E_{c1}\) (from \texttt{conv1\_2}, fine details), \(E_{c2}\) (from \texttt{conv2\_2}, mid-scale patterns), and \(E_{c3}\) (from \texttt{conv3\_3}, broader structures)—are linearly fused with nonnegative weights \((w_{c1}, w_{c2}, w_{c3})\):
\begin{equation}
\mathrm{Tex} = w_{c1} E_{c1} + w_{c2} E_{c2} + w_{c3} E_{c3}.
\label{eq:fuse}
\end{equation}
Optionally, we apply a gamma correction with parameter \(\gamma\) (\(\gamma<1\) boosts low responses; \(\gamma>1\) compresses high responses), 
followed by a final per-image min–max normalization to keep values in \([0,1]\). 
The result is a consistent, scale-aware, single-channel descriptor 
\(\mathrm{Tex} \in \mathbb{R}^{B\times 1\times H\times W}\) suitable for downstream fusion, indexing, or visualization.

\smallskip\noindent\textit{Symbols:}
\(x\): input batch; \(B\): batch size; \((H,W)\): image size; 
\(f\): feature map; \(C\): channel count; 
\(E(b,x,y)\): per-pixel \(L_2\) energy; \(\varepsilon\): stability constant; 
\(E_{c1},E_{c2},E_{c3}\): normalized energy maps from \texttt{conv1\_2}, \texttt{conv2\_2}, \texttt{conv3\_3}; 
\((w_{c1},w_{c2},w_{c3})\): fusion weights; \(\gamma\): gamma parameter.




\subsection{ResNet50 Textures Features Detector}

The 50-layer convolutional network ResNet-50 as shown in Figure~\ref{fig:hed33} implements residual learning as its fundamental design principle. The residual block functions as a learning unit that computes F(x) before adding the output to the input x through an identity shortcut to preserve signal flow and prevent vanishing gradients. The architecture consists of bottleneck blocks which follow the pattern~\(\text{of } 1\times 1 \rightarrow 3\times 3 \rightarrow 1\times 1\). The first 1x1 convolution operation decreases channel dimensions before the 3x3 layer detects spatial patterns, and the last 1x1 operation expands channels by a factor of 4. The network applies batch normalization and ReLU activation to each convolution operation while adding a post-block ReLU activation. The network starts with a stem that combines a 7x7 convolution with stride 2 and 3x3 max pooling before entering four stages of residual blocks with block counts of 3, 4, 6, and 3, which produce feature dimensions of 256, 512, 1024, and 2048. The first block of each stage uses stride-2 spatial downsampling, and the network employs 1x1 projection shortcuts for dimension changes. The model uses global average pooling to extract features before applying a fully connected layer with softmax activation for classification. The ResNet-50 model contains approximately 25.6 million parameters, while its residual structure enables deeper accurate models that serve as powerful transfer learning backbones for feature extraction or fine-tuning. The research uses ResNet50 as its texture detection model because its residual blocks maintain and enhance low to mid-level patterns through depth to produce better texture features than shallower models. The model achieves better stability and noise resistance and illumination robustness through its skip connections, which also enable good weight generalization.


In this work, the ResNet\mbox{-}50 model receives ImageNet\mbox{-}pretrained weights while keeping only the first three stages which include \texttt{conv1}/\texttt{bn1}/\texttt{relu}, \texttt{maxpool}, and \texttt{layer1}. 
The module operates in evaluation mode with all parameters frozen through \texttt{requires\_grad}=False to block BatchNorm statistic updates. 
The model processes inputs that have been normalized using ImageNet statistics to generate L2\mbox{-}energy maps from \texttt{conv1} and \texttt{layer1} activations before upsampling to match input dimensions and applying per-image min–max normalization. The final texture\mbox{-}intensity map emerges from a weighted linear combination of \texttt{conv1} and \texttt{l1} activations with weights \(w_{\text{conv1}}\) and \(w_{\text{l1}}\) and optional gamma correction \((\gamma)\) to produce a value between 0 and 1. The design uses pre-trained low-level filters from large-scale supervision to extract edges and fine textures through \texttt{conv1} and structural patterns through \texttt{layer1} for creating an effective training-free descriptor for subsequent tasks.
\begin{figure}[!htbp]
  \centering
  \includegraphics[width=0.9\textwidth]{Figs/ResNet50.PNG} % بدون الامتداد عادةً
  \caption{ ResNet50 Network.}
  \label{fig:hed33}
\end{figure}

\noindent
The proposed texture extractor combines early features from ResNet-50, specifically from \texttt{conv1} and \texttt{layer1}, using two weights: \(w_{\text{conv1}}\) and \(w_{\text{l1}}\). 
These weights control how much each feature contributes to the final texture map. 
The texture map is created by linearly combining the two energy maps \(E_{\text{conv1}}\) and \(E_{\text{l1}}\) as follows:
\begin{equation}
\mathrm{Tex} = w_{\text{conv1}}E_{\text{conv1}} + w_{\text{l1}}E_{\text{l1}}.
\label{eq:texmap}
\end{equation}

After this fusion, each image is min–max normalized, and an optional gamma correction is applied to adjust contrast. 
When \(w_{\text{conv1}}\) is between 0.7 and 0.9, the texture map becomes more sensitive to fine details, while \(w_{\text{l1}}\) values between 0.5 and 0.8 improve resistance to local noise. 
Because normalization removes the effect of the total weight sum, the choice of weights only affects their relative influence. 
A starting ratio of \(w_{\text{conv1}}=0.6\) and \(w_{\text{l1}}=0.4\) provides stable and consistent results while keeping both weights in the range \([0,1]\). 
In summary, giving more weight to \texttt{conv1} produces sharper localization, whereas emphasizing \texttt{layer1} results in smoother and more stable texture maps.


\noindent
We construct a simple, training--free, single–channel texture map by converting multi–channel features into per–pixel $L_2$ energy and normalizing per image. 
First, the input passes through the early ResNet--50 stem (\texttt{conv1}$\!\to$\texttt{bn1}$\!\to$\texttt{relu}) to capture fine edges. 
Given feature responses $f_c(x,y)$, we collapse channels to one map via
\begin{equation}
E(x,y) \;=\; \sqrt{\sum_{c} f_c(x,y)^2 \;+\; \varepsilon},
\label{eq:l2}
\end{equation}
then bilinearly upsample to the input size and apply min--max normalization,
\begin{equation}
\widehat{E}(x,y) \;=\; \frac{E(x,y)-E_{\min}}{E_{\max}-E_{\min}+\epsilon}.
\label{eq:norm}
\end{equation}
A second pathway (\texttt{maxpool}$+$\texttt{layer1}) extracts broader structures and is processed identically to yield $\widehat{E}_{\text{l1}}$; the stem pathway yields $\widehat{E}_{\text{conv1}}$. 
We fuse the two normalized maps with nonnegative weights:
\begin{equation}
\mathrm{Tex}(x,y) \;=\; w_{\text{conv1}}\,\widehat{E}_{\text{conv1}}(x,y)
\;+\; w_{\text{l1}}\,\widehat{E}_{\text{l1}}(x,y).
\label{eq:fuse}
\end{equation}
Optionally, we refine contrast with a gamma adjustment and re-normalization to keep values in $[0,1]$,
\begin{equation}
\widetilde{\mathrm{Tex}}(x,y) \;=\; 
\frac{\mathrm{Tex}(x,y)^{\gamma} - \mathrm{Tex}_{\min}^{\gamma}}
{\mathrm{Tex}_{\max}^{\gamma} - \mathrm{Tex}_{\min}^{\gamma} + \epsilon},
\qquad \gamma>0.
\label{eq:gamma}
\end{equation}

\smallskip\noindent\textit{Legend:}
$\varepsilon,\epsilon$ are small stabilizers; $E_{\min},E_{\max}$ (and $\mathrm{Tex}_{\min},\mathrm{Tex}_{\max}$) are per-image extrema; 
$\widehat{E}_{\text{conv1}}$ and $\widehat{E}_{\text{l1}}$ are the normalized energy maps from the two paths; 
$w_{\text{conv1}},w_{\text{l1}}\!\ge\!0$ (often summing to $1$); 
bilinear upsampling resizes intermediate maps to the input resolution.





% In this work we use the model as pretrained model through the application of a pre-trained VGG16 network. 

\section{Attention Maps Dataset Construction}
\label{yyyyy}
%\subsection{ }
%\label{Ch4: Background}

In this work, after generating the edge maps and texture maps, we combine them with distance maps to generate the initial attention maps as mentioned earlier. The purpose of generating these initial attention maps is to build the initial attention maps dataset that will be used later in training the deep learning models (e.g., CNN and WGAN) to predict the attention map for any new test image. Overall, to generate a cover-based attention map dataset, we transform soft edge/texture images from grayscale to two distance maps per image. Then we apply the thresholding process on soft edge/texture to create a binary mask, which gets inverted before applying the Euclidean distance transform to produce the distance map that gets normalized to [0,1]. After that, the attention map process is generated by combining soft-edge/texture strength values with proximity-to-edges/textures (distance maps) weights before applying normalization and saving the result as an 8-bit PNG file.

\section{Attention Map Prediction Using CNN Encoder-Decoder}
\label{yyyyy}

\begin{figure}[h]
  \centering
  % اضبط القيمتين كما تشاء (مثال بنسبة من الصفحة)
  \includegraphics[width=1.0\textwidth,height=0.90\textheight,keepaspectratio]{Figs/CNN_encoder_decoder}
  \caption{CNN Encoder-Decoder Prediction Model.}
  \label{fig:CNN Encoder-Decoder Prediction Model.}
\end{figure}

% Requires: \usepackage{booktabs}
\begin{table}[h]
\centering
\footnotesize
\caption{Summary of our CNN encoder–decoder architecture.}
\label{tab:deepunet-summary-bordered}
\setlength{\tabcolsep}{6pt}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{|c|l|l|l|r|}
\hline
\textbf{Idx} & \textbf{Layer (name)} & \textbf{Type} & \textbf{Output size} & \textbf{\#Params} \\ \hline
0  & enc1.0     & Conv2d           & \(1 \times 32 \times 128 \times 128\)  & 320     \\ \hline
1  & enc1.1     & ReLU             & \(1 \times 32 \times 128 \times 128\)  & 0       \\ \hline
2  & enc1.2     & Conv2d           & \(1 \times 32 \times 128 \times 128\)  & 9248    \\ \hline
3  & enc1.3     & ReLU             & \(1 \times 32 \times 128 \times 128\)  & 0       \\ \hline
4  & enc2.0     & Conv2d           & \(1 \times 64 \times 64 \times 64\)    & 18496   \\ \hline
5  & enc2.1     & ReLU             & \(1 \times 64 \times 64 \times 64\)    & 0       \\ \hline
6  & enc2.2     & Conv2d           & \(1 \times 64 \times 64 \times 64\)    & 36928   \\ \hline
7  & enc2.3     & ReLU             & \(1 \times 64 \times 64 \times 64\)    & 0       \\ \hline
8  & enc3.0     & Conv2d           & \(1 \times 128 \times 32 \times 32\)   & 73856   \\ \hline
9  & enc3.1     & ReLU             & \(1 \times 128 \times 32 \times 32\)   & 0       \\ \hline
10 & enc3.2     & Conv2d           & \(1 \times 128 \times 32 \times 32\)   & 147584  \\ \hline
11 & enc3.3     & ReLU             & \(1 \times 128 \times 32 \times 32\)   & 0       \\ \hline
12 & up2.0      & ConvTranspose2d  & \(1 \times 64 \times 64 \times 64\)    & 32832   \\ \hline
13 & up2.1      & ReLU             & \(1 \times 64 \times 64 \times 64\)    & 0       \\ \hline
14 & up2.2.0    & Conv2d           & \(1 \times 64 \times 64 \times 64\)    & 36928   \\ \hline
15 & up2.2.1    & ReLU             & \(1 \times 64 \times 64 \times 64\)    & 0       \\ \hline
16 & up2.2.2    & Conv2d           & \(1 \times 64 \times 64 \times 64\)    & 36928   \\ \hline
17 & up2.2.3    & ReLU             & \(1 \times 64 \times 64 \times 64\)    & 0       \\ \hline
18 & up1.0      & ConvTranspose2d  & \(1 \times 32 \times 128 \times 128\)  & 8224    \\ \hline
19 & up1.1      & ReLU             & \(1 \times 32 \times 128 \times 128\)  & 0       \\ \hline
20 & up1.2.0    & Conv2d           & \(1 \times 32 \times 128 \times 128\)  & 9248    \\ \hline
21 & up1.2.1    & ReLU             & \(1 \times 32 \times 128 \times 128\)  & 0       \\ \hline
22 & up1.2.2    & Conv2d           & \(1 \times 32 \times 128 \times 128\)  & 9248    \\ \hline
23 & up1.2.3    & ReLU             & \(1 \times 32 \times 128 \times 128\)  & 0       \\ \hline
24 & final-conv & Conv2d           & \(1 \times 1 \times 128 \times 128\)   & 33      \\ \hline
\multicolumn{5}{|c|}{} \\[-0.9ex]\hline
25 & \textless{}TOTAL\textgreater{} &  &  & 419873 \\ \hline
\end{tabular}
\end{table}


In this work, after generating the initial attention maps dataset, we will design two deep learning models (CNN and WGAN) to predict the attention map for any tested unseen cover image. So, the first model to predict the attention map is the CNN encoder-decoder.
We choose the CNN encoder-decoder model as our choice for attention map prediction because it demonstrates expertise in detecting pixel relationships while generating detailed spatial outputs. The encoder extracts multiple scales of structural and contextual information, which includes edges and textures, before the decoder uses these features to create a detailed high-resolution attention map that shows tolerant areas for data insertion. The model learns to predict attention maps through end-to-end training, which produces strong feature representations that handle both local and global contexts through skip connections to generate accurate and spatially consistent results.
% The model requires extensive well-labeled training data and produces high computational costs while sometimes losing detailed information in the reconstructed maps. 
The CNN encoder–decoder model achieves an optimal combination of accurate results and good generalization performance and visually appealing output in attention map prediction tasks.

The model uses a CNN encoder-decoder structure, as shown in Figure~\ref{fig:CNN Encoder-Decoder Prediction Model.} and Table~\ref{tab:deepunet-summary-bordered} to process single-channel images, including grayscale edge maps and segmentation maps, while generating logit outputs instead of probability values. The encoder section consists of three stages that use two 3×3 convolutions with padding to preserve spatial dimensions and ReLU activations while performing 2×2 max pooling operations to generate feature maps with 32, 64 and 128 channels. The decoder structure follows the encoder pattern to perform two resolution-restoring stages through 2×2 transposed convolutions with stride 2 and two-convolution blocks for feature enhancement. The model implements element-wise addition for skip connections between encoder and decoder features at 64 and 32 channel resolutions to achieve parameter efficiency and stable gradients instead of traditional U-Net channel concatenation. A 1×1 convolution layer converts the 32-channel output of the decoder to produce a single-channel prediction that matches the input dimensions. The network generates untransformed logits output which functions well for BCEWithLogitsLoss and standard regression losses during training but needs sigmoid activation and optional thresholding for probabilistic mask generation during inference.

\noindent
We train a \textbf{CNN encoder-decoder} to generate single–channel grayscale attention maps from input images. All cover images, initial attention maps, and target images are converted to grayscale, resized to \(128\times128\), and loaded in randomly shuffled mini–batches. The encoder uses channels \(32\!\rightarrow\!64\!\rightarrow\!128\), and the decoder includes two up–convolution layers with additive skip connections. The network outputs a single–channel \emph{logit} map because the loss function \texttt{BCEWithLogitsLoss} applies the sigmoid internally. During training, each batch is moved to the selected device (\texttt{cuda} if available, otherwise \texttt{cpu}) for the forward pass, loss computation, and parameter updates using the \texttt{Adam} optimizer with learning rate \(1\times10^{-4}\). Training runs for \textbf{100 epochs} with a batch size of \textbf{8}, without data augmentation, weight regularization, or learning–rate scheduling. After each epoch, the average loss is reported, and the final weights are saved. At inference time, a sigmoid is applied to the output logits to obtain probability–based attention maps. This simple, reliable setup omits validation checks and complex transformations to keep training stable and efficient.


\begin{table}[htbp]
\centering
\footnotesize
\caption{Training parameters and their values.}
\label{tab:train-params}
\setlength{\tabcolsep}{8pt}
\renewcommand{\arraystretch}{1.15}
\begin{tabular}{|l|l|}
\hline
\textbf{Parameter} & \textbf{Value} \\
\hline
Model architecture & Deep U\!-Net (enc: 32$\rightarrow$64$\rightarrow$128; dec: two up-convs with skip adds) \\
Input modality & Grayscale, resized to $128\times128$ \\
Batch size & 8 \\
Epochs & 100 \\
Loss function & \texttt{BCEWithLogitsLoss} (no sigmoid in \texttt{forward}) \\
Optimizer & Adam \\
Learning rate & $1\times10^{-4}$ \\
Weight decay & None \\
LR scheduler & None \\
Shuffling & Enabled for training batches \\
Data augmentation & None \\
Device & \texttt{cuda} if available, otherwise \texttt{cpu} \\
Inference post-processing & Sigmoid applied to logits at test time \\
\hline
\end{tabular}
\end{table}
Table~\ref{tab:train-params} shows the configuration trains a CNN (\emph{encoder} $32!\rightarrow!64!\rightarrow!128$ with two up-convs and additive skips) on \textbf{grayscale} inputs resized to $128\times128$, balancing detail and compute; raising channels or input size can improve fidelity but increases memory/time, while lowering them speeds training at the cost of detail. \textbf{Batch size} $=8$ and \textbf{epochs} $=100$ provide stable updates without large memory needs; larger batches run faster but may reduce generalization, and more epochs can help until overfitting emerges. The \textbf{loss} is \texttt{BCEWithLogitsLoss}, so the model outputs a single-channel \emph{logit} map (no sigmoid in \texttt{forward}); alternatives (e.g., Dice/Focal) can help under class imbalance. \textbf{Adam} with \textbf{learning rate} $1\times10^{-4}$ typically converges reliably—higher LR trains faster but risks divergence; lower LR is safer but slower. There is \textbf{no weight decay} or \textbf{LR scheduler}; adding small L2 (e.g., $10^{-5}$–$10^{-4}$) can curb overfitting, and a scheduler (cosine/plateau) often improves late-stage optimization. \textbf{Shuffling} is enabled to avoid order bias, and \textbf{no data augmentation} is used; light augmentation usually boosts robustness at modest cost. Training runs on \textbf{\texttt{cuda}} when available (else \texttt{cpu}). At inference, a \textbf{sigmoid} converts logits to probabilities; adjusting the decision threshold (e.g., around $0.5$) trades stricter predictions for sensitivity in the produced attention maps.

\section{Attention Maps Prediction Using WGAN}
The WGAN serves as the second model which generates predictions in attentin maps. The attention maps serve as guidance to direct both embedding and extraction operations. The WGAN model generates attention maps that match real-world edge and texture features because it produces more realistic and stable output than traditional GANs and other generative models. The generator of this model produces attention maps that closely match the true perceptual distributions of edge and texture features while the discriminator assesses their realism through Wasserstein distance calculations instead of binary classification loss. The metric produces smooth gradients which prevent the model from collapsing during training and the unstable behavior that standard GANs commonly experience. The WGAN model performs best for tasks that need continuous and spatially consistent outputs because it generates attention maps with precise intensity and structural details that impact percepetual quality. WGAN produces attention maps that appear natural and smooth with better distribution patterns which results in improved image stability and better generalization for different image types.


Figures~\ref{fig:GAN Generator.} and ~\ref{fig:GAN Discriminator.} shows that the system implements a conditional WGAN-GP architecture~\cite{li2020generative} which includes a UNet generator and a convolutional critic. The GeneratorUNet model accepts grayscale cover images of 1x128x128 dimensions before it applies four downsampling blocks that use Conv2d with stride 2 and ReLU activation followed by InstanceNorm2d and ReLU activation in the second block onward to generate feature maps at \(64\times64,\, 32\times32,\, 16\times16,\, \text{and } 8\times8\) resolutions. The decoder performs bilinear upsampling at each stage while using 3x3 convolutions with InstanceNorm2d and ReLU activation followed by feature concatenation from encoder layers through skip connections to restore spatial details. The output of the final block produces a single-channel sigmoid map that ranges between 0 and 1. The critic network (CriticConditional) accepts the pair of cover and attention images (two-channel input) through four Conv2d+LeakyReLU stages until it reaches 8x8 resolution before applying AdaptiveAvgPool2d(1), flattening, and a linear head that generates a scalar score without Sigmoid activation because WGAN losses require it.

\begin{figure}[!htbp]
  \centering
  % اضبط القيمتين كما تشاء (مثال بنسبة من الصفحة)
  \includegraphics[width=1.0\textwidth,height=0.90\textheight,keepaspectratio]{Figs/GAN_Generator.PNG}
  \caption{WGAN-GP Generator.}
  \label{fig:GAN Generator.}
\end{figure}


\begin{figure}[!htbp]
  \centering
  % اضبط القيمتين كما تشاء (مثال بنسبة من الصفحة)
  \includegraphics[width=1.0\textwidth,height=0.90\textheight,keepaspectratio]{Figs/Discriminrator.PNG}
  \caption{GAN critic Discriminator.}
  \label{fig:GAN Discriminator.}
\end{figure}


\begin{table}[h]
\centering
\caption{GeneratorUNet Summary}
\label{tab:genunet-summary}
\setlength{\tabcolsep}{6pt}
\renewcommand{\arraystretch}{1.15}
\begin{tabular}{|r|l|l|l|r|}
\hline
\textbf{\#} & \textbf{Layer (name)} & \textbf{Type} & \textbf{Output size} & \textbf{\#Params} \\ \hline
0  & e1.0  & Conv2d          & \texttt{1 x 32 x 64 x 64}   & 544     \\ \hline
1  & e1.1  & ReLU            & \texttt{1 x 32 x 64 x 64}   & 0       \\ \hline
2  & e2.0  & Conv2d          & \texttt{1 x 64 x 32 x 32}   & 32832   \\ \hline
3  & e2.1  & InstanceNorm2d  & \texttt{1 x 64 x 32 x 32}   & 128     \\ \hline
4  & e2.2  & ReLU            & \texttt{1 x 64 x 32 x 32}   & 0       \\ \hline
5  & e3.0  & Conv2d          & \texttt{1 x 128 x 16 x 16}  & 131200  \\ \hline
6  & e3.1  & InstanceNorm2d  & \texttt{1 x 128 x 16 x 16}  & 256     \\ \hline
7  & e3.2  & ReLU            & \texttt{1 x 128 x 16 x 16}  & 0       \\ \hline
8  & e4.0  & Conv2d          & \texttt{1 x 256 x 8 x 8}    & 524544  \\ \hline
9  & e4.1  & InstanceNorm2d  & \texttt{1 x 256 x 8 x 8}    & 512     \\ \hline
10 & e4.2  & ReLU            & \texttt{1 x 256 x 8 x 8}    & 0       \\ \hline
11 & u1.0  & Upsample        & \texttt{1 x 256 x 16 x 16}  & 0       \\ \hline
12 & u1.1  & Conv2d          & \texttt{1 x 128 x 16 x 16}  & 295040  \\ \hline
13 & u1.2  & InstanceNorm2d  & \texttt{1 x 128 x 16 x 16}  & 256     \\ \hline
14 & u1.3  & ReLU            & \texttt{1 x 128 x 16 x 16}  & 0       \\ \hline
15 & u2.0  & Upsample        & \texttt{1 x 256 x 32 x 32}  & 0       \\ \hline
16 & u2.1  & Conv2d          & \texttt{1 x 64 x 32 x 32}   & 147520  \\ \hline
17 & u2.2  & InstanceNorm2d  & \texttt{1 x 64 x 32 x 32}   & 128     \\ \hline
18 & u2.3  & ReLU            & \texttt{1 x 64 x 32 x 32}   & 0       \\ \hline
19 & u3.0  & Upsample        & \texttt{1 x 128 x 64 x 64}  & 0       \\ \hline
20 & u3.1  & Conv2d          & \texttt{1 x 32 x 64 x 64}   & 36896   \\ \hline
21 & u3.2  & InstanceNorm2d  & \texttt{1 x 32 x 64 x 64}   & 64      \\ \hline
22 & u3.3  & ReLU            & \texttt{1 x 32 x 64 x 64}   & 0       \\ \hline
23 & u4.0  & Upsample        & \texttt{1 x 64 x 128 x 128} & 0       \\ \hline
24 & u4.1  & Conv2d          & \texttt{1 x 1 x 128 x 128}  & 577     \\ \hline
25 & u4.2  & Sigmoid         & \texttt{1 x 1 x 128 x 128}  & 0       \\ \hline
\multicolumn{5}{|c|}{} \\[-0.9ex]\hline
26 & \textless TOTAL\textgreater &  &  & \textbf{1,170,497} \\ \hline
\end{tabular}
\end{table}


\begin{table}[h]
\centering
\caption{CriticConditional Summary}
\label{tab:criticconditional-summary}
\setlength{\tabcolsep}{6pt}
\renewcommand{\arraystretch}{1.15}
\begin{tabular}{|r|l|l|l|r|}
\hline
\textbf{\#} & \textbf{Layer (name)} & \textbf{Type} & \textbf{Output size} & \textbf{\#Params} \\ \hline
0  & net.0   & Conv2d            & \ttfamily 1 x 64 x 64 x 64  & 2112    \\ \hline
1  & net.1   & LeakyReLU         & \ttfamily 1 x 64 x 64 x 64  & 0       \\ \hline
2  & net.2   & Conv2d            & \ttfamily 1 x 128 x 32 x 32 & 131200  \\ \hline
3  & net.3   & LeakyReLU         & \ttfamily 1 x 128 x 32 x 32 & 0       \\ \hline
4  & net.4   & Conv2d            & \ttfamily 1 x 256 x 16 x 16 & 524544  \\ \hline
5  & net.5   & LeakyReLU         & \ttfamily 1 x 256 x 16 x 16 & 0       \\ \hline
6  & net.6   & Conv2d            & \ttfamily 1 x 512 x 8 x 8   & 2097664 \\ \hline
7  & net.7   & LeakyReLU         & \ttfamily 1 x 512 x 8 x 8   & 0       \\ \hline
8  & net.8   & AdaptiveAvgPool2d & \ttfamily 1 x 512 x 1 x 1   & 0       \\ \hline
9  & net.9   & Flatten           & \ttfamily 1 x 512           & 0       \\ \hline
10 & net.10  & Linear            & \ttfamily 1 x 1             & 513     \\ \hline
\multicolumn{4}{|r|}{\textbf{TOTAL}} & \textbf{2,756,033} \\ \hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\footnotesize
\caption{Training hyperparameters and their values (conditional WGAN--GP attention).}
\label{tab:train-hparams}
\setlength{\tabcolsep}{8pt}
\renewcommand{\arraystretch}{1.15}
\begin{tabular}{|l|l|}
\hline
\textbf{Parameter} & \textbf{Value} \\ \hline
Image size & \(128\times128\) \\
Input modality & Grayscale (\texttt{as\_gray}=\texttt{True}) \\
Batch size & 8 \\
Epochs & 100\\
Optimizer & Adam \\
Learning rate & \(1\times 10^{-4}\) \\
Adam betas & \((0.5,\;0.9)\) \\
Weight decay & None \\
Adversarial framework & WGAN--GP (conditional) \\
Gradient penalty \(\lambda_{\mathrm{GP}}\) & 10.0 \\
Critic steps per G step \((n_{\text{critic}})\) & 5 \\
Reconstruction weight \(\lambda_{L1}\) & 50.0 \\
Validation split & 0.10 \\
DataLoader workers & 2 \\
Random seed & 42 \\
Device & \texttt{cuda} (if available) else \texttt{cpu} \\
Best model selection & SSIM on validation set \\
\hline
\end{tabular}
\end{table}
During training, image pairs are formed by filename–matching between the \textit{cover} and \textit{initial attention} directories, then each image is resized to \(128\times128\) and converted to tensors. The dataset is split using \(\texttt{va-split}=0.1\), assigning \(90\%\) to training and \(10\%\) to validation (with at least one validation sample if \(n>1\)). Training alternates between updates to the \textbf{critic} \(D\) and the \textbf{generator} \(G\). For each batch, the critic receives \(n_{\text{crit}}\) updates (default \(=5\)) to evaluate \(D(\text{cover},\text{real})\) and \(D(\text{cover},G(\text{cover}))\), and adds a gradient–penalty term on random interpolations \(\hat{x}\) between real and generated samples. The critic loss is
\begin{equation}\label{eq:critic-loss}
\mathcal{L}_C \;=\; -\,\mathbb{E}\!\left[D(\text{cover},\text{real})\right]
\;+\; \mathbb{E}\!\left[D(\text{cover},G(\text{cover}))\right]
\;+\; \lambda_{\mathrm{GP}}\!\left(\left\lVert\nabla_{\hat{x}} D(\text{cover},\hat{x})\right\rVert_2 - 1\right)^{\!2},
\end{equation}
where \(\lambda_{\mathrm{GP}}\) is the \emph{gradient–penalty coefficient} that enforces the 1-Lipschitz constraint for \(D\). Increasing \(\lambda_{\mathrm{GP}}\) strengthens the constraint (typically improving stability but potentially slowing training), while decreasing it may speed up training at the risk of instability. The interpolated samples \(\hat{x}\) are points between real and generated images used to compute this penalty.

The generator receives two updates per iteration and is trained with an adversarial term plus an \(L_1\) reconstruction penalty:
\begin{equation}\label{eq:gen-loss}
\mathcal{L}_G \;=\; -\,\mathbb{E}\!\left[D(\text{cover},G(\text{cover}))\right]
\;+\; \lambda_{L1}\,\bigl\lVert G(\text{cover}) - \text{real} \bigr\rVert_1 .
\end{equation}
Here, the first term encourages \(G\) to produce outputs that fool \(D\), while \(\lambda_{L1}\) controls the strength of the pixelwise fidelity term: larger \(\lambda_{L1}\) promotes sharper alignment to the target (higher structural accuracy but possibly smoother textures), whereas smaller \(\lambda_{L1}\) can yield more visually diverse textures at the cost of higher pixel error. Overall, \(D\) learns to discriminate real from generated pairs, and \(G\) learns to create realistic, faithful attention maps under the balance set by \(\lambda_{\mathrm{GP}}\) and \(\lambda_{L1}\).

Table~\ref{tab:genunet-summary} summarizes the \emph{Generator U-Net} architecture layer by layer. The network adopts a classic encoder--decoder design with four downsampling (encoder) stages and four upsampling (decoder) stages. In the encoder, spatial resolution is reduced from \(128\times128\) to \(8\times8\) while channels increase from 32 to 256, enabling the model to capture both fine and high-level texture cues. Each convolution block (\texttt{Conv2d}) is followed by \texttt{InstanceNorm2d} and \texttt{ReLU}, which support stable training and well-scaled features. The decoder mirrors this process using \texttt{Upsample} layers, then convolution and normalization, to progressively reconstruct a high-resolution output. The final \texttt{Conv2d} maps features to a single channel \((1\times128\times128)\), and a \texttt{Sigmoid} activation produces a normalized grayscale attention map in \([0,1]\). Overall, the model comprises about \textbf{1.17M} trainable parameters, striking a practical balance between capacity and efficiency for image-to-image translation with multi-scale feature capture and accurate reconstruction.


\noindent\textbf{Conditional Critic Architecture Analysis.}
Table~\ref{tab:criticconditional-summary} summarizes the architecture of the
\emph{Conditional Critic} used in adversarial training. The network is a
hierarchical CNN that alternates \(3\times3\) convolutions and
\texttt{LeakyReLU} activations while progressively increasing channel depth
(64\(\rightarrow\)128\(\rightarrow\)256\(\rightarrow\)512) and reducing spatial
resolution from \(64\times64\) to \(8\times8\). This design extracts
increasingly abstract features and stabilizes optimization by preserving
gradients on negative activations. After the final convolutional block, an
\texttt{AdaptiveAvgPool2d} aggregates global spatial information into a compact
\(512\times1\times1\) descriptor, which is then flattened and mapped by a
\texttt{Linear} layer to a single scalar score indicating realism/consistency
with the conditional input. The model comprises \textbf{2{,}756{,}033}
trainable parameters, offering sufficient capacity for robust discrimination
while remaining computationally tractable. Overall, the critic follows the
standard WGAN-style discriminator pattern, balancing depth and parameter count
to ensure stable gradients and effective separation of real versus generated
conditional samples.

In the training process as shown in Table~\ref{tab:train-hparams}, the training process operates with 128x128 image dimensions using grayscale input data and an 8-sample batch size for 30 training epochs. The Adam optimizer optimizes both the generator and critic networks with a learning rate of \(1\times 10^{-4}\) and betas set to (0.5, 0.9). The WGAN--GP regularizer operates with \(\lambda_{\mathrm{GP}}=10.0\) and \(n_{\text{critic}}=5\) critic steps per generator step while the pixel term uses \(\lambda_{L1}=50.0\). The system divides its data into training and validation sets at a 0.1 ratio for validation while using two I/O workers and seed 42 for reproducibility. The system uses cuda for computations when available otherwise it defaults to cpu. The chosen parameters focus on achieving stable training through WGAN--GP with repeated critic updates and precise target alignment through strong L1 weights and efficient processing at 128x128 resolution for generating attention maps that satisfy both critic expectations and match the actual ground truth.


