File size: 595 Bytes
e781444
 
 
 
 
 
 
 
 
 
 
 
94c74ee
e781444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-nc-4.0
tags:
- timm
- transformers
base_model:
- timm/vit_base_patch16_siglip_384.v2_webli
---

```py
import torchvision.transforms.v2 as T

image_size = 384
preprocessor = T.Compose(
    [
        T.Resize(
            size=None,
            max_size=image_size,
            interpolation=T.InterpolationMode.NEAREST,
        ),
        T.Pad(
            padding=image_size // 2,
            fill=0,  # black
        ),
        T.CenterCrop(
            size=(image_size, image_size),
        ),
        T.ToDtype(dtype=torch.float32, scale=True), # 0~255 -> 0~1
    ]
)
```