Skip to content

Commit

Permalink
efficient-sam -> efficientsam
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Jun 22, 2024
1 parent 17e0b17 commit 13b1c63
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

*Osam* provides:

- **Segment-Anything Models** - original SAM, Efficient-SAM;
- **Segment-Anything Models** - original SAM, EfficientSAM;
- **Local APIs** - CLI & Python & HTTP interface;
- **Customization** - Host custom vision models.

Expand All @@ -32,10 +32,10 @@ pip install osam

## Quickstart

To run with Efficient-SAM:
To run with EfficientSAM:

```bash
osam run efficient-sam --image <image_file>
osam run efficientsam --image <image_file>
```

## Model library
Expand All @@ -47,25 +47,25 @@ Here are models that can be downloaded:
| SAM 91M | 91M | 100MB | `osam run sam:91m` |
| SAM 308M | 308M | 320MB | `osam run sam:308m` |
| SAM 636M | 636M | 630MB | `osam run sam` |
| Efficient-SAM 10M | 10M | 40MB | `osam run efficient-sam:10m` |
| Efficient-SAM 25M | 25M | 100MB | `osam run efficient-sam` |
| EfficientSAM 10M | 10M | 40MB | `osam run efficientsam:10m` |
| EfficientSAM 25M | 25M | 100MB | `osam run efficientsam` |

PS. `sam`, `efficient-sam` is equivalent to `sam:latest`, `efficient-sam:latest`.
PS. `sam`, `efficientsam` is equivalent to `sam:latest`, `efficientsam:latest`.

## Usage

### CLI

```bash
# Run a model with an image
osam run efficient-sam --image examples/_images/dogs.jpg > output.png
osam run efficientsam --image examples/_images/dogs.jpg > output.png

# Get a JSON output
osam run efficient-sam --image examples/_images/dogs.jpg --json
# {"model": "efficient-sam", "mask": "..."}
osam run efficientsam --image examples/_images/dogs.jpg --json
# {"model": "efficientsam", "mask": "..."}

# Give a prompt
osam run efficient-sam --image examples/_images/dogs.jpg \
osam run efficientsam --image examples/_images/dogs.jpg \
--prompt '{"points": [[1439, 504], [1439, 1289]], "point_labels": [1, 1]}' > output.png
```

Expand All @@ -79,7 +79,7 @@ import osam.apis
import osam.types

request = osam.types.GenerateRequest(
model="efficient-sam",
model="efficientsam",
image=np.asarray(PIL.Image.open("examples/_images/dogs.jpg")),
prompt=osam.types.Prompt(points=[[1439, 504], [1439, 1289]], point_labels=[1, 1]),
)
Expand All @@ -98,7 +98,7 @@ osam serve
# POST request
curl 127.0.0.1:11368/api/generate -X POST \
-H "Content-Type: application/json" \
-d "{\"model\": \"efficient-sam\", \"image\": \"$(cat examples/_images/dogs.jpg | base64)\"}" \
-d "{\"model\": \"efficientsam\", \"image\": \"$(cat examples/_images/dogs.jpg | base64)\"}" \
| jq -r .mask | base64 --decode > mask.png
```

Expand Down

0 comments on commit 13b1c63

Please sign in to comment.