DIS (IS-Net, general-use) β€” High-precision object cutout (LiteRT GPU)

On-device dichotomous image segmentation running fully on the LiteRT CompiledModel GPU delegate (no CPU fallback). DIS (ECCV 2022) is a high-accuracy IS-Net that cuts out the main object with fine structure detail (thin stems, petals, wires, handles) β€” for e-commerce product photos and graphics. ~11 ms/frame on a Pixel 8a.

  • Architecture: IS-Net (RSU / UΒ²-Net-style nested residual blocks) β€” pure CNN.
  • Weights: xuebinqin/DIS isnet-general-use Β· Apache-2.0.
  • Size: 176 MB.

DIS high-precision cutout

Input (left) β†’ high-precision alpha cut-out on transparency (right). Photo: Unsplash (free license).

I/O

  • Input: [1, 3, 1024, 1024] NCHW, RGB, x/255 - 0.5.
  • Output: [1, 1, 1024, 1024] sigmoid mask (0–1) β€” resize to the image, use as alpha.

GPU conversion

DIS is a pure CNN (IS-Net RSU blocks). It converts fully GPU-compatible (247/247 nodes on the delegate, 1 partition; device max|diff| 0.00034, ~11 ms) with one defensive patch: align_corners=True β†’ False on the bilinear upsamples. CPU-exact vs PyTorch (max|diff| 0.0).

Minimal usage

Kotlin (Android, LiteRT CompiledModel GPU)

val options = CompiledModel.Options(Accelerator.GPU)
val model = CompiledModel.create(context.assets, "dis.tflite", options, null)
val inBufs = model.createInputBuffers()
val outBufs = model.createOutputBuffers()

inBufs[0].writeFloat(inputNCHW)          // [1,3,1024,1024] RGB, x/255 - 0.5
model.run(inBufs, outBufs)
val mask = outBufs[0].readFloat()        // [1024*1024] alpha (0..1); resize -> composite

Python (LiteRT / ai-edge-litert)

import numpy as np
from ai_edge_litert.interpreter import Interpreter

it = Interpreter(model_path="dis.tflite"); it.allocate_tensors()
inp, out = it.get_input_details(), it.get_output_details()
it.set_tensor(inp[0]["index"], x)        # [1,3,1024,1024] float32, RGB, x/255 - 0.5
it.invoke()
mask = it.get_tensor(out[0]["index"])[0, 0]   # [1024,1024] alpha 0..1

Conversion

Converted with litert-torch (build_dis.py): loads the Apache-2.0 IS-Net general-use weights and exports the main mask.

License

Apache-2.0 (DIS / xuebinqin). IS-Net architecture.

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