Instructions to use xrds/isnet-general-onnx-int8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use xrds/isnet-general-onnx-int8 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'xrds/isnet-general-onnx-int8');
ISNet General Use โ INT8 Quantized
INT8 quantized version of imgly/isnet-general-onnx for faster inference with minimal quality loss.
Model Details
| Variant | Size | Dtype |
|---|---|---|
| Original (fp32) | 168 MB | fp32 |
| This version (INT8) | 43 MB | int8 |
Usage with Transformers.js
import { pipeline } from '@huggingface/transformers';
const segmenter = await pipeline('background-removal', '<username>/isnet-general-onnx-int8');
const result = await segmenter('image.jpg');
Quantization
Prerequisites
pip install -r requirements.txt
Download the fp32 source model
huggingface-cli download imgly/isnet-general-onnx onnx/model.onnx --local-dir .
Run quantization
python quantize.py
Output: onnx/model_int8.onnx (~43 MB, ~75% smaller than fp32)
How it works
Uses ONNX Runtime's quantize_dynamic with QuantType.QInt8:
from onnxruntime.quantization import quantize_dynamic, QuantType
quantize_dynamic(
model_input='onnx/model.onnx',
model_output='onnx/model_int8.onnx',
weight_type=QuantType.QInt8,
)
License
MIT โ same as the original imgly/isnet-general-onnx model.
Credits
- Original model: imgly/isnet-general-onnx
- ISNet architecture: IS-Net
- Downloads last month
- 53
Model tree for xrds/isnet-general-onnx-int8
Base model
imgly/isnet-general-onnx