Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: gpl-3.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gpl-3.0
|
| 3 |
+
base_model:
|
| 4 |
+
- facebook/dinov2-small
|
| 5 |
+
library_name: transformers
|
| 6 |
+
---
|
| 7 |
+
# cat2vec
|
| 8 |
+
|
| 9 |
+
The cat2vec model is a search model for cats.
|
| 10 |
+
|
| 11 |
+
It was trained using the [Labeled Cats In The Wild dataset](https://www.kaggle.com/datasets/dseidli/lcwlabeled-cats-in-the-wild) and a triplet loss.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
# Usage
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
from transformers import AutoImageProcessor, ResNetModel
|
| 18 |
+
import torch
|
| 19 |
+
from datasets import load_dataset
|
| 20 |
+
|
| 21 |
+
dataset = load_dataset("huggingface/cats-image")
|
| 22 |
+
image = dataset["test"]["image"][:2]
|
| 23 |
+
|
| 24 |
+
processor = AutoImageProcessor.from_pretrained("facebook/dinov2-small")
|
| 25 |
+
model = ResNetModel.from_pretrained("aeth0r/cat2vec-v2")
|
| 26 |
+
|
| 27 |
+
inputs = processor(image, return_tensors="pt")
|
| 28 |
+
|
| 29 |
+
with torch.no_grad():
|
| 30 |
+
features = model(**inputs)
|
| 31 |
+
|
| 32 |
+
print(features)
|
| 33 |
+
```
|