fastsam-onnx / README.md
pankaj-kaushik's picture
Update README.md
47e724b verified
|
Raw History Blame Contribute Delete
1.6 kB
---
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}
}
```