Imagine is a context-aware image generation system built using Stable Diffusion and DreamBooth. It focuses on personalized and realistic image synthesis by learning a specific subject and generating it across diverse environments while preserving identity and semantic consistency.
The system is developed in Python using Hugging Face Diffusers and PyTorch. It fine-tunes the pre-trained CompVis/stable-diffusion-v1-4 model on a custom instance dataset (diffusers/dog-example) along with class images generated for prior preservation. This enables high-quality subject-aware and context-driven image generation.
- Personalized subject learning using DreamBooth
- Context-based environment adaptation
- Identity preservation across scenes
- High-quality realistic synthesis
- Memory-efficient training on limited GPUs
- Hugging Face integration
- Python
- PyTorch
- Stable Diffusion
- Hugging Face Diffusers
- DreamBooth
- Transformers
- Accelerate
- xFormers
- BitsAndBytes
- CUDA
- NVIDIA GPU with CUDA support (minimum 8 GB VRAM, 12 GB+ recommended)
- CUDA Toolkit 11.7 or newer
- Compatible NVIDIA Driver
- Minimum 16 GB system RAM (32 GB recommended for training)
- At least 20 GB free disk space for models and datasets
- Tested on Linux and Google Colab (limited support on Windows WSL)
Note: CPU-only execution is not recommended due to high computational requirements.
- Instance Dataset:
diffusers/dog-example(Hugging Face) - Class Dataset: Auto-generated (prior preservation)
- Base Model:
CompVis/stable-diffusion-v1-4 - Fine-Tuning Method: DreamBooth
git clone https://github.com/krharitej/Imagine.git
cd ImagineTraining (Optional – For Custom Subjects)
accelerate launch Imagine.py- Ensure dataset paths are correctly configured before training
Inference / Image Generation
python Imagine.pyOr run using Jupyter:
jupyter notebook Imagine.ipynbInput Images + Prompts → DreamBooth Fine-Tuning → Custom Model → Context-Aware Image Output
K R Haritej
This project is intended for educational and research purposes.
Please refer to the respective licenses of Stable Diffusion and DreamBooth.












