This repository is the official implementation of Generative Photography.
Generative Photography: Scene-Consistent Camera Control for Realistic Text-to-Image Synthesis
Yu Yuan, Xijun Wang, Yichen Sheng, Prateek Chennuri, Xingguang Zhang, Stanley Chan
[Paper] [Project Page] [Dataset] [Weights(coming)] [HF Demo(coming)]
Image generation today can produce somewhat realistic images from text prompts. However, if one asks the generator to synthesize a particular camera setting such as creating different fields of view using a 24mm lens versus a 70mm lens, the generator will not be able to interpret and generate scene-consistent images. This limitation not only hinders the adoption of generative tools in photography applications but also exemplifies a broader issue of bridging the gap between the data-driven models and the physical world. In this paper, we introduce the concept of Generative Photography, a framework designed to control camera intrinsic settings during content generation. The core innovation of this work are the concepts of Dimensionality Lifting and Contrastive Camera Learning, which achieve continuous and consistent transitions for different camera settings. Experimental results show that our method produces significantly more scene-consistent photorealistic images than state-of-the-art models such as Stable Diffusion 3 and FLUX.
Current state-of-the-art text-to-image generation models like Stable Diffusion 3 (SD3) and FLUX face two major limitations: the inability to accurately interpret camera-specific settings and the challenge of maintaining consistency in the base scene (pls see below examples).
This work introduces a novel approach that addresses these issues, enabling precise camera setting control and consistent scenes in generative models.
- Release network and training code.
- Release pretrained weights.
- Release physical camera settings simulation code.
- Release Gradio Demo.
- Release pretrained models on other T2V foundation models.
- 64-bit Python 3.10 and PyTorch 1.13.1.
- CUDA 11.7
- Users can use the following commands to install the packages
conda env create -f environment.yaml
conda activate genphoto
- Download the camera setting dataset (base images for each camera setting) from camera_settings.
- Using LLaVA or other vision language models to generate a caption for each base image. We already provide our extracted captions in the
annotations/xxxx_json.py
folders. - You can split the json files for training and testing, you can construct the validation json file by randomly sampling some item from the training json file.
- All camera setting physical simulations will be done before dataloader.
We showcase visual results generated by different methods on camera bokeh rendering, focal length, shutter speed, and color temperature control. Both Stable Diffusion 3 (SD3) and FLUX generate images with a fixed random seed.
Both AnimateDiff and CameraCtrl have been fine-tuned/trained on our contrastive data.
We show more camera-controlled videos generated by our method.
This project is released for academic use. We disclaim responsibility for user-generated content. Users are solely liable for their actions. The project contributors are not legally affiliated with, nor accountable for, users' behaviors. Use the generative model responsibly, adhering to ethical and legal standards.
We thank AnimateDiff and CameraCtrl for their amazing jobs.
@article{Yuan_2024_GenPhoto,
title={Generative Photography: Scene-Consistent Camera Control for Realistic Text-to-Image Synthesis},
author={Yuan, Yu and Wang, Xijun and Sheng, Yichen and Chennuri, Prateek and Zhang, Xingguang and Chan, Stanley},
journal={arXiv preprint arXiv: 2412.02168},
year={2024}
}