PuLID for FLUX: Portrait-Guided Image Generation
This code implements PuLID (Pure and Lightning ID customization) for FLUX.1-dev, an advanced image generation system that allows users to create personalized images using ID (identity) images as guidance. The system combines the power of FLUX diffusion models with identity preservation capabilities.
Key Features
1. Identity-Guided Generation
- Upload an ID image (portrait photo) to guide the generation process
- Control identity strength with adjustable ID weight (0.0-3.0)
- Preserve facial features while applying various artistic styles
2. Advanced Configuration Options
- Resolution Control: Adjustable width (256-1536px) and height (256-1536px)
- Generation Steps: 1-20 steps for quality vs speed tradeoff
- Guidance Scale: Fine-tune adherence to prompts (1.0-10.0)
- Seed Control: Reproducible results with manual seed input
3. True CFG (Classifier-Free Guidance)
- Fake CFG mode (scale=1): Faster generation with basic guidance
- True CFG mode (scale>1): Enhanced quality with negative prompt support
- Configurable timestep for CFG activation
4. Technical Architecture
- Built on FLUX.1-dev diffusion model
- Utilizes T5 text encoder for prompt understanding
- CLIP model for image-text alignment
- Autoencoder for latent space operations
- GPU acceleration with CUDA support
How It Works
- Text Prompt Input: Describe the desired image style (e.g., "portrait, pixar")
- ID Image Upload: Provide a reference portrait for identity guidance
- Parameter Tuning: Adjust generation settings for optimal results
- Image Generation: The model creates an image matching the prompt while preserving the identity
Example Use Cases
- Transform portraits into different artistic styles (ice sculpture, pixar animation)
- Create personalized avatars maintaining facial identity
- Generate creative variations of portraits with text prompts
- Produce consistent character designs across different scenarios
The system leverages Gradio for an intuitive web interface, making advanced AI image generation accessible to users without technical expertise.
PuLID for FLUX: 인물 기반 이미지 생성 시스템
이 코드는 FLUX.1-dev를 위한 PuLID (Pure and Lightning ID customization) 시스템을 구현한 것으로, ID(신원) 이미지를 가이드로 사용하여 개인화된 이미지를 생성할 수 있는 고급 이미지 생성 시스템입니다. FLUX 확산 모델의 강력한 성능과 신원 보존 기능을 결합하였습니다.
주요 기능
1. 신원 기반 이미지 생성
- ID 이미지(인물 사진)를 업로드하여 생성 과정 가이드
- 조절 가능한 ID 가중치(0.0-3.0)로 신원 강도 제어
- 다양한 예술적 스타일을 적용하면서도 얼굴 특징 보존
2. 고급 설정 옵션
- 해상도 제어: 너비(256-1536px)와 높이(256-1536px) 조절 가능
- 생성 단계: 품질 대 속도 균형을 위한 1-20단계 설정
- 가이던스 스케일: 프롬프트 준수도 미세 조정(1.0-10.0)
- 시드 제어: 수동 시드 입력으로 재현 가능한 결과 생성
3. True CFG (Classifier-Free Guidance)
- Fake CFG 모드(scale=1): 기본 가이던스로 빠른 생성
- True CFG 모드(scale>1): 부정 프롬프트 지원으로 향상된 품질
- CFG 활성화 시점 설정 가능
4. 기술적 구조
- FLUX.1-dev 확산 모델 기반
- T5 텍스트 인코더로 프롬프트 이해
- CLIP 모델로 이미지-텍스트 정렬
- 잠재 공간 작업을 위한 오토인코더
- CUDA 지원 GPU 가속
작동 방식
- 텍스트 프롬프트 입력: 원하는 이미지 스타일 설명 (예: "portrait, pixar")
- ID 이미지 업로드: 신원 가이드를 위한 참조 인물 사진 제공
- 매개변수 조정: 최적의 결과를 위한 생성 설정 조절
- 이미지 생성: 모델이 신원을 보존하면서 프롬프트에 맞는 이미지 생성
활용 예시
- 인물 사진을 다양한 예술 스타일로 변환 (얼음 조각, 픽사 애니메이션)
- 얼굴 신원을 유지한 개인화된 아바타 생성
- 텍스트 프롬프트로 인물의 창의적인 변형 생성
- 다양한 시나리오에서 일관된 캐릭터 디자인 제작
이 시스템은 Gradio를 활용한 직관적인 웹 인터페이스를 제공하여, 기술적 전문 지식이 없는 사용자도 고급 AI 이미지 생성 기능을 쉽게 이용할 수 있습니다.