3838
3939If 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+
4145model_path = " DeepGlint-AI/MLCD-Seg" # or use your local path
4246mlcd_seg = AutoModel.from_pretrained(
4347 model_path,
@@ -46,13 +50,18 @@ mlcd_seg = AutoModel.from_pretrained(
4650).cuda()
4751tokenizer = 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' )
5054seg_prompt = " Could you provide a segmentation mask for the right giraffe in this image?"
5155pred_mask = model.seg(seg_img, seg_prompt, tokenizer, force_seg = False )
56+
5257```
5358
5459If 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+
5665model_path = " DeepGlint-AI/MLCD-Seg" # or use your local path
5766mlcd_seg = AutoModel.from_pretrained(
5867 model_path,
@@ -61,9 +70,10 @@ mlcd_seg = AutoModel.from_pretrained(
6170).cuda()
6271tokenizer = 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' )
6574seg_prompt = " Could you provide a segmentation mask for the right giraffe in this image?"
6675pred_mask = model.seg(seg_img, seg_prompt, tokenizer, force_seg = True )
76+
6777```
6878
6979## Intstallation
0 commit comments