Skip to content

trongkhanh083/virtual-try-on-ring

Repository files navigation

💍 Virtual Ring Try-On

An AI-powered Virtual Ring Try-On system that lets users visualize how a ring looks on their hand. The pipeline combines computer vision and generative AI techniques:

Mediapipe Hand Detection – detect and localize hand.

Segment Anything (SAM) – isolate the ring region.

Traditional Compositing – place the ring onto bare hand templates.

Stable Diffusion 1.5 + ControlNet (Inpainting) – refine compositing with realistic shadows, reflections, and lighting.

Real-ESRGAN – upscale the final output for sharp, high-quality results.

✨ Features

  • Upload a hand wearing a ring → the system extracts the ring and transfers it to a bare hand.
  • Users can upload their own bare hand for try-on.
  • Outputs high-resolution, photo-realistic results thanks to ESRGAN enhancement.
  • Gradio-powered interactive web UI.

🖼️ Demo

🚀 Installation

Clone this repo:

git clone https://github.com/trongkhanh083/virtual-try-on-ring.git
cd virtual-try-on-ring

Create a conda or venv environment:

conda create -n ringvton python=3.10 -y
conda activate ringvton

Install dependencies:

pip install -r requirements.txt

Download Real-ESRGAN checkpoint

git clone https://github.com/xinntao/Real-ESRGAN.git
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P Real-ESRGAN/weights

⚙️ Usage

Run the Gradio app

python app.py

🖥️ Hardware Requirements

GPU strongly recommended

At least 8GB VRAM for Stable Diffusion + Controlnet.

Releases

No releases published

Packages

No packages published

Languages