Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Measure background removal accuracy with iou and mae 2027
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Measure background removal accuracy with IoU and MAE (2027)

Source: Bria AI•December 4, 2026 at 12:12 AM

Measure background removal accuracy with IoU and MAE (2027)

Updated 2026-12-01 TL;DR Short answer: measure background removal accuracy by comparing each model's alpha matte to a hand-made mask with four numbers: IoU, MAE, F-measure and boundary IoU. Why four: each catches a different error. IoU and F-measure judge the overall shape, MAE judges soft…

Updated 2026-12-01

TL;DR

  • Short answer: measure background removal accuracy by comparing each model's alpha matte to a hand-made mask with four numbers: IoU, MAE, F-measure and boundary IoU.

Short answer: measure background removal accuracy by comparing each model's alpha matte to a hand-made mask with four numbers: IoU, MAE, F-measure and boundary IoU.

  • Why four: each catches a different error. IoU and F-measure judge the overall shape, MAE judges soft edges, and boundary IoU judges the outline.

Why four: each catches a different error. IoU and F-measure judge the overall shape, MAE judges soft edges, and boundary IoU judges the outline.

  • Tested example: on a 256 by 256 circle shifted 6 px, IoU stayed at 0.9092 while boundary IoU fell to 0.1532.

Tested example: on a 256 by 256 circle shifted 6 px, IoU stayed at 0.9092 while boundary IoU fell to 0.1532.

  • Public metrics: the DIS5K paper uses maxF, weighted F, MAE, S-measure, E-measure and HCE.

Public metrics: the DIS5K paper uses maxF, weighted F, MAE, S-measure, E-measure and HCE.

  • Reference result: RMBG 3.0 ranked first of 6 in Bria's benchmark across 234 hard images. Use the script below to test it on yours.

Reference result: ranked first of 6 in Bria's benchmark across 234 hard images. Use the script below to test it on yours.

How do you measure background removal accuracy?

Compare each model's alpha matte to a ground truth mask you made by hand, using the same images for every model.

Bria wrote this guide. The script and numbers below come from a test run on 2026-12-02 and are not a Bria or competitor benchmark. Label 20 of your hardest images by hand, save one cutout per model at default settings, and score each. For how published scores are built, see the DIS5K paper.

Which metrics should you use?

Use IoU, MAE, F-measure and boundary IoU, because each fails to see what another catches.

  • Metric: IoU at 0.5; Measures: Overlap of the hard masks; Better is: Higher; Catches: Missing or extra regions

Metric: IoU at 0.5; Measures: Overlap of the hard masks; Better is: Higher; Catches: Missing or extra regions

  • Metric: MAE; Measures: Mean absolute alpha error; Better is: Lower; Catches: Soft edge and hair errors

Metric: MAE; Measures: Mean absolute alpha error; Better is: Lower; Catches: Soft edge and hair errors

  • Metric: F-measure; Measures: Precision and recall at a fixed 0.5 threshold, beta squared 0.3; Better is: Higher; Catches: Over or under cutting

Metric: F-measure; Measures: Precision and recall at a fixed 0.5 threshold, beta squared 0.3; Better is: Higher; Catches: Over or under cutting

  • Metric: Boundary IoU; Measures: Overlap of a 5 px band at the outline; Better is: Higher; Catches: Shifted or ragged edges

Metric: Boundary IoU; Measures: Overlap of a 5 px band at the outline; Better is: Higher; Catches: Shifted or ragged edges

What is the code?

Four short numpy functions score a prediction against a ground truth, both as float arrays from 0 to 1.

Load a matte with Pillow: take the A channel of an RGBA cutout and divide by 255. Resize the prediction to the ground truth size first. The F-measure here is computed at a fixed 0.5 threshold, while the papers report maxF over thresholds. border_value=1 stops a cutout that touches the image edge from getting a false band along the frame. The erosion call is documented in SciPy.

What do the numbers look like on a test case?

A 6 px shift barely moves IoU but collapses boundary IoU.

The script was run on 2026-12-02 against a 256 by 256 circle of radius 80 centered at (128, 128), a copy shifted 6 px along x, and a copy softened with a Gaussian filter of sigma 3. Add this harness under the four functions to reproduce the table:

  • Prediction: Perfect copy; IoU: 1.0000; MAE: 0.0000; F-measure: 1.0000; Boundary IoU: 1.0000

Prediction: Perfect copy; IoU: 1.0000; MAE: 0.0000; F-measure: 1.0000; Boundary IoU: 1.0000

  • Prediction: Shifted 6 px; IoU: 0.9092; MAE: 0.0291; F-measure: 0.9525; Boundary IoU: 0.1532

