onnx-community/mediapipe_selfie_segmentation_landscape
By onnx-community · ↓ 2 · ♥ 3 · Updated 2025-03-07
What's in this repo
This page lists the files in onnx-community/mediapipe_selfie_segmentation_landscape, including model.onnx, model_bnb4.onnx, model_fp16.onnx and more.
- 8 ONNX models (.onnx files)
- 12 files, including 8 .onnx, 2 .json, 1 .md
- Last updated 2025-03-07
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.
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
// Load model and processor
const model_id = 'onnx-community/mediapipe_selfie_segmentation_landscape';
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://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/selfie_segmentation_landscape.png';
const image = await RawImage.read(url);
// Pre-process image
const inputs = await processor(image);
// Predict alpha matte
const { alphas } = await model(inputs);
// Save output mask
const mask = await RawImage.fromTensor(alphas[0].mul(255).to('uint8')).resize(image.width, image.height);
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 |
|---|---|---|
![]() |
![]() |
![]() |
Model info
Created: 2024-11-18
Updated: 2025-03-07
View on Hugging Face

