license: apache-2.0
BEN - Background Erase Network
BEN is a deep learning model designed to automatically remove backgrounds from images, producing both a mask and a foreground image.
BEN SOA Benchmarks on Disk 5k Eval
BEN_Base + BEN_Refiner (commerical model please contanct us for more information): MAE-0.0283 DICE-0.8976 IOU-0.8430 BER-0.0542 ACC-0.9725
BEN_Base: MAE-0.0331 DICE-0.8743 IOU-0.8301 BER-0.0560 ACC-0.9700
MVANet (old SOA): MAE-0.0353 DICE-0.8676 IOU-0.8104 BER-0.0639 ACC-0.9660
Features
- Background removal from images
- Generates both binary mask and foreground image
- CUDA support for GPU acceleration
- Simple API for easy integration
Installation
- Clone Repo
- Install requirements.txt
Quick Start Code
from BEN import BEN_Base from PIL import Image import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = BEN_Base().to(device).eval() model.loadcheckpoints("./BEN/BEN_Base.pth")
image = Image.open("./image2.jpg") mask, foreground = model.inference(image)
mask.save("./mask.png") foreground.save("./foreground.png")