isword14 commited on
Commit
ef1004f
·
verified ·
1 Parent(s): f3dd0c2

Add model card

Browse files
Files changed (1) hide show
  1. README.md +78 -0
README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: onnx
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - onnx
7
+ - onnxruntime-web
8
+ - background-removal
9
+ - salient-object-detection
10
+ - u2net
11
+ ---
12
+
13
+ # u2netp (ONNX)
14
+
15
+ A mirror of **u2netp** — the small ("portable") variant of
16
+ [U²-Net](https://github.com/xuebinqin/U-2-Net) — for salient object detection,
17
+ the model behind background removal.
18
+
19
+ This repository exists so the model can be fetched directly by a browser at
20
+ runtime. It is a **verbatim mirror**: the file is byte-for-byte the `u2netp.onnx`
21
+ asset published by the [rembg](https://github.com/danielgatis/rembg) project, and
22
+ its SHA-256 is pinned by the consumer.
23
+
24
+ | | |
25
+ | --- | --- |
26
+ | File | `u2netp.onnx` |
27
+ | Size | 4,574,861 bytes (4.36 MiB) |
28
+ | SHA-256 | `309c8469258dda742793dce0ebea8e6dd393174f89934733ecc8b14c76f4ddd8` |
29
+ | Opset | 11 |
30
+
31
+ ## Tensor contract
32
+
33
+ Read the input and output names off the graph rather than hardcoding them — the
34
+ first of each is what the pipeline below uses.
35
+
36
+ - **Input** — `float32[1, 3, 320, 320]`, NCHW, RGB.
37
+ - **Output** — `float32[1, 1, 320, 320]`, a saliency map. U²-Net emits several
38
+ side outputs; the **first** is the fused one to use.
39
+
40
+ ## Pre / post-processing
41
+
42
+ The model is fixed at 320×320, so the image is **squashed** to that size (aspect
43
+ ratio is not preserved), then normalised with the ImageNet statistics:
44
+
45
+ ```
46
+ scaled = (pixel / 255) / max_pixel_value_of_the_image
47
+ tensor = (scaled - mean) / std
48
+ mean = [0.485, 0.456, 0.406]
49
+ std = [0.229, 0.224, 0.225]
50
+ ```
51
+
52
+ Afterwards, min–max normalise the saliency map to 0–1, scale to 0–255, resize it
53
+ back to the original dimensions (bilinear), and use it as the alpha channel of
54
+ the source image.
55
+
56
+ > **Note on other mirrors.** Some copies of this model ship a
57
+ > `preprocessor_config.json` describing a letterbox resize
58
+ > (`keep_aspect_ratio` / `do_pad`). That does **not** match the pipeline above,
59
+ > and following it changes the output.
60
+
61
+ ## Licence and credit
62
+
63
+ The U²-Net weights are **Apache-2.0**. If you use them, cite the paper:
64
+
65
+ ```bibtex
66
+ @InProceedings{Qin_2020_PR,
67
+ title = {U2-Net: Going Deeper with Nested U-Structure for Salient Object Detection},
68
+ author = {Qin, Xuebin and Zhang, Zichen and Huang, Chenyang and Dehghan, Masood
69
+ and Zaiane, Osmar and Jagersand, Martin},
70
+ journal = {Pattern Recognition},
71
+ volume = {106},
72
+ pages = {107404},
73
+ year = {2020}
74
+ }
75
+ ```
76
+
77
+ - Model and paper: [xuebinqin/U-2-Net](https://github.com/xuebinqin/U-2-Net) (Apache-2.0)
78
+ - The release asset mirrored here: [danielgatis/rembg](https://github.com/danielgatis/rembg) (MIT)