Loading…
Loading…
INT8 quantized version of imgly/isnet-general-onnx using weight-only QDQ format.
| Variant | Size | Dtype | WebGPU |
|---|---|---|---|
| Original (fp32) | 168 MB | fp32 | ✅ |
| This version (QDQ) | 42 MB | int8 (weight-only) | ✅ |
Standard QDQ quantization quantizes both weights and activations, causing accuracy loss (faded colors). Weight-only QDQ only quantizes Conv weights while keeping activations in fp32 — preserving output quality identical to the fp32 model while achieving 75% size reduction and full WebGPU support.
import { pipeline } from '@huggingface/transformers';
const segmenter = await pipeline('background-removal', 'xrds/isnet-general-onnx-int8', {
device: 'webgpu',
dtype: 'q8',
});
const result = await segmenter('image.jpg');
Use the included convert_weight_only_qdq.py to convert any Conv-based ONNX model to weight-only QDQ:
pip install onnx onnxruntime numpy
# Convert fp32 model → weight-only QDQ
python convert_weight_only_qdq.py --input model.onnx --output model-qdq.onnx
# Or with defaults (uses isnet-general-use.onnx → isnet-general-use-weight-only-qdq.onnx)
python convert_weight_only_qdq.py
The script quantizes only Conv weights to int8 (per-tensor symmetric), leaving activations in fp32. Output is a standard QDQ-format ONNX model compatible with WebGPU execution providers.
MIT — same as the original imgly/isnet-general-onnx model.
imgly/isnet-general-onnx