BritishWerewolf commited on
Commit
3e77535
·
1 Parent(s): 12f21b9

Add ONNX model (fp32).

Browse files
Files changed (4) hide show
  1. README.md +52 -0
  2. config.json +25 -0
  3. onnx/model.onnx +3 -0
  4. preprocessor_config.json +27 -0
README.md CHANGED
@@ -1,3 +1,55 @@
1
  ---
 
 
 
 
 
 
 
 
2
  license: apache-2.0
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ library_name: transformers
3
+ pipeline_tag: image-segmentation
4
+ tags:
5
+ - isnet
6
+ - dis
7
+ - image-segmentation
8
+ - mask-generation
9
+ - transformers.js
10
  license: apache-2.0
11
+ language:
12
+ - en
13
  ---
14
+ # IS-Net
15
+
16
+ ## Model Description
17
+ IS-Net is a deep learning model designed to provide interactive image segmentation capabilities. The model allows users to refine segmentation masks through user interactions, making it highly effective for tasks that require precise and detailed segmentation results.
18
+
19
+ ## Usage
20
+ Perform mask generation with `BritishWerewolf/IS-Net`.
21
+
22
+ ### Example
23
+ ```javascript
24
+ import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
25
+
26
+ const img_url = 'https://huggingface.co/ybelkada/segment-anything/resolve/main/assets/car.png';
27
+ const image = await RawImage.read(img_url);
28
+
29
+ const processor = await AutoProcessor.from_pretrained('BritishWerewolf/IS-Net');
30
+ const processed = await processor(image);
31
+
32
+ const model = await AutoModel.from_pretrained('BritishWerewolf/IS-Net', {
33
+ dtype: 'fp32',
34
+ });
35
+
36
+ const output = await model({ input: processed.pixel_values });
37
+ // {
38
+ // mask: Tensor {
39
+ // dims: [ 1, 1024, 1024 ],
40
+ // type: 'uint8',
41
+ // data: Uint8Array(1048576) [ ... ],
42
+ // size: 1048576
43
+ // }
44
+ // }
45
+ ```
46
+
47
+ ### Inference
48
+ To use the model for inference, you can follow the example provided above. The `AutoProcessor` and `AutoModel` classes from the `transformers` library make it easy to load the model and processor.
49
+
50
+ ## Credits
51
+ * [`rembg`](https://github.com/danielgatis/rembg) for the ONNX model.
52
+ * The authors of the original IS-Net model can be credited at https://github.com/xuebinqin/DIS.
53
+
54
+ ## Licence
55
+ This model is licensed under the Apache License 2.0 to match the original IS-Net model.
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BritishWerewolf/IS-Net",
3
+ "model_type": "u2net",
4
+ "architectures": [
5
+ "U2NetModel"
6
+ ],
7
+ "input_name": "input_image",
8
+ "input_shape": [1, 3, 1024, 1024],
9
+ "output_composite": "output_image",
10
+ "output_names": [
11
+ "1890",
12
+ "1891",
13
+ "1892",
14
+ "1893",
15
+ "1894",
16
+ "input.656",
17
+ "input.740",
18
+ "input.832",
19
+ "input.948",
20
+ "input.1088",
21
+ "input.1252",
22
+ "output_image"
23
+ ],
24
+ "output_shape": [1, 1024, 1024]
25
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60920e99c45464f2ba57bee2ad08c919a52bbf852739e96947fbb4358c0d964a
3
+ size 178648008
preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "U2NetProcessor",
3
+ "image_processor_type": "U2NetImageProcessor",
4
+ "do_convert_rgb": true,
5
+ "do_normalize": true,
6
+ "do_pad": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "keep_aspect_ratio": true,
10
+ "image_mean": [
11
+ 0.485,
12
+ 0.456,
13
+ 0.406
14
+ ],
15
+ "image_std": [
16
+ 1.0,
17
+ 1.0,
18
+ 1.0
19
+ ],
20
+ "pad_size": {
21
+ "width": 1024,
22
+ "height": 1024
23
+ },
24
+ "size": {
25
+ "longest_edge": 1024
26
+ }
27
+ }