Upload folder using huggingface_hub
Browse files- .gitattributes +6 -0
- README.md +34 -2
- assets/cir_candi_1.png +0 -0
- assets/cir_candi_2.png +3 -0
- assets/cir_query.png +3 -0
- assets/res-ft-mmeb.png +3 -0
- assets/res-scaling.png +3 -0
- assets/res-zs-cir.png +3 -0
- assets/res-zs-mmeb.png +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
assets/cir_candi_2.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
assets/cir_query.png filter=lfs diff=lfs merge=lfs -text
|
38 |
+
assets/res-ft-mmeb.png filter=lfs diff=lfs merge=lfs -text
|
39 |
+
assets/res-scaling.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
assets/res-zs-cir.png filter=lfs diff=lfs merge=lfs -text
|
41 |
+
assets/res-zs-mmeb.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -86,11 +86,43 @@ with torch.no_grad():
|
|
86 |
print(scores)
|
87 |
```
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
|
|
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
-
### 2. MMRet-MLLM Models
|
93 |
-
```Will be released soon.```
|
94 |
|
95 |
## Model Performance
|
96 |
### Zero-Shot Composed Image Retrieval
|
|
|
86 |
print(scores)
|
87 |
```
|
88 |
|
89 |
+
### 2. MMRet-MLLM Models
|
90 |
+
```python
|
91 |
+
import torch
|
92 |
+
from transformers import AutoModel
|
93 |
+
from PIL import Image
|
94 |
|
95 |
+
MODEL_NAME= "JUNJIE99/MMRet-MLLM-S1"
|
96 |
|
97 |
+
model = AutoModel.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
98 |
+
model.eval()
|
99 |
+
model.cuda()
|
100 |
+
|
101 |
+
with torch.no_grad():
|
102 |
+
model.set_processor(MODEL_NAME)
|
103 |
+
|
104 |
+
query_inputs = model.data_process(
|
105 |
+
text="Make the background dark, as if the camera has taken the photo at night",
|
106 |
+
images="./assets/cir_query.png",
|
107 |
+
q_or_c="q",
|
108 |
+
task_instruction="Retrieve the target image that best meets the combined criteria by using both the provided image and the image retrieval instructions: "
|
109 |
+
)
|
110 |
+
|
111 |
+
candidate_inputs = model.data_process(
|
112 |
+
images=["./assets/cir_candi_1.png", "./assets/cir_candi_2.png"],
|
113 |
+
q_or_c="c",
|
114 |
+
)
|
115 |
+
|
116 |
+
query_embs = model(**query_inputs, output_hidden_states=True)[:, -1, :]
|
117 |
+
candi_embs = model(**candidate_inputs, output_hidden_states=True)[:, -1, :]
|
118 |
+
|
119 |
+
query_embs = torch.nn.functional.normalize(query_embs, dim=-1)
|
120 |
+
candi_embs = torch.nn.functional.normalize(candi_embs, dim=-1)
|
121 |
+
|
122 |
+
scores = torch.matmul(query_embs, candi_embs.T)
|
123 |
+
print(scores)
|
124 |
+
```
|
125 |
|
|
|
|
|
126 |
|
127 |
## Model Performance
|
128 |
### Zero-Shot Composed Image Retrieval
|
assets/cir_candi_1.png
ADDED
![]() |
assets/cir_candi_2.png
ADDED
![]() |
Git LFS Details
|
assets/cir_query.png
ADDED
![]() |
Git LFS Details
|
assets/res-ft-mmeb.png
ADDED
![]() |
Git LFS Details
|
assets/res-scaling.png
ADDED
![]() |
Git LFS Details
|
assets/res-zs-cir.png
ADDED
![]() |
Git LFS Details
|
assets/res-zs-mmeb.png
ADDED
![]() |
Git LFS Details
|