ONNX Model Zoo

onnx-community/mediapipe_selfie_segmentation_landscape-web

By onnx-community · ↓ 0 · ♥ 1 · Updated 2024-12-05

What's in this repo

This page lists the files in onnx-community/mediapipe_selfie_segmentation_landscape-web, including model.onnx, model_bnb4.onnx, model_fp16.onnx and more.

  • 8 ONNX models (.onnx files)
  • 11 files, including 8 .onnx, 1 .md, 1 .json
  • Last updated 2024-12-05

ONNX files

File Size Download
onnx/model.onnx — Download
onnx/model_bnb4.onnx — Download
onnx/model_fp16.onnx — Download
onnx/model_int8.onnx — Download
onnx/model_q4.onnx — Download
onnx/model_q4f16.onnx — Download
onnx/model_quantized.onnx — Download
onnx/model_uint8.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

Usage (Transformers.js)

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

npm i @huggingface/transformers

Example: Selfie segmentation with onnx-community/mediapipe_selfie_segmentation_landscape-web.

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

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

// Load image from URL
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/selfie_segmentation_landscape.png';
const image = await RawImage.read(url);

// Predict alpha matte
const { alphas } = await model({
    pixel_values: new Tensor(
        'uint8',
        image.data,
        [1, image.height, image.width, 3],
    ),
});

// Save output mask
const mask = RawImage.fromTensor(alphas[0].mul(255).to('uint8'), 'HWC')
mask.save('mask.png');

// (Optional) Apply mask to original image
const result = image.clone().putAlpha(mask);
result.save('result.png');
Input image Predicted mask Output image
image/png image/png image/png

Model info

onnx mobilenet_v3 license:apache-2.0 region:us
↓ 0 ♥ 1

Created: 2024-11-18

Updated: 2024-12-05

View on Hugging Face

Files (11)

.gitattributes
README.md
config.json
onnx/model.onnx ONNX
onnx/model_bnb4.onnx ONNX
onnx/model_fp16.onnx ONNX
onnx/model_int8.onnx ONNX
onnx/model_q4.onnx ONNX
onnx/model_q4f16.onnx ONNX
onnx/model_quantized.onnx ONNX
onnx/model_uint8.onnx ONNX

Related models