https://github.com/yas-sim/openvino-segment-anything-interactive-demo
  
  
    Segment Anything Model (SAM) interactive demo with OpenVINO 
    https://github.com/yas-sim/openvino-segment-anything-interactive-demo
  
cpu demo efficientsam interactive openvino python sam segment-anything segment-anything-model segmentation
        Last synced: 7 months ago 
        JSON representation
    
Segment Anything Model (SAM) interactive demo with OpenVINO
- Host: GitHub
 - URL: https://github.com/yas-sim/openvino-segment-anything-interactive-demo
 - Owner: yas-sim
 - License: apache-2.0
 - Created: 2024-02-19T09:59:40.000Z (over 1 year ago)
 - Default Branch: main
 - Last Pushed: 2024-06-05T10:23:18.000Z (over 1 year ago)
 - Last Synced: 2025-03-29T15:34:42.729Z (7 months ago)
 - Topics: cpu, demo, efficientsam, interactive, openvino, python, sam, segment-anything, segment-anything-model, segmentation
 - Language: Python
 - Homepage:
 - Size: 19.8 MB
 - Stars: 12
 - Watchers: 1
 - Forks: 0
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 
 
Awesome Lists containing this project
README
          # Segment Anything Model (SAM) interactive demo with OpenVINO
## Description
This demo takes an image file and runs a SAM model using OpenVINO.  
You can point to the input image with the mouse, and the demo program shows the segmentation result on the image.  
This demo supports following models from [yformer/EfficientSAM GitHub repo](https://github.com/yformer/EfficientSAM.git):
- efficient-sam-vitt
- efficient-sam-vits
## Programs / Files
|#|File name|Description|
|---|---|---|
|1|download_and_convert.py|Clone the EfficientSAM GitHub repo and convert the model into OpenVINO IR model.|
|2|efficientsam.py|Run the EfficientSAM interactive demo with OpenVINO|
## How to run
1. Install prerequisites
```sh
python -m venv venv
venv/Scripts/activate
python -m pip install -U pip
pip install -U setuptools wheel
pip install -r requirements.txt
```
2. Download the model
```sh
python download_and_convert.py
```
3. Run the demo
Point and click on the image to kick inferencing.
```sh
python efficientsam.py
  or
python efficientsam.py -i 
```
Command line options:
```sh
options:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to an input image file
  -n NUM_POINTS, --num_points NUM_POINTS
                        Number of points for an inference (default:1)
  -f, --full_screen     Full screen mode
```
## Demo  
`python .\efficientsam.py -i .\trolley.jpg -n 3 -f`

## Test environment  
- Windows 11
- Python 3.10.3
- OpenVINO 2023.3.0