pankaj-kaushik commited on
Commit
d7587bc
·
verified ·
1 Parent(s): 9cbcdd5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +46 -0
README.md CHANGED
@@ -1,3 +1,49 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - computer-vision
5
+ - image-segmentation
6
+ - mask-generation
7
+ - vision-transformer
8
+ - onnx
9
+ - segment-anything
10
+ - sam
11
+ pipeline_tag: image-segmentation
12
  ---
13
+
14
+ # Segment Anything (SAM) ONNX Weights
15
+
16
+ This repository contains ONNX-optimized weights for the **Segment Anything Model (SAM)**, a foundation model designed for promptable and automatic mask generation (AMG).
17
+
18
+ The architecture is decoupled into separate **Image Encoder** and **Mask Decoder** ONNX graphs. This design allows running heavy image encoding once while executing lightweight mask decoding interactively across multiple point prompts on both CPU and GPU without PyTorch dependencies.
19
+
20
+ ## Available Files
21
+ * **`vit_b_encoder.onnx` & `vit_b_decoder.onnx`**: ViT-Base backbone, optimized for reduced memory footprint and higher throughput.
22
+ * **`vit_l_encoder.onnx` & `vit_l_decoder.onnx`**: ViT-Large backbone, balanced representation capacity and inference speed.
23
+ * **`vit_h_encoder.onnx` & `vit_h_decoder.onnx`**: ViT-Huge backbone, standard high-fidelity segmentation model.
24
+
25
+ ---
26
+
27
+ ## How to Use
28
+
29
+ The easiest way to load and run these models is through the **[spatialhub](https://github.com/spatialhub-ai/spatialhub)** Python library:
30
+
31
+ ```python
32
+ from spatialhub import SAM
33
+
34
+ # Initialize SAM automatic mask generator
35
+ segmentor = SAM(model_variant="vit_h")
36
+
37
+ # Generate instance mask proposals across a uniform grid
38
+ result = segmentor.generate_masks("image.jpg", points_per_side=32)
39
+
40
+ # Save segmentation overlay
41
+ result.visualize_mask("sam_output.png")
42
+
43
+
44
+ @article{kirillov2023segany,
45
+ title={Segment Anything},
46
+ author={Kirillov, Alexander and Mintun, Eric and Ravi, Nikhila and Mao, Hanzi and Rolland, Chloe and Gustafson, Laura and Xiao, Tete and Whitehead, Spencer and Berg, Alexander C. and Lo, Wan-Yen and Doll{\'a}r, Piotr and Girshick, Ross},
47
+ journal={arXiv preprint arXiv:2304.02643},
48
+ year={2023}
49
+ }