An AI-powered virtual try-on application that allows users to visualize how clothing items would look on them using advanced diffusion models.
- AI-Powered Try-On: Uses Stable Diffusion and Dreambooth models to generate realistic clothing overlays
- Web Application: User-friendly Next.js interface for uploading selfies and outfit images
- Chrome Extension: Browser extension to capture clothing images from e-commerce websites
- Email Notifications: Receive results via email after processing
- Image Processing Pipeline: Automated image captioning, cropping, and augmentation
- RESTful API: Django-based backend with API endpoints for seamless integration
The project consists of four main components:
virtual-try-on-team/
βββ frontend/ # Next.js web application
βββ backend/ # Django REST API
βββ chrome-plugin/ # Chrome extension
βββ diffusion/ # Diffusion model training scripts
βββ diffusion_improved/ # Enhanced diffusion implementation
βββ diffusion_optimization/ # Performance optimization techniques
- Framework: Next.js 14
- Language: TypeScript
- Styling: Tailwind CSS
- HTTP Client: Axios
- UI: React 18
- Framework: Django 4.1
- API: Django Ninja
- Database: SQLite (development)
- Storage: Local file storage (configurable for AWS S3)
- CORS: django-cors-headers
- Model: Stable Diffusion with Dreambooth fine-tuning
- Image Processing: BLIP captioning
- Framework: PyTorch
- Optimization: Mixed precision training, gradient checkpointing
- Manifest Version: 3
- Permissions: Storage, Active Tab, Scripting
- Node.js (v18 or higher)
- Python (v3.8 or higher)
- pip and virtualenv
- Chrome Browser (for extension testing)
- CUDA-capable GPU (recommended for diffusion model training)
git clone https://github.com/jeesunikim/virtual-try-on-team.git
cd virtual-try-on-teamcd frontend
npm install
cp .env.example .env.local # Configure environment variables
npm run devThe frontend will be available at http://localhost:3000
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Create .env file with required variables
cat > .env << EOF
SECRET_KEY=your-secret-key-here
DEBUG=True
EOF
# Run migrations
python manage.py makemigrations
python manage.py migrate
# Create superuser (optional)
python manage.py createsuperuser
# Start the development server
python manage.py runserverThe backend API will be available at http://127.0.0.1:8000
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" in the top right
- Click "Load unpacked"
- Select the
chrome-plugindirectory from the project - The GetDressed extension will now appear in your browser
cd diffusion
# Install dependencies
pip install diffusers transformers accelerate torch torchvision
# Run training scripts (adjust paths as needed)
bash identity_run.sh # Train identity model
bash clothes_run.sh # Train clothing overlay model
bash transforms.sh # Process and augment images- Navigate to
http://localhost:3000 - Upload a body image (clear photo of yourself)
- Upload an outfit/clothing item image
- Enter your email address
- Submit and wait for processing
- Receive results via email or in the interface
POST /api/try_on_outfit/{email}
Content-Type: multipart/form-data
Parameters:
- email: User's email address
- selfie: Image file (user's photo)
- outfit: Image file (clothing item)
Response:
{
"message": "This is what it looks like"
}- User Input: Upload 12 pictures of yourself for personalized model training
- Dreambooth Training: Fine-tune a Stable Diffusion model on your images
- Mask Generation: Create or generate masks defining where clothing appears
- Inpainting: Apply clothing overlay using the trained diffusion model
- Refinement: Iteratively improve output through the denoising process
- Training steps: 1000
- Learning rate: 5e-6
- Sampling: DDIM (fewer steps, faster inference)
- Precision: Mixed FP16/FP32 for optimal performance
- BLIP Captioning: Automatic image description generation
- Crop & Augment: Preprocessing for consistent input dimensions
- Mask Application: Guide model for realistic clothing placement
The project implements several optimization techniques:
- Mixed Precision Training: Using PyTorch AMP for faster computation
- Gradient Checkpointing: Reduced memory usage for larger batches
- Efficient Sampling: DDIM and PFGM for fewer diffusion steps
- Flash Attention: Memory-efficient attention mechanisms
- Dynamic Batching: Minimized GPU idle time
virtual-try-on-team/
βββ frontend/
β βββ app/ # Next.js app directory
β βββ src/
β β βββ components/ # React components
β β βββ helpers/ # Utility functions
β βββ public/ # Static assets
β βββ package.json
βββ backend/
β βββ django_project/ # Django settings
β βββ try_on/ # Main app
β β βββ api.py # API endpoints
β β βββ models.py # Database models
β β βββ schemas.py # Request/response schemas
β βββ emails/ # Email functionality
β βββ media/ # Uploaded files
β βββ manage.py
βββ chrome-plugin/
β βββ manifest.json # Extension configuration
β βββ popup/ # Extension UI
β βββ content-script.js # Page interaction
β βββ background.js # Background processes
βββ diffusion/
β βββ captioning/ # BLIP image captioning
β βββ transforms/ # Image preprocessing
β βββ clothes_run.sh # Clothing model training
β βββ identity_run.sh # Identity model training
βββ diffusion_improved/ # Enhanced model implementation
βββ diffusion_optimization/ # Performance improvements
- Email (unique identifier)
- Extended from Django's AbstractUser
- User (foreign key)
- Selfie image
- Outfit image
- Timestamps
SECRET_KEY=your-django-secret-key
DEBUG=True
# Optional AWS S3 configuration
# AWS_ACCESS_KEY_ID=your-aws-access-key
# AWS_SECRET_ACCESS_KEY=your-aws-secret-key
# AWS_STORAGE_BUCKET_NAME=your-bucket-nameNEXT_PUBLIC_API_URL=http://127.0.0.1:8000- Stable Diffusion Inpainting
- Cloth Virtual Try-On
- Diffusers with TorchAO
- Next.js Documentation
- Django Ninja Documentation
- ML model integration is partially implemented (placeholder functions)
- Email notification system needs configuration
- AWS S3 storage is commented out (local storage used by default)
- Training requires significant computational resources