# Detecting AI-Generated Images Using a Hybrid ResNet-SE Attention Model
## 3 Methodology
### Hybrid Architecture: SE-ResNet50  
Integrating SE blocks into each residual block of ResNet-50 results in the proposed SE-ResNet50 model. Specifically, each standard residual block in ResNet-50 is modified by adding an SE attention module at the end of each block. This modification enriches residual blocks with adaptive, channel-wise attention capability while preserving the robust feature extraction characteristics of the original residual connections. The complete architecture initialization and forward pass procedure is detailed in Algorithm 2 and Figure 2.  
```
1:In:\(I\in\mathbb{R}^{3\times 224\times 224}\)
2:Out:\(y\in\mathbb{R}^{C}\)
3:procedureInitModel
4:\(\mathcal{R}\leftarrow\texttt{Pretrain}(R50)\)
5:for\(B_{i}\in\{L_{1},L_{2},L_{3},L_{4}\}\)do
6:for\(L_{j}\in B_{i}\)do
7:\(L_{j}\gets L_{j}+\texttt{SE}\)
8:endfor
9:endfor
10:\(W_{fc}\in\mathbb{R}^{d\times C}\), \(b_{fc}\in\mathbb{R}^{C}\)
11:endprocedure
12:procedureFwdPass(\(I\)) \(F\leftarrow\texttt{CB}(I)\) \(\triangleright\)CB = Conv + MP
13:for\(B_{i}\in\{L_{1},L_{2},L_{3},L_{4}\}\)do
14:\(F\gets B_{i}(F)\)
15:endfor
16:\(F\leftarrow\texttt{GAP}(F)\)
17:\(z\gets W_{fc}\cdot F+b_{fc}\)
18:\(y\leftarrow\texttt{SM}(z)\)
19:return\(y\)
20:endprocedure
```  
**Legend:**  
* \(I\): Input image tensor.
* \(y\): Output class probabilities.
* \(R50\): ResNet-50.
* \(L_{i}\): Residual block layers (\(i=1\) to 4).
* \(L_{j}\): Convolutional layer within block.
* SE: Squeeze-and-Excitation Layer
* CB: Convolution + Max Pooling.
* GAP: Global Average Pooling.
* SM: Softmax function.
* \(W_{fc},b_{fc}\): Weights and bias of final fully connected layer.
* \(d\): Feature vector dimension after GAP.
* \(C\): Number of output classes. The overall hybrid architecture comprises the following:
* **Initial convolutional layer:**\(7\times 7\) convolution, stride = 2; followed by batch normalization and ReLU activation; max pooling with \(3\times 3\) kernel, stride = 2.
* **Stacked SE-ResNet blocks:*
* 3 SE-residual blocks (64 channels)
* 4 SE-residual blocks (128 channels)
* 6 SE-residual blocks (256 channels)
* 3 SE-residual blocks (512 channels)
* **Classification head:** Global Average Pooling (GAP) followed by a fully connected (FC) layer for binary classification (real vs. AI-generated).  
The final fully connected layer outputs probability scores using a softmax activation function:  
\[y_{\text{pred}}=\text{softmax}(W_{fc}\cdot x_{GAP}+b_{fc}) \tag{4}\]  
where \(W_{fc}\) and \(b_{fc}\) represent the weights and bias of the final classification layer, respectively, and \(x_{GAP}\) is the output from the global average pooling layer.  
The methodology section presented a structured approach to effectively identify Al-generated images. The CIFAKE dataset was employed, providing a robust benchmark for evaluation. Baseline models (ResNet, VGGNet, and DenseNet) were initially evaluated to establish performance baselines. Subsequently, a novel hybrid model, SE-ResNet50, integrating the ResNet-50 architecture with the Squeeze-and-Excitation (SE) channel-wise attention mechanism, was proposed to enhance the detection of subtle synthetic image features.  
This explanation included the architectural integration of SE-blocks within residual blocks, clearly articulated equations and algorithmic pseudocode, and highlighted the advantages of the hybrid approach concerning computational complexity, interpretability, and improved accuracy. Experimental configurations, including software tools, computational environment, and hyperparameters, were explicitly detailed. Comprehensive evaluation metrics were also defined to rigorously quantify and compare the performance of the proposed model with baseline models.