Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,26 @@ library_name: transformers
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("microsoft/resnet-50")
|
25 |
+
model = ResNetModel.from_pretrained("microsoft/resnet-50")
|
26 |
+
|
27 |
+
inputs = processor(image, return_tensors="pt")
|
28 |
+
|
29 |
+
with torch.no_grad():
|
30 |
+
features = model(**inputs)
|
31 |
+
|
32 |
+
print(features)
|
33 |
+
```
|