File size: 1,004 Bytes
75f2ab4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
tags:
- image-classification
license: cc-by-nc-4.0
---
# Model card

A Swin-v2 based species classification model.
Original model: timm/swinv2_tiny_window16_256.ms_in1k

## Model Details
- **Model Type:** Animal classification
- **Model Stats:**
 - Image size: 256 x 256

## Model Usage
### Image Embeddings
```python

import timm
import torch
import torchvision.transforms as T

from PIL import Image
from urllib.request import urlopen

model = timm.create_model("hf-hub:cermakvo/wildintel-species-classifier-swin-t", pretrained=True)
model = model.eval()

transforms = T.Compose([T.Resize(256), 
                  T.ToTensor(), 
                  T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])]) 

img = Image.open(urlopen(
    'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))

output = model(transforms(img).unsqueeze(0))  # output is (batch_size, num_features) shaped tensor
# output is a (1, num_features) shaped tensor
```