onnx-community / BiRefNet_lite

huggingface.co
Total runs: 112
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: September 06 2024
image-segmentation

Introduction of BiRefNet_lite

Model Details of BiRefNet_lite

Bilateral Reference for High-Resolution Dichotomous Image Segmentation

1 Nankai University 2 Northwestern Polytechnical University 3 National University of Defense Technology 4 Aalto University 5 Shanghai AI Laboratory 6 University of Trento
DIS-Sample_1 DIS-Sample_2

For more information, check out the official repository .

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @huggingface/transformers

You can then use the model for image matting, as follows:

import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';

// Load model and processor
const model_id = 'onnx-community/BiRefNet_lite';
const model = await AutoModel.from_pretrained(model_id, { dtype: 'fp32' });
const processor = await AutoProcessor.from_pretrained(model_id);

// Load image from URL
const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
const image = await RawImage.fromURL(url);

// Pre-process image
const { pixel_values } = await processor(image);

// Predict alpha matte
const { output_image } = await model({ input_image: pixel_values });

// Save output mask
const mask = await RawImage.fromTensor(output_image[0].sigmoid().mul(255).to('uint8')).resize(image.width, image.height);
mask.save('mask.png');
Input image Output mask
image/png image/png
Citation
@article{BiRefNet,
  title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},
  author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},
  journal={CAAI Artificial Intelligence Research},
  year={2024}
}

Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using 🤗 Optimum and structuring your repo like this one (with ONNX weights located in a subfolder named onnx ).

Runs of onnx-community BiRefNet_lite on huggingface.co

112
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About BiRefNet_lite huggingface.co Model

BiRefNet_lite huggingface.co

BiRefNet_lite huggingface.co is an AI model on huggingface.co that provides BiRefNet_lite's model effect (), which can be used instantly with this onnx-community BiRefNet_lite model. huggingface.co supports a free trial of the BiRefNet_lite model, and also provides paid use of the BiRefNet_lite. Support call BiRefNet_lite model through api, including Node.js, Python, http.

onnx-community BiRefNet_lite online free

BiRefNet_lite huggingface.co is an online trial and call api platform, which integrates BiRefNet_lite's modeling effects, including api services, and provides a free online trial of BiRefNet_lite, you can try BiRefNet_lite online for free by clicking the link below.

onnx-community BiRefNet_lite online free url in huggingface.co:

https://huggingface.co/onnx-community/BiRefNet_lite

BiRefNet_lite install

BiRefNet_lite is an open source model from GitHub that offers a free installation service, and any user can find BiRefNet_lite on GitHub to install. At the same time, huggingface.co provides the effect of BiRefNet_lite install, users can directly use BiRefNet_lite installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

BiRefNet_lite install url in huggingface.co:

https://huggingface.co/onnx-community/BiRefNet_lite

Url of BiRefNet_lite

Provider of BiRefNet_lite huggingface.co

onnx-community
ORGANIZATIONS

Other API from onnx-community