Introduction

BEN, or Background Erase Network, is a deep learning model created to automatically remove backgrounds from images. It generates both a binary mask and a foreground image. This model is optimized for performance with support for GPU acceleration using CUDA.

Architecture

BEN is a beta base model designed for efficiency in dichotomous image segmentation. It consists of 94 million parameters and is benchmarked against several metrics to ensure high accuracy and performance. The architecture allows for easy integration and scalability, with features including background removal and mask generation.

Training

BEN was evaluated using a 5K dataset with significant performance metrics:

  • MAE: 0.0331
  • DICE: 0.8743
  • IOU: 0.8301
  • BER: 0.0560
  • ACC: 0.9700

These metrics show BEN's capability in accurately segmenting images and removing backgrounds compared to older models like MVANet and other untested models like BIREFNET and INSPYRENET.

Guide: Running Locally

  1. Clone the Repository:
    git clone <repository-url>
    
  2. Install Requirements:
    pip install -r requirements.txt
    
  3. Run the Model:
    import model
    from PIL import Image
    import torch
    
    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
    file = "./image.png" # input image
    
    model = model.BEN_Base().to(device).eval() # Initialize pipeline
    model.loadcheckpoints("./BEN_Base.pth")
    image = Image.open(file)
    mask, foreground = model.inference(image)
    
    mask.save("./mask.png")
    foreground.save("./foreground.png")
    
  4. Suggested Cloud GPUs: Utilize cloud-based GPUs such as AWS EC2 with NVIDIA GPUs or Google Cloud's AI Platform for enhanced performance and faster processing.

License

BEN is licensed under the Apache-2.0 License, which allows for use, modification, and distribution with minimal restrictions.

More Related APIs in Image Segmentation