Fashion Inpainting System

🎨 Advanced AI-powered fashion transformation system that preserves body pose and facial identity while generating new clothing styles.

License Python Hugging Face

πŸš€ 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

  1. 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
  2. Hand Exclusion Logic

    • Prevents generation of extra hands/limbs
    • Conservative mask erosion with exclusion zones
    • Optimized for natural results
  3. Safety-Aware Generation

    • Content filtering for appropriate results
    • Coverage analysis for generation scope
    • Adaptive prompting based on input analysis
  4. 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" Alt text
Casual wear "Business suit" Alt text
Casual wear "Business Costume" Alt text

🏒 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:

πŸ“„ 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


Made with ❀️ for the AI and Fashion communities

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for mlworks90/fashion-inpainting-system

Adapter
(2627)
this model