ONNX Model Zoo

withoutbg/snap

By withoutbg · ↓ 0 · ♥ 2 · Updated 2025-09-21

What's in this repo

This page lists the files in withoutbg/snap, including depth_anything_v2_vits_slim.onnx, snap_matting_0.1.0.onnx, snap_refiner_0.1.0.onnx.

  • 3 ONNX models (.onnx files)
  • 5 files, including 3 .onnx, 1 .md
  • Last updated 2025-09-21

ONNX files

File Size Download
depth_anything_v2_vits_slim.onnx — Download
snap_matting_0.1.0.onnx — Download
snap_refiner_0.1.0.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

WithoutBG Snap Models

Free, high-quality background removal models powered by AI

Apache 2.0 License ONNX Runtime

This repository contains the Snap tier models for the withoutbg library - a complete set of ONNX models for local, free background removal processing.

📋 Model Overview

The Snap tier implements a sophisticated 3-stage pipeline for background removal:

Model File Purpose Input Output License
Depth Estimation depth_anything_v2_vits_slim.onnx Stage 1: Depth map generation RGB (518×518) Inverse depth map Apache 2.0
Matting snap_matting_0.1.0.onnx Stage 2: Initial background separation RGBD (256×256) Alpha channel (A1) Apache 2.0
Refiner snap_refiner_0.1.0.onnx Stage 3: High-resolution refinement RGB+D+A (original size) Refined alpha (A2) Apache 2.0

🚀 Quick Start

Using the withoutbg library (Recommended)

pip install withoutbg
from withoutbg import remove_background

# Automatically downloads and uses these models
result = remove_background("image.jpg")
result.save("output.png")

🔄 Processing Pipeline

Stage 1: Depth Estimation

  • Model: Depth Anything V2 ViT-S (Apache 2.0 licensed)
  • Input: RGB image (518×518 pixels, ImageNet normalized)
  • Output: Inverse depth map (0-255 range)
  • Purpose: Provides spatial understanding for better background separation

Stage 2: Matting

  • Input: RGBD (RGB + depth concatenated as 4-channel input, 256×256)
  • Output: Initial alpha channel (A1)
  • Purpose: Performs initial foreground/background segmentation

Stage 3: Refining

  • Input: RGB + depth + A1 (5-channel input at original resolution)
  • Output: Refined alpha channel (A2) with high detail
  • Purpose: Enhances edge quality and removes artifacts

🔧 Technical Specifications

Model Details

  • Framework: ONNX (compatible with ONNX Runtime)
  • Providers: CPU, CUDA (automatically detected)
  • Precision: FP32
  • Total Size: ~140 MB (all three models)

Input Requirements

  • Format: RGB images (any resolution)
  • Preprocessing: Automatic resizing and normalization
  • Output: RGBA images with transparent background

🏗️ Integration Examples

Batch Processing

from withoutbg import remove_background_batch

results = remove_background_batch([
    "image1.jpg", 
    "image2.jpg", 
    "image3.jpg"
], output_dir="results/")

Custom Model Paths

from withoutbg.models import SnapModel

model = SnapModel(
    depth_model_path="custom/depth_model.onnx",
    matting_model_path="custom/matting_model.onnx", 
    refiner_model_path="custom/refiner_model.onnx"
)

result = model.remove_background("image.jpg")

📄 Licensing

Open Source Components

Snap Tier Components

  • snap_matting_0.1.0.onnx: Apache 2.0 License
  • snap_refiner_0.1.0.onnx: Apache 2.0 License
  • Free for commercial and non-commercial use
  • Open source models for the Snap tier

🔗 Related Links

🎯 Use Cases

  • Development & Prototyping: Free local processing
  • E-commerce: Product photo background removal
  • Social Media: Profile picture editing
  • Content Creation: Video thumbnails and graphics

🤝 Contributing

We welcome improvements to the open source components:

  1. Depth Anything V2 optimizations: Submit PRs to improve inference speed
  2. Preprocessing enhancements: Better image handling and normalization
  3. Documentation: Examples, tutorials, and integration guides
  4. Bug reports: Issues with model loading or inference

📧 Support


Try the models: Install pip install withoutbg and start removing backgrounds instantly!

Model info

onnx license:apache-2.0 region:us
↓ 0 ♥ 2

Created: 2025-08-15

Updated: 2025-09-21

View on Hugging Face

Files (5)

.gitattributes
README.md
depth_anything_v2_vits_slim.onnx ONNX
snap_matting_0.1.0.onnx ONNX
snap_refiner_0.1.0.onnx ONNX

Related models