Update README.md
Browse files
README.md
CHANGED
@@ -5,18 +5,28 @@ pipeline_tag: mask-generation
|
|
5 |
|
6 |
This model repository contains the weights of the MobileSAM model.
|
7 |
|
|
|
|
|
|
|
|
|
8 |
## Usage
|
9 |
|
10 |
-
|
11 |
|
12 |
-
```
|
13 |
-
|
|
|
14 |
|
|
|
|
|
|
|
15 |
from mobile_sam import MobileSAM, SamPredictor
|
|
|
16 |
|
17 |
model = MobileSAM.from_pretrained("nielsr/mobilesam")
|
18 |
|
19 |
# perform inference
|
|
|
20 |
model.to(device=device)
|
21 |
|
22 |
predictor = SamPredictor(model)
|
|
|
5 |
|
6 |
This model repository contains the weights of the MobileSAM model.
|
7 |
|
8 |
+
## Installation
|
9 |
+
|
10 |
+
First install the M
|
11 |
+
|
12 |
## Usage
|
13 |
|
14 |
+
First install the MobileSAM package:
|
15 |
|
16 |
+
```bash
|
17 |
+
pip install git+https://github.com/ChaoningZhang/MobileSAM.git
|
18 |
+
```
|
19 |
|
20 |
+
The model can then be used as follows:
|
21 |
+
|
22 |
+
```python
|
23 |
from mobile_sam import MobileSAM, SamPredictor
|
24 |
+
import torch
|
25 |
|
26 |
model = MobileSAM.from_pretrained("nielsr/mobilesam")
|
27 |
|
28 |
# perform inference
|
29 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
30 |
model.to(device=device)
|
31 |
|
32 |
predictor = SamPredictor(model)
|