Fashion Inpainting System
π¨ Advanced AI-powered fashion transformation system that preserves body pose and facial identity while generating new clothing styles.
π Key Features
- Pose Preservation: Advanced 25.3% pose coverage system maintains body structure and proportions
- Facial Identity Protection: Preserves original facial features and expressions
- Safety-First Design: Built-in content filtering and safety checks
- Multiple Checkpoint Support: Compatible with various Stable Diffusion checkpoints
- Production Ready: Comprehensive error handling and fallback systems
π― What This System Does
Input: Person wearing any outfit
Output: Same person in a completely different outfit while maintaining:
- β Exact facial identity
- β Original body pose and proportions
- β Natural fabric draping and fit
- β Appropriate content generation
π‘οΈ Safety & Ethical Use
β οΈ IMPORTANT USAGE RESTRICTIONS
This system is designed for creative and artistic purposes only. By using this software, you agree to:
β ALLOWED USES:
- Fashion design and visualization
- Creative artwork and artistic expression
- Educational and research purposes
- Personal style exploration
- Commercial fashion applications (with proper licensing)
β PROHIBITED USES:
- Creating deceptive or misleading content
- Non-consensual image manipulation
- Identity theft or impersonation
- Harassment or bullying
- Creation of inappropriate content
- Any illegal or harmful activities
π Built-in Safety Features
- Content Filtering: Automatic detection and prevention of inappropriate outputs
- Identity Preservation: System designed to change clothing only, not faces
- Pose Validation: Ensures generated content maintains appropriate poses
- Quality Thresholds: Filters out low-quality or distorted results
ποΈ System Architecture
Core Components
Pose Extraction System (25.3% coverage)
- OpenPose-based pose detection via controlnet_aux
- 5-channel pose vectors (Body, Hands, Face, Feet, Skeleton)
- Dilated regions for enhanced coverage
Hand Exclusion Logic
- Prevents generation of extra hands/limbs
- Conservative mask erosion with exclusion zones
- Optimized for natural results
Safety-Aware Generation
- Content filtering for appropriate results
- Coverage analysis for generation scope
- Adaptive prompting based on input analysis
Checkpoint Compatibility
- Supports custom Stable Diffusion models
- Automatic parameter optimization
- Fashion-specific model recommendations
π Requirements
Python 3.8+
torch>=1.13.0
diffusers>=0.21.0
transformers>=4.21.0
controlnet_aux>=0.4.0
opencv-python>=4.6.0
pillow>=9.0.0
numpy>=1.21.0
π Quick Start
Installation
# Clone the repository
git clone https://github.com/mlworks90/fashion-inpainting-system.git
cd fashion-inpainting-system
# Install dependencies
pip install -r requirements.txt
# Optional: Install with CUDA support
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118
Basic Usage
from fashion_safety_checker import create_fashion_safety_pipeline
pipeline = create_fashion_safety_pipeline()
# Transform outfit
result = pipeline.safe_fashion_transformation(
source_image_path="person_in_casual_wear.jpg",
checkpoint_path="fashion_checkpoint.safetensors",
outfit_prompt="elegant red evening dress",
output_path="person_in_evening_dress.jpg",
face_scale=0.90 # Manual face to body ratio adjustment
)
if result['success']:
print("β
Fashion transformation completed")
else:
print(f"Blocking reason: {result['blocking_reason']}")
print(f"User message: {result['user_message']}")
π Performance & Quality
- Pose Preservation: 25.3% coverage ensures accurate body structure
- Face Identity: >95% facial feature preservation
- Generation Speed: ~30-60 seconds per image (depending on hardware)
- Memory Usage: 8-12GB VRAM recommended
- Success Rate: >85% for well-posed input images
π§ Configuration
Safety Settings
pipeline = create_fashion_safety_pipeline(safety_mode="legacy_strict")
# legacy_strict - highest safety restrictions
# fashion_strict - conservative outfits only
# fashion_moderate - default level. Suitable for most garment types except some swimwear.
# fashion_permissive - most permissive mode. Be aware of inappropriate outputs possibility!
π§ͺ Examples
Fashion Transformations
Input | Target Prompt | Output |
---|---|---|
Casual wear | "elegant evening dress" | ![]() |
Casual wear | "Business suit" | ![]() |
Casual wear | "Business Costume" | ![]() |
π’ Commercial Use & Support
Open Source License
This project is licensed under Apache License 2.0, allowing:
- β Commercial use
- β Modification and distribution
- β Private use
- β Patent grant
Professional Services Available
For commercial deployments, we offer:
- Custom model training for specific fashion domains
- API integration and cloud deployment
- Performance optimization for production environments
- Priority support and SLA guarantees
- Custom safety filtering for brand-specific requirements
Contact: [email protected]
π Documentation
π€ Contributing
We welcome contributions! Please read our Contributing Guidelines and Code of Conduct.
Development Setup
# Clone repository
git clone https://github.com/mlworks90/fashion-inpainting-system.git
cd fashion-inpainting-system
# Install in development mode
pip install -e .
# Run tests
python -m pytest tests/
π Acknowledgments
This system builds upon excellent open-source projects:
- Stable Diffusion by CompVis
- ControlNet by lllyasviel
- Diffusers by Hugging Face
- controlnet_aux for OpenPose processing
π License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
βοΈ Legal & Safety Disclaimers
- Users are responsible for ensuring appropriate use and obtaining necessary consents
- This software is provided "as is" without warranty
- Not intended for creating deceptive or harmful content
- Users must comply with applicable laws and regulations
- Commercial users should review terms and consider professional support
π Support & Contact
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Commercial Inquiries: [email protected]
- Documentation: Project Wiki
Made with β€οΈ for the AI and Fashion communities
- Downloads last month
- -
Model tree for mlworks90/fashion-inpainting-system
Base model
runwayml/stable-diffusion-v1-5