Welcome to OpenTryOn
OpenTryOn is an open-source AI toolkit designed for fashion technology and virtual try-on applications. This project provides a comprehensive suite of tools for garment segmentation, human parsing, pose estimation, and virtual try-on using state-of-the-art diffusion models.
π― What is OpenTryOn?β
OpenTryOn is a powerful Python library that democratizes fashion technology by providing:
- Preprocessing Utilities: Garment segmentation, human parsing, and pose estimation
- TryOnDiffusion Implementation: Dual UNet architecture for virtual try-on
- Easy-to-Use APIs: Simple interfaces that abstract away complexity
- Production-Ready Code: Comprehensive documentation and examples
- Open Source: Free for non-commercial use
π Key Featuresβ
Virtual Try-Onβ
Advanced diffusion-based virtual try-on capabilities using TryOnDiffusion with dual UNet architecture. Also includes API adapters for cloud-based virtual try-on services like Segmind.
Datasets Moduleβ
Easy-to-use interfaces for fashion and virtual try-on datasets:
- Fashion-MNIST: 60,000 training examples with 10 fashion categories
- VITON-HD: High-resolution virtual try-on dataset with 11,647 training pairs
- Subjects200K: Large-scale dataset with 200,000 paired images for subject consistency research
- Lazy Loading: Efficient PyTorch DataLoader support for large datasets
- Automatic Download: Built-in download functionality and HuggingFace integration
API Adaptersβ
Cloud-based virtual try-on and image generation APIs:
- Segmind: Try-On Diffusion API for realistic virtual try-on generation
- Kling AI: Virtual try-on with asynchronous processing
- Amazon Nova Canvas: AWS-based virtual try-on service
- Nano Banana: Google Gemini image generation (fast, efficient, 1024px)
- Nano Banana Pro: Google Gemini advanced image generation (up to 4K, search grounding)
Garment Preprocessingβ
- Garment Segmentation: U2Net-based segmentation for upper, lower, and dress categories
- Garment Extraction: Extract and preprocess garments for virtual try-on
- Human Segmentation: Isolate human subjects from images
Pose Estimationβ
OpenPose-based pose keypoint extraction for both garments and humans, enabling accurate virtual try-on.
Outfit Generationβ
FLUX.1-dev LoRA-based outfit generation from text descriptions.
Interactive Demosβ
Gradio-based web interfaces for easy experimentation and testing.
π What You'll Learnβ
In this documentation, you'll find:
- Installation Guide: Get OpenTryOn up and running
- Quick Start: Start using OpenTryOn in minutes
- Datasets Module: Load and use Fashion-MNIST, VITON-HD, and Subjects200K datasets
- API Reference: Complete API documentation including Segmind and other adapters
- Examples: Real-world usage examples for datasets and virtual try-on
- Advanced Guides: Deep dive into training and customization
π Prerequisitesβ
Before you begin, you should have:
- Python 3.10 or higher
- Basic knowledge of Python programming
- Familiarity with computer vision concepts (helpful but not required)
- CUDA-capable GPU (recommended for best performance)
π‘ Quick Examplesβ
Here are some simple examples to get you started:
Virtual Try-On with Segmindβ
from dotenv import load_dotenv
load_dotenv()
from tryon.api import SegmindVTONAdapter
# Initialize adapter
adapter = SegmindVTONAdapter()
# Generate virtual try-on
images = adapter.generate_and_decode(
model_image="person.jpg",
cloth_image="shirt.jpg",
category="Upper body"
)
# Save result
images[0].save("result.png")
Using Fashion-MNIST Datasetβ
from tryon.datasets import FashionMNIST
# Create dataset instance (downloads automatically)
dataset = FashionMNIST(download=True)
# Load the dataset
(train_images, train_labels), (test_images, test_labels) = dataset.load(
normalize=True,
flatten=False
)
print(f"Training set: {train_images.shape}") # (60000, 28, 28)
print(f"Class 0: {dataset.get_class_name(0)}") # 'T-shirt/top'
Garment Preprocessingβ
from dotenv import load_dotenv
load_dotenv()
from tryon.preprocessing import segment_garment, extract_garment
# Segment garment
segment_garment(
inputs_dir="data/original_cloth",
outputs_dir="data/garment_segmented",
cls="upper"
)
# Extract garment
extract_garment(
inputs_dir="data/original_cloth",
outputs_dir="data/cloth",
cls="upper",
resize_to_width=400
)
π€ Get Involvedβ
OpenTryOn is an open-source project, and we welcome contributions!
- GitHub: github.com/tryonlabs/opentryon
- Discord: Join our community
- Contributing: See our Contributing Guide
π Licenseβ
All material is made available under Creative Commons BY-NC 4.0. You can use the material for non-commercial purposes, as long as you give appropriate credit and indicate any changes.
πΊοΈ Roadmapβ
Check out our Roadmap to see what's coming next!
π Need Help?β
- Check our Troubleshooting Guide
- Join our Discord community
- Open an issue on GitHub
Ready to get started? Head over to the Installation Guide!