Skip to content
imaged

Background removal

BiRefNet general (512 fp16)

Higher-fidelity background removal with sharper edges than U-2-Net.

MIT
Explore model

About this model

BiRefNet is a dichotomous segmentation model from ZhengPeng7. The build is the fp16 512x512 export, around 940 MB on disk. Edges around hair and fine structures are noticeably sharper than U-2-Net at the cost of size and latency.

On M1 Max CPU, a 256x256 input warms to 2.4 seconds. CoreML compilation fails on the deformable ASPP module, so this runs on CPU.

What you can build

  • Cut hairlines and fine details for high-end product photography.
  • Generate alpha mattes for film-style compositing offline.
  • Mask portraits where U-2-Net leaves visible halos.
  • Run a one-time, high-quality cutout pass on archival images.

Variants & downloads

Choose the build for your app

Model files are being prepared.

Explore the model’s examples, source links, and integration notes while download variants are added.

Example inference

Input
A 256x256 butterfly fixture from the legacy test suite.
Output
The butterfly fixture cut out with a transparent background.

Performance

Results depend on the device, runtime, and test conditions. Each measurement keeps its own context.

M1 Max, macOS 15, ONNX Runtime 1.17

See original catalog hardware notes · CPU

2.43 s

Warm inference

Catalog reference · variant unspecifiedCold start (ms): 2444.82

Reference result from the existing catalog; conversion variant and measurement date were not recorded.

RTX 2060, Ubuntu 24.04, ONNX Runtime 1.24.3

See original catalog hardware notes · CUDA

440.2 ms

Warm inference

Catalog reference · variant unspecified

Reference result from the existing catalog; conversion variant and measurement date were not recorded.

Integration examples

Vision SDK integration

cpp

#include "imaged/sdk.hpp"
#include "imaged/families/background_removal/background_removal_family.hpp"

imaged::SDK::AI ai;
auto& config = ai.getOptions();
config.set("background_removal.model", "weights/BiRefNet-general-512x512.onnx");

imaged::SDK::BackgroundRemovalFamily family;
family.load(config);

imaged::SDK::Image image;
image.load("subject.jpg");

auto result = family.run(&image);
auto& cutout = std::get<imaged::SDK::ImageResult>(result).image;
cutout.save("subject_alpha.png");