## 3 Materials and Methods
### Architectural Enhancements over Original StarGAN
#### 3.2.1 Attention Mechanisms  
Perspective Transformation Module (PTM)  
The **Perspective Transformation Module** is a specialized neural network module that learns to generate and apply perspective transformations to input images or feature maps. Its functionality can be broken down into several key components:  
* **Feature Extraction Component. ** This component processes the input data to extract relevant information about spatial relationships and visual structures within the image. It reduces the spatial dimensions while increasing the feature richness, effectively compressing the visual information into a representation that is suitable for predicting transformation parameters. * **Transformation Parameter Prediction. ** Based on the extracted features, this component generates a set of six parameters that define an affine transformation matrix. These parameters control various aspects of the transformation, including rotation,scaling, shearing, and translation effects. The component is initially configured to predict an identity transformation (no change) and learns to predict appropriate transformations during training. * **Randomization Mechanism. ** To introduce diversity in the transformations, this component adds controlled randomness to the predicted parameters. It applies random rotations, scaling factors, and small translations that vary from one input to another. This variability ensures that the module can produce diverse viewpoint changes rather than a single fixed transformation. * **Transformation Application. ** The final component constructs a transformation grid based on the combined predicted and randomized parameters. It then applies this transformation to the input data using interpolation techniques that ensure the resulting output maintains visual coherence. This process warps the input according to the specified perspective change while preserving the overall visual content. In essence, the module functions as a learnable perspective transformer that can adapt its behavior based on input characteristics while incorporating controlled randomness to produce diverse transformations. The entire process is differentiable, allowing the module to be integrated into larger neural network architectures and trained end-to-end. The whole architecture is displayed in Figure 1.  
Viewpoint Attention Module (VAM)  
The **Viewpoint Attention Module** implements a self-attention mechanism within neural networks designed to focus on specific regions in feature representations. This module enables selective emphasis of important spatial locations within visual data. Core components and their functions include the following:  
* **Query, Key, and Value Projections. ** The module utilizes three parallel transformations of the input data: \(\bigcirc\) **Query Projection** transforms the input features to represent \"what we're looking for\" at each position. This projection typically reduces the feature dimensionality to create a more compact representation. \(\bigcirc\) **Key Projection** creates a representation of \"what information is available\" at each position, with similar dimensionality reduction as the query projection. \(\bigcirc\) **Value Projection** represents the actual information content at each position that will be selectively emphasized or attenuated by the attention mechanism. This projection typically maintains the original feature dimensions. Figure 1: Perspective transformation module. * **Attention Computation. ** The attention mechanism operates by:
* Computing similarity scores between query and key representations, measuring how relevant each position is to every other position. * Normalizing these similarity scores using SoftMax to create attention weights that sum to 1. * These weights effectively create a probability distribution indicating which regions should receive greater focus. * **Feature Aggregation. ** After computing attention weights, the module:
* Uses these weights to create a weighted combination of value features.