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

Downloads last month
53
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for xrds/isnet-general-onnx-int8

Quantized
(1)
this model