Skip to content

Commit 74e835b

Browse files
authored
Update README.md (#145)
1 parent 6a4c850 commit 74e835b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

mlcd_vl/downstream/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838

3939
If you just want to use this code, please refer to this sample below
4040
```python
41+
from transformers import AutoModel, AutoTokenizer
42+
from PIL import Image
43+
44+
4145
model_path = "DeepGlint-AI/MLCD-Seg" # or use your local path
4246
mlcd_seg = AutoModel.from_pretrained(
4347
model_path,
@@ -46,13 +50,18 @@ mlcd_seg = AutoModel.from_pretrained(
4650
).cuda()
4751
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
4852
# Assuming you have an image named test.jpg
49-
seg_img = Image.open("asserts/example.jpg").convert('RGB')
53+
seg_img = Image.open("test.jpg").convert('RGB')
5054
seg_prompt = "Could you provide a segmentation mask for the right giraffe in this image?"
5155
pred_mask = model.seg(seg_img, seg_prompt, tokenizer, force_seg=False)
56+
5257
```
5358

5459
If you want to use this code measurement dataset (e.g. refcoco), then you need to use the following method
5560
```python
61+
from transformers import AutoModel, AutoTokenizer
62+
from PIL import Image
63+
64+
5665
model_path = "DeepGlint-AI/MLCD-Seg" # or use your local path
5766
mlcd_seg = AutoModel.from_pretrained(
5867
model_path,
@@ -61,9 +70,10 @@ mlcd_seg = AutoModel.from_pretrained(
6170
).cuda()
6271
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
6372
# Assuming you have an image named test.jpg
64-
seg_img = Image.open("asserts/example.jpg").convert('RGB')
73+
seg_img = Image.open("test.jpg").convert('RGB')
6574
seg_prompt = "Could you provide a segmentation mask for the right giraffe in this image?"
6675
pred_mask = model.seg(seg_img, seg_prompt, tokenizer, force_seg=True)
76+
6777
```
6878

6979
## Intstallation

0 commit comments

Comments
 (0)