Skip to main content

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:

πŸŽ“ 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!

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


Ready to get started? Head over to the Installation Guide!