Spaces:
Running
Running
Create transforms.py
Browse files- transforms.py +12 -0
transforms.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoImageProcessor
|
2 |
+
import torchvision.transforms as T
|
3 |
+
|
4 |
+
processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
|
5 |
+
augment = T.Compose([
|
6 |
+
T.RandomResizedCrop(224),
|
7 |
+
T.RandomHorizontalFlip(),
|
8 |
+
T.ColorJitter(0.2,0.2,0.2,0.1),
|
9 |
+
T.RandomRotation(20),
|
10 |
+
T.ToTensor(),
|
11 |
+
T.Normalize(mean=processor.image_mean, std=processor.image_std)
|
12 |
+
])
|