--- license: mit base_model: - imgly/isnet-general-onnx pipeline_tag: image-segmentation library_name: transformers.js tags: - background-removal - image-segmentation - isnet - onnx - int8 - quantized --- # ISNet General Use — INT8 Quantized INT8 quantized version of [imgly/isnet-general-onnx](https://huggingface.co/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 ```javascript import { pipeline } from '@huggingface/transformers'; const segmenter = await pipeline('background-removal', '/isnet-general-onnx-int8'); const result = await segmenter('image.jpg'); ``` ## Quantization ### Prerequisites ```bash pip install -r requirements.txt ``` ### Download the fp32 source model ```bash huggingface-cli download imgly/isnet-general-onnx onnx/model.onnx --local-dir . ``` ### Run quantization ```bash 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`: ```python 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](https://huggingface.co/imgly/isnet-general-onnx) model. ## Credits - Original model: [imgly/isnet-general-onnx](https://huggingface.co/imgly/isnet-general-onnx) - ISNet architecture: [IS-Net](https://github.com/xuebinqin/DIS)