The FlashSAM is a CNN Segment Anything Model trained using only 2% of the SA-1B dataset published by SAM authors. FlashSAM achieves comparable performance with the SAM method at 50× higher run-time speed. Its backbone comes from YOLO11.
We recommend uv as the package manager, develop environment is Ubuntu 22.04 with cuda12.2
uv init -p 3.10
uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
# if you use conda, run pip install -r requirements.txt
FlashSAM: link
Download and put it at ./weights/
To infer in a script
uv run main.py
To infer in gradio for visualization
gradio app.py
If you want to train FlashSAM from beginning, see readme.md in train.