ContraNeRF: 3D-Aware Generative Model via Contrastive Learning with Unsupervised Implicit Pose Embedding

Mijeong Kim, Hyunjoon Lee, Bohyung HanarXiv 2023

Abstract

Although 3D-aware GANs based on neural radiance fields have achieved competitive performance, their applicability is still limited to objects or scenes with the ground-truths or prediction models for clearly defined canonical camera poses. To extend the scope of applicable datasets, we propose a novel 3D-aware GAN optimization technique through contrastive learning with implicit pose embeddings. To this end, we first revise the discriminator design and remove dependency on ground-truth camera poses. Then, to capture complex and challenging 3D scene structures more effectively, we make the discriminator estimate a high-dimensional implicit pose embedding from a given image and perform contrastive learning on the pose embedding. The proposed approach can be employed for the dataset, where the canonical camera pose is ill-defined because it does not look up or estimate camera poses. Experimental results show that our algorithm outperforms existing methods by large margins on the datasets with multiple object categories and inconsistent canonical camera poses.

Introduction: Beyond Canonical Poses

Most state-of-the-art 3D-aware Generative Adversarial Networks (GANs), such as EG3D, rely heavily on knowing the camera pose—the angle and position from which a photo was taken—for every image in the training set. This requirement works well for datasets with a clear "front" and "back," such as human faces (FFHQ) or cat faces (AFHQ). However, for complex scenes like "LSUN Bedroom" or "LSUN Church," there is no standard "canonical" pose, and estimating poses for such diverse scenes is notoriously difficult.

Previous attempts to train 3D GANs without pose labels often fall into the "planar trap": the model generates realistic 2D images but "cheats" on the 3D structure, producing flat, "cardboard-cutout" geometry instead of true depth. ContraNeRF aims to bridge this gap, enabling high-quality 3D generation for complex, unconstrained datasets by replacing explicit camera pose requirements with a self-supervised implicit pose embedding.

ContraNeRF achieves high-quality 3D geometry reconstruction, avoiding the "planar trap" common in unsupervised 3D GANs.

Methodology: Contrastive Learning for 3D Awareness

The authors build their approach on top of the EG3D architecture, which utilizes a tri-plane representation for efficient 3D volume rendering. The core innovation lies in the discriminator's design and training:

  1. Removing Pose Dependency: Unlike standard 3D GANs that feed camera poses into the discriminator, ContraNeRF's discriminator takes only the image as input.
  2. Implicit Pose Embedding: Instead of forcing the model to predict simple 2D coordinates (like yaw and pitch), the discriminator projects the image into a high-dimensional implicit pose embedding space.
  3. Contrastive Learning (InfoNCE): To train this embedding without labels, the authors use a contrastive loss. During training, the generator produces multiple views of the same "fake" scene. The discriminator is tasked with "pulling" the embeddings of images from the same camera pose together while "pushing" embeddings from different poses apart.
  4. High-Dimensionality: Using a high-dimensional vector (e.g., 24 or more dimensions) for the pose embedding is crucial. This allows the model to capture subtle geometric nuances that simple yaw/pitch coordinates cannot.

By using an implicit embedding, the model discovers its own internal representation of "viewpoint" that best explains the 3D structure of the scene, rather than being forced to map a complex environment to a human-defined coordinate system.

Experimental Results

The model was evaluated on several challenging datasets lacking ground-truth poses, including LSUN Bedroom, LSUN Church, AFHQ (Cats, Dogs, Wildlife), and CUB (Birds).

Qualitative results across diverse datasets. For each category, the figure shows the reconstructed 3D mesh (left), multi-view RGB renderings (top row), and corresponding depth maps (bottom row).

Quantitative Performance

  • Superior 3D Geometry: On the LSUN Bedroom dataset, ContraNeRF achieved a Depth FID of 49.30, vastly outperforming the intermediate "PRNeRF" baseline (110.42) and other models like GIRAFFE (145.63), which produced almost entirely flat depth maps.
  • State-of-the-Art FID: On the CUB (birds) dataset, ContraNeRF achieved an FID of 17.65, a significant improvement over previous unsupervised 3D GANs which typically achieved scores around 46-49.

Qualitative Analysis

Qualitative results demonstrate that ContraNeRF produces realistic multi-view rotations for bedrooms and churches where previous methods produced "hallucinated" or static 2D textures. The model effectively captures the heterogeneous geometry of complex indoor and outdoor scenes.

Discussion and Conclusion

ContraNeRF demonstrates that explicit pose regression often fails on complex scenes, leading to collapsed 2D-like geometry. By leveraging self-supervision via rendering—where the "ground truth" for the contrastive loss comes from the generator's known rendering poses—the discriminator learns 3D relationships that transfer to its understanding of real 2D images.

While the model occasionally produces planar scenes for outliers like watermarked images, it represents a major step toward 3D generation from "in-the-wild" photo collections. Future work may focus on reducing the computational complexity added by the contrastive training loop and extending the framework to even more unconstrained datasets where object categories are not well-defined.

Summary updated

BibTeX
@misc{kim2023contranerf,
  author = {Mijeong Kim and Hyunjoon Lee and Bohyung Han},
  title = {{ContraNeRF: 3D-Aware Generative Model via Contrastive Learning with Unsupervised Implicit Pose Embedding}},
  year = {2023},
  eprint = {2304.14005},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.14005},
}
Figure