Professional Mask Generation for DIC & ROI Analysis
Transform Meta's Segment Anything Model 2 into a powerful desktop tool. From annotation to segmentation to post-processing — complete workflow with zero code.
Everything you need for professional mask generation, built into a single desktop application.
Point-based foreground/background marking with full undo/redo history. Toggle modes with a single keystroke.
Fix inaccurate masks on any frame and auto-propagate changes forward. No need to reprocess the entire sequence.
Tone adjustment, smoothing, binarization, morphology, and anisotropic diffusion — with 7 built-in presets including DIC Microscopy.
Perona-Malik spatial smoothing and 3D Gaussian temporal smoothing with smart chaining and live mask comparison.
CUDA auto-detection for NVIDIA GPUs delivers ~100x speedup over CPU processing. Real-time VRAM monitoring in status bar.
Save complete workspaces as .s2proj files. Batch processing support. Export masks as TIFF/PNG and contours as PNG/SVG.
Watch the complete workflow — from interactive annotation to SAM2 mask propagation across all frames.
Five simple steps from raw images to publication-ready masks.
Select input image folder and output directory
Place foreground & background points on the first frame
SAM2 propagates masks across all frames automatically
Browse results and fix masks on any frame if needed
Apply post-processing and export final masks
Up and running in under 5 minutes.
Check your NVIDIA driver version with nvidia-smi, then install the matching PyTorch:
# CUDA 12.8 (driver >= 570)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu128
# CPU only (no GPU)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
git clone https://github.com/zachtong/DIC-ROI-mask-generator.git
cd DIC-ROI-mask-generator
pip install -r requirements.txt
Download model weights from facebookresearch/sam2 and place in checkpoints/:
checkpoints/
├── sam2.1_hiera_large.pt # Best quality (~900 MB)
├── sam2.1_hiera_base_plus.pt # Balanced
├── sam2.1_hiera_small.pt # Faster
└── sam2.1_hiera_tiny.pt # Fastest (~150 MB)
You only need one checkpoint to get started. hiera_large for best quality, hiera_tiny for quick tests.
python main.py
If you use DIC Mask Generator in your research, please cite our paper.
@article{leu2026machine,
title = {Machine Learning-Aided Spatial Adaptation for Improved
Digital Image Correlation Analysis of Complex Geometries},
author = {Leu, Jeffrey and Tong, Zixiang and Doty, Andrew and
Tsimpoukis, Solon and Deng, Bolei and Yang, Jin},
journal = {Strain},
volume = {62},
number = {1},
pages = {e70022},
year = {2026},
publisher = {Wiley Online Library}
}