skip to content
gigarouter gigarouter
models / image segmentation · coming soon

BiRefNet Portrait

ZhengPeng7/BiRefNet-portrait

published May 2024 · updated Feb 2026

BiRefNet Portrait is a segmentation model for high-resolution portrait matting and background removal.

est. price
~$0.094
/ 1k images · estimated, set at launch
API providers
0
downloads / mo
19.7K

specs

TaskPortrait Matting / Dichotomous Image Segmentation
ArchitectureBilateral Reference Network (BiRefNet)
LicenseMIT

about this model

ZhengPeng7/BiRefNet-portrait is a segmentation model for high-resolution dichotomous image segmentation, specifically fine-tuned for portrait matting. It uses a bilateral reference mechanism to capture both global object location and fine boundary details.

Architecture and training

The model consists of a Localization Module (LM) for global object localization and a Reconstruction Module (RM) that applies bilateral reference (BiRef) using hierarchical image patches as source reference and gradient maps as target reference. Auxiliary gradient supervision sharpens the model’s focus on fine edges. The architecture is based on Swin Transformer with attention implemented via PyTorch SDPA (since September 2025), reducing memory cost and enabling acceleration.

Training and validation data

  • Training sets: P3M-10k (excluding TE-P3M-500-P) and TR-humans.
  • Validation set: TE-P3M-500-P.

Benchmark performance

DatasetMethodSmeasuremaxFmmeanEmMAEmaxEmmeanFmwFmeasureadpEmadpFmHCE
TE-P3M-500-PBiRefNet-portrait (epoch 150).983.996.991.006.997.988.990.933.965.000

Additional details

  • Published in CAAI Artificial Intelligence Research (2024, volume 3, page 9150038, DOI 10.26599/AIR.2024.9150038).
  • Licensed under MIT.
  • Supports tasks including image segmentation, background removal, mask generation, dichotomous image segmentation, camouflaged object detection, and salient object detection.
  • Performance optimization (June 2025): refine_foreground accelerated by 8×, reaching ~80ms on RTX 5090 via GPU implementation of fast-fg-est.

The model validates on multiple segmentation benchmarks and outperforms prior task-specific state-of-the-art methods across dichotomous image segmentation, camouflaged object detection, and salient object detection tasks.

best for

FAQ

What is the input and output format?

Input is a high-resolution image; output is a binary segmentation mask indicating the portrait region.

What license is the model released under?

MIT license.

How accurate is the model on portrait matting benchmarks?

On TE-P3M-500-P, it achieves Smeasure 0.983, maxFm 0.996, and MAE 0.006.

How can I use this model via the gigarouter API?

Use the gigarouter OpenAI-compatible endpoint with your API key, passing an image URL or base64-encoded image.

not yet live

We're benchmarking and onboarding BiRefNet Portrait as a hosted, OpenAI-compatible API. Sign in for free credit and be ready when it lands, or tell us you want it and we'll prioritize it.

related image segmentation models

compare all →