Prediction: Shifted 6 px; IoU: 0.9092; MAE: 0.0291; F-measure: 0.9525; Boundary IoU: 0.1532

  • Prediction: Softened edge; IoU: 1.0000; MAE: 0.0183; F-measure: 1.0000; Boundary IoU: 1.0000

Prediction: Softened edge; IoU: 1.0000; MAE: 0.0183; F-measure: 1.0000; Boundary IoU: 1.0000

A shifted outline still scores 0.91 on IoU, so a single overlap number hides edge errors. The softened copy shows the opposite: hard metrics ignore it, and only MAE sees it.

How do the metrics relate to the DIS5K numbers?

The DIS5K tables report maxF, weighted F, MAE, S-measure, E-measure and HCE, which add structure and effort to the overlap metrics here.

In the BiRefNet paper, BiRefNet scores a maxF of .896 and an MAE of .035 on the 2,000 DIS-TE images. HCE, from the DIS5K authors, estimates the mouse clicks needed to fix a mask. It suits teams that correct cutouts by hand.

How many images do you need?

Use at least 20 hard images and report per image scores, because Bria's own categories hold only 7 to 10 images.

The RMBG 3.0 card states 7 to 10 images per category, so a single image can move a row. Keep one output per image, run defaults, and list the failures, since Bria ranked a missing output last.

What mistakes break an accuracy test?

Most bad tests fail on setup, not on the metric, so fix the setup first.

  • Different sizes: resize the prediction to the ground truth size before scoring, or every edge metric shifts.

Different sizes: resize the prediction to the ground truth size before scoring, or every edge metric shifts.

  • Mixed settings: run every model at default settings, with one output per image, as Bria's benchmark did.

Mixed settings: run every model at default settings, with one output per image, as Bria's benchmark did.

  • Tuned thresholds: keep 0.5 for every model, or one model gets a threshold the others never had.

Tuned thresholds: keep 0.5 for every model, or one model gets a threshold the others never had.

  • Hidden failures: score a missing output as the worst result, not as a skipped image.

Hidden failures: score a missing output as the worst result, not as a skipped image.

  • Training overlap: do not label images that a model was trained on if you can avoid it, because the score will look better than real use.

Training overlap: do not label images that a model was trained on if you can avoid it, because the score will look better than real use.

Averages hide failures, so keep the per image table and sort it by the lowest boundary IoU.

What should you do with the result?

Rank models on the metric that matches your failure, then confirm by eye on the worst five images.

  • Pick MAE and boundary IoU if edges and hair matter.

Pick MAE and boundary IoU if edges and hair matter.

  • Pick IoU and F-measure if shape and missing regions matter.

Pick IoU and F-measure if shape and missing regions matter.

  • Check the 5 worst images for each model by eye.

Check the 5 worst images for each model by eye.

For model choice, see the list of most accurate segmentation models and SAM 2 vs BiRefNet vs RMBG 3.0.

← All articles

What this article says

More in AI & Machine Learning

All →
Healthcare voice agents: how to build one with a signed BAA
AssemblyAI

Healthcare voice agents: how to build one with a signed BAA

Best speech-to-text API for AI medical ambient scribes (2026)
AssemblyAI

Best speech-to-text API for AI medical ambient scribes (2026)

The voice agent launch runbook: ramp, rollback, and on-call
AssemblyAI

The voice agent launch runbook: ramp, rollback, and on-call

What is AI sentiment analysis? How it works, types, and use cases
ElevenLabs

What is AI sentiment analysis? How it works, types, and use cases

Hugging Face background removal output formats (2027)
Bria AI

Hugging Face background removal output formats (2027)

SAM 2 vs BiRefNet vs RMBG 3.0: background removal (2027)
Bria AI

SAM 2 vs BiRefNet vs RMBG 3.0: background removal (2027)

More from Bria AI

Hugging Face background removal output formats (2027)
Bria AI

Hugging Face background removal output formats (2027)

SAM 2 vs BiRefNet vs RMBG 3.0: background removal (2027)
Bria AI

SAM 2 vs BiRefNet vs RMBG 3.0: background removal (2027)

5 best Hugging Face background removal models for production 2027
Bria AI

5 best Hugging Face background removal models for production 2027

Bria vs Pixelcut: commercial use and licensing (2027)
Bria AI

Bria vs Pixelcut: commercial use and licensing (2027)

Bria vs Pixelcut free web tools: limits compared (2027)
Bria AI

Bria vs Pixelcut free web tools: limits compared (2027)

Photoroom API alternative: migration in 6 steps (2027)
Bria AI

Photoroom API alternative: migration in 6 steps (2027)