Simon Lepage commited on
Commit ·
3190ebb
1
Parent(s): 29f03f1
Add short README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
# Conditional ViT - B/16 - Categories
|
| 6 |
+
|
| 7 |
+
- Introduced in [Weakly-Supervised Conditional Embedding for Referred Visual Search](https://arxiv.org/abs/2306.02928)
|
| 8 |
+
|
| 9 |
+
- [Training Data](https://huggingface.co/datasets/Slep/LAION-RVS-Fashion)
|
| 10 |
+
|
| 11 |
+
- [Training Code](https://github.com/Simon-Lepage/CondViT-LRVSF)
|
| 12 |
+
|
| 13 |
+
- [Demo](https://huggingface.co/spaces/Slep/CondViT-LRVSF-Demo)
|
| 14 |
+
|
| 15 |
+
## General Infos
|
| 16 |
+
|
| 17 |
+
Model finetuned from CLIP ViT-B/16 on LRVSF at 224x224. The conditioning categories are the following :
|
| 18 |
+
- Bags
|
| 19 |
+
- Feet
|
| 20 |
+
- Hands
|
| 21 |
+
- Head
|
| 22 |
+
- Lower Body
|
| 23 |
+
- Neck
|
| 24 |
+
- Outwear
|
| 25 |
+
- Upper Body
|
| 26 |
+
- Waist
|
| 27 |
+
- Whole Body
|
| 28 |
+
|
| 29 |
+
Research use only.
|
| 30 |
+
|
| 31 |
+
## How to Use
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from PIL import Image
|
| 35 |
+
import requests
|
| 36 |
+
from transformers import AutoProcessor, AutoModel
|
| 37 |
+
import torch
|
| 38 |
+
|
| 39 |
+
model = AutoModel.from_pretrained("Slep/CondViT-B16-cat")
|
| 40 |
+
processor = AutoProcessor.from_pretrained("Slep/CondViT-B16-cat")
|
| 41 |
+
|
| 42 |
+
url = "https://huggingface.co/datasets/Slep/LAION-RVS-Fashion/resolve/main/assets/108856.0.jpg"
|
| 43 |
+
img = Image.open(requests.get(url, stream=True).raw)
|
| 44 |
+
cat = "Bags"
|
| 45 |
+
|
| 46 |
+
inputs = processor(images=[img], categories=[cat])
|
| 47 |
+
raw_embedding = model(**inputs)
|
| 48 |
+
normalized_embedding = torch.nn.functional.normalize(raw_embedding, dim=-1)
|
| 49 |
+
```
|