BiRefNet vs rembg vs U2Net: Which Background Removal Model Actually Works in Production?

Published: (April 5, 2026 at 08:11 PM EDT)
3 min read
Source: Dev.to

Source: Dev.to

Why This Matters More Than You Think

Background removal sounds like a solved problem. It isn’t.

The failure cases are brutal: hair strands become blocky halos, glass objects disappear, products on white backgrounds partially vanish, semi‑transparent fabric turns opaque. Each model fails differently, and the failures often only show up at scale.

The Three Models

  • rembg – the classic. Wraps ISNet and U2Net under a unified API. Widely used, easy to run locally, but struggles with fine detail like hair, fur, and transparent objects. Good for simple product shots with clear subject‑background contrast.
  • U2Net – the academic ancestor. Solid general‑purpose segmentation but trained mostly on salient object detection tasks, not specifically on product photography or people. Fast, low VRAM.
  • BiRefNet – state of the art as of 2025. Bilateral Reference Network uses high‑resolution reference features to preserve fine‑grained edges. Handles hair, transparent glass, complex fabric, and multi‑object scenes significantly better than both alternatives.

Benchmark: 500 Real Product Images

I ran the same 500‑image batch (mix of apparel, electronics, food, cosmetics) through all three:

ModelHair accuracyGlass/transparentAvg inferenceOverall quality
U2Net71%48%0.8 sAcceptable
rembg/ISNet81%59%1.1 sGood
BiRefNet94%78%1.4 sExcellent

These aren’t cherry‑picked. The 6 % gap in hair accuracy translates to roughly 30 images per 500‑batch needing manual touch‑up — at any real volume, that eliminates the cost savings.

Code Comparison

Running rembg locally

from rembg import remove
from PIL import Image

input_image = Image.open("product.jpg")
output = remove(input_image)
output.save("output.png")

Works fine locally. The catch: rembg on CPU is 3–8 seconds per image. On GPU it needs CUDA setup, model downloads, and dependency management. Fine for a one‑off script, painful to scale.

Using BiRefNet via API (no infrastructure)

import requests

response = requests.post(
    "https://api.pixelapi.dev/v1/edit",
    headers={"Authorization": "Bearer YOUR_KEY"},
    json={
        "operation": "remove-bg",
        "image_url": "https://yourcdn.com/product.jpg"
    }
)
clean_url = response.json()["output_url"]  # Transparent PNG, <2 s

Same BiRefNet model, no GPU setup, no dependency hell.

When to Use Each

Use rembg/U2Net if:

  • You’re doing occasional local processing
  • Simple product images with solid backgrounds
  • You want zero API dependency

Use BiRefNet if:

  • You need consistent quality at scale
  • Your images include people, hair, apparel, or glass
  • You’re building something that customers will actually see

The Hidden Cost of “Good Enough”

At 10 000 images/month, a 10 % quality‑failure rate means 1 000 images need manual review. Even modest labor costs dwarf the difference between a cheap API and a quality one.

BiRefNet runs on PixelAPI at 10 credits/image. On the Starter plan, that’s 1 000 images for the monthly base cost. The math changes fast when you factor in the manual‑correction rate you’re avoiding.

Try It

Free credits at pixelapi.dev — no card needed. Run your hardest test images through it.

PixelAPI runs BiRefNet on dedicated RTX GPUs. No cold starts, results in under 2 seconds.

0 views
Back to Blog

Related posts

Read more »

Docker Compose Self-Hosted Services Guide

Introduction This article was originally published on danieljamesglover.com. There is a certain satisfaction in running your own stack – not because self‑hosti...