File size: 1,604 Bytes
08496f8
fbe6d9c
 
 
 
 
 
 
 
 
08496f8
47e724b
fbe6d9c
47e724b
fbe6d9c
 
47e724b
fbe6d9c
47e724b
fbe6d9c
 
47e724b
fbe6d9c
 
47e724b
fbe6d9c
47e724b
fbe6d9c
 
 
 
 
 
 
 
 
 
 
47e724b
fbe6d9c
47e724b
fbe6d9c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
license: gpl-3.0
tags:
- computer-vision
- image-segmentation
- instance-segmentation
- yolo
- onnx
- fastsam
pipeline_tag: image-segmentation
---

# FastSAM ONNX Weights

This repository contains ONNX-optimized weights for **FastSAM (Fast Segment Anything Model)**, a real-time CNN-based instance segmentation model built upon the YOLOv8-Seg architecture.
By converting the PyTorch weights to standard ONNX format, these models enable real-time object proposal generation and mask decoding on both CPU and GPU edge devices without requiring the PyTorch runtime.

## Available Files

* **`FastSAM-s.onnx`**: Small YOLOv8-Seg backbone variant (`"s"`), optimized for high frame rate and edge deployment.
* **`FastSAM-x.onnx`**: Extra-large YOLOv8-Seg backbone variant (`"x"`), higher capacity proposal generation model.

---
## How to Use

The easiest way to load and run these models is through the **[spatialhub](https://github.com/spatialhub-ai/spatialhub)** Python library:

```python
from spatialhub import FastSAM
# Initialize FastSAM segmentor
segmentor = FastSAM(model_variant="x")
# Generate mask proposals
result = segmentor.generate_masks("scene.png", conf_threshold=0.25)
# Save mask visualization
result.visualize_mask("fastsam_output.png")
```

## Original Citation

If you use these models in academic work, please cite the original authors:

```bibtex
@article{zhao2023fast,
  title={Fast Segment Anything},
  author={Zhao, Xu and Ding, Wenyu and An, Jiaqi and Du, Yufan and Zhao, Tao and Lu, Mengling and Shen, Shaohua},
  journal={arXiv preprint arXiv:2306.12156},
  year={2023}
}
```