Official Project Page: https://github.com/facebookresearch/segment-anything.git
This is a Flask application that implements Meta's Segment Anything Model for segmenting images by mouse click in real-time performance. There are 3 images in the project, they will sequentially load, and you will interact with them by mouse click.
To install the necessary Python packages, run the following command:
pip install -r requirements.txt
If you want to use your CUDA cores, you can download the necessary toolkit with the following command (default is CPU):
conda install -c anaconda cudatoolkit=11.8
ViT-H SAM model (default) - 2.4 GB ViT-L SAM model - 1.2 GB ViT-B SAM model - 358 MB
There is a file called config.yaml, where you can set your configs.
checkpoint: 'models\sam_vit_h_4b8939.pth'
onnx_model: 'models\sam_onnx_quantized_example.onnx'
images_folder: 'static\images'
model_type: 'default'
By default, the application runs in Onnx runtime, which provides real-time execution performance. To run the application, execute the following command:
flask --app app.py run