u2net-ort / README.md
ipsilondev's picture
Initial upload
6fc8e5a verified
|
Raw History Blame Contribute Delete
1.83 kB
---
license: apache-2.0
base_model: xuebinqin/U-2-Net
library_name: onnxruntime
pipeline_tag: image-segmentation
tags:
- background-removal
- salient-object-detection
- onnx
- ort-format
---
# u2net-ort
U2-Net (full `u2net`, 320x320) in ORT format, dynamically quantised. Upstream: https://github.com/xuebinqin/U-2-Net (Apache-2.0).
This is a MOVE of the file already shipped by the EraseBGAI app (private repo `shadowofsoul/erasebgai`,
path `EraseBGAI/erasebgaimodels/src/main/assets/models/u2net.quantz.ort`). The bytes are identical to that location.
| File | Bytes | SHA-256 |
|---|---|---|
| `u2net.quantz.ort` | 44741000 | `fce9e954a3a94921c860557353235931bbdacdb89930c223449af3c549315a3f` |
## Tensors (checked with onnxruntime 1.24.1, CPU)
| | Name | Shape | dtype |
|---|---|---|---|
| input | `input.1` | `[1, 3, 320, 320]` (NCHW) | `float32` |
| outputs | `1959` ... `1965` (7 side outputs d0..d6) | `[1, 1, 320, 320]` each | `float32` |
Use output 0 (`1959`, the fused map d0). Values are already in 0..1 (sigmoid applied inside the graph).
## Pre- and post-processing (as in EraseBGAI `utils.java`: `processImageToInputU2net` / `ouputTensorToImageU2net`)
- Resize to 320x320 (bilinear), `x / 255`, normalise with ImageNet mean `[0.485, 0.456, 0.406]` and std `[0.229, 0.224, 0.225]`, NCHW.
- Output: take output 0, min-max normalise to 0..1 over the whole map (`(v - min) / (max - min)`), resize back to the source size. Result is the alpha matte.
## Provenance
The original conversion command is not recorded in the EraseBGAI repository. The file name (`quantz`) and the ORT flatbuffer header (`ORTM`)
indicate: public U2-Net PyTorch weights -> ONNX export -> dynamic quantisation -> `convert_onnx_models_to_ort`. The graph signature above matches the standard U2-Net ONNX export (`input.1`, seven outputs).