Patch-Wise Graph Contrastive Learning for Image Translation

Chanyong Jung, Gihyun Kwon, Jong Chul Ye

Abstract

Recently, patch-wise contrastive learning is drawing attention for the image translation by exploring the semantic correspondence between the input image and the output image. To further explore the patch-wise topology for high-level semantic understanding, here we exploit the graph neural network to capture the topology-aware features. Specifically, we construct the graph based on the patch-wise similarity from a pretrained encoder, whose adjacency matrix is shared to enhance the consistency of patch-wise relation between the input and the output. Then, we obtain the node feature from the graph neural network, and enhance the correspondence between the nodes by increasing mutual information using the contrastive loss. In order to capture the hierarchical semantic structure, we further propose the graph pooling. Experimental results demonstrate the state-of-art results for the image translation thanks to the semantic encoding by the constructed graphs.

Introduction

Image-to-image (I2I) translation aims to transform an image from a source domain to a target domain while preserving the underlying content. While recent methods like Contrastive Unpaired Translation (CUT) have successfully utilized patch-wise contrastive learning to maintain semantic correspondence, they often treat patches as independent entities. This "tunnel vision" ignores the spatial and semantic relationships between patches—the image's topology. Without understanding these relationships, translations can suffer from structural distortions or loss of context.

Overview of the patch-wise graph contrastive learning framework showing implicit patch connection and node-wise MI maximization.

Methodology

The proposed framework leverages Graph Neural Networks (GNNs) to capture topological relationships between image patches through three primary stages.

Graph Construction and Shared Adjacency

Image patches are treated as nodes in a graph. A pre-trained encoder (e.g., VGG16) extracts features to calculate patch-wise similarity, which forms an adjacency matrix ($A$). By sharing this matrix between the input and output domains, the model enforces structural consistency, ensuring that if two patches are semantically related in the input, they remain so in the output.

Topology-Aware Feature Extraction

The graphs are processed through a Topology Adaptive Graph Convolution Network (TAGCN). This allows nodes to aggregate information from their neighbors across multiple hops, producing features ($Z$ for input, $V$ for output) that encapsulate local and global context rather than isolated pixel data.

Hierarchical Semantic Understanding via Graph Pooling

To focus on task-relevant regions, the model employs Top-K graph pooling. A learnable pooling vector weights nodes, effectively acting as an attention mechanism that prioritizes complex textures and object boundaries over less informative regions like clear sky.

Detailed architecture (a) showing the GNN and pooling layers, and the topological intuition (b) that connected patches in the input should remain connected in the output.

Graph Contrastive Loss

The model is trained using a combination of GAN loss and a Graph Contrastive Loss (InfoNCE). This loss maximizes the mutual information between corresponding nodes in the input and output graphs, ensuring that the semantic identity of patches is preserved through the translation process.

Experiments and Results

The method was evaluated on standard benchmarks including Horse $\rightarrow$ Zebra, Summer $\rightarrow$ Winter, and Map $\rightarrow$ Satellite.

Quantitative Performance

The proposed approach achieved state-of-the-art results. Notably, in the Horse $\rightarrow$ Zebra task, it reached an FID of 34.5, significantly outperforming CUT (45.5). Similar improvements were observed across other datasets, demonstrating the robustness of topology-aware features.

Qualitative Analysis

Visually, the model produces sharper details and maintains better structural integrity. For instance, it accurately renders domain-specific patterns (like zebra stripes around the mouth) that other models often blur. In single-image translation tasks, such as Monet $\rightarrow$ Photo, it preserves fine structures like tree branches with higher fidelity than previous methods.

Conclusion

By integrating GNNs and graph pooling into the contrastive learning framework, this work addresses the limitations of isolated patch-wise matching. Capturing the topological structure of images allows for more semantically consistent and visually realistic image translation. Future work may extend this approach to video or 3D data where structural consistency is even more critical.

Summary updated

BibTeX
@inproceedings{jung2024patch,
  author = {Chanyong Jung and Gihyun Kwon and Jong Chul Ye},
  title = {{Patch-Wise Graph Contrastive Learning for Image Translation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=CcWSaPuXIa},
}
Figure