RealCustom Series
π Introduction
Existing text-to-image customization methods (i.e., subject-driven generation) face a fundamental challenge due to the entangled influence of visual and textual conditions. This inherent conflict forces a trade-off between subject fidelity and textual controllability, preventing simultaneous optimization of both objectives.We present RealCustom to disentangle subject similarity from text controllability and thereby allows both to be optimized simultaneously without conflicts. The core idea of RealCustom is to represent given subjects as real words that can be seamlessly integrated with given texts, and further leveraging the relevance between real words and image regions to disentangle visual condition from text condition.
β‘οΈ Quick Start
π§ Requirements and Installation
Install the requirements
bash envs/init.sh
βοΈ Inference
bash inference/inference_single_image.sh
π Gradio Demo
python inference/app.py
Sample Usage (Text-to-Image Generation)
from inference_solver import FlexARInferenceSolver
from PIL import Image
# ******************** Image Generation ********************
inference_solver = FlexARInferenceSolver(
model_path="Alpha-VLLM/Lumina-mGPT-7B-768",
precision="bf16",
target_size=768,
)
q1 = f"Generate an image of 768x768 according to the following prompt:
"
f"Image of a dog playing water, and a waterfall is in the background."
# generated: tuple of (generated response, list of generated images)
generated = inference_solver.generate(
images=[],
qas=[[q1, None]],
max_gen_len=8192,
temperature=1.0,
logits_processor=inference_solver.create_logits_processor(cfg=4.0, image_top_k=2000),
)
a1, new_image = generated[0], generated[1][0]
Citation
If you find this project useful for your research, please consider citing our papers:
@inproceedings{huang2024realcustom,
title={RealCustom: narrowing real text word for real-time open-domain text-to-image customization},
author={Huang, Mengqi and Mao, Zhendong and Liu, Mingcong and He, Qian and Zhang, Yongdong},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={7476--7485},
year={2024}
}
@article{mao2024realcustom++,
title={Realcustom++: Representing images as real-word for real-time customization},
author={Mao, Zhendong and Huang, Mengqi and Ding, Fei and Liu, Mingcong and He, Qian and Zhang, Yongdong},
journal={arXiv preprint arXiv:2408.09744},
year={2024}
}
- Downloads last month
- -