Fast Segment Anything
Paper • 2306.12156 • Published • 36
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.
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.The easiest way to load and run these models is through the spatialhub Python library:
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")
If you use these models in academic work, please cite the original authors:
@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}
}