Advanced XSeg Annotation Tool

Professional segmentation annotation for DeepFaceLab with SAM integration, polygon tools, and real-time mask editing

Powerful Features

Brush & Polygon Tools

Precision painting with adjustable brush sizes and polygon drawing for complex shapes

SAM Integration

Segment Anything Model auto-masking for rapid annotation with AI assistance

Undo/Redo History

30-step history with Ctrl+Z/Y support for seamless workflow and error correction

Zoom & Pan

Smooth zooming with mouse wheel and right-drag panning for detailed work

Morphology Tools

Erode, dilate, and feather operations with adjustable kernel sizes

Dual Export

Save masks as PNG and export polygon annotations as LabelMe JSON format

Quick Setup

# Run the scaffold script
./scripts/scaffold_annotator.sh

# Install dependencies
pip install -r requirements-annotator.txt

# Optional: Install SAM dependencies
pip install torch torchvision
pip install git+https://github.com/facebookresearch/segment-anything.git

Directory Structure

  • extract_frames/ - Source images
  • masks/ - Output masks
  • annotations/ - JSON files
  • pyscripts/annotator/ - Python code

SAM Checkpoints

Download SAM model checkpoints:

Usage Guide

Basic Usage

# Start the annotator
./scripts/run_annotator.sh

# With SAM enabled
./scripts/run_annotator.sh --sam --sam-checkpoint /path/to/sam_vit_h.pth

# With auto-fill on load
./scripts/run_annotator.sh --sam --sam-checkpoint /path/to/sam_vit_h.pth --sam-autofill

Place your source images in the extract_frames directory before starting. The annotator will automatically detect them.

Custom Paths

# Custom directories
./scripts/run_annotator.sh \
    --frame-dir /path/to/your/frames \
    --mask-dir /path/to/your/masks \
    --ann-dir /path/to/your/annotations

Keyboard Shortcuts

Navigation & Tools

Next frame n
Previous frame b
Toggle polygon mode p
Commit polygon c
Brush size + ]
Brush size - [

Operations & Actions

Save mask s
Clear mask x
Toggle overlay m
SAM auto-mask a
Undo u
Redo y

Ready to Get Started?

Start annotating your face segmentation masks with professional tools and AI assistance