Spaces:
Runtime error
Runtime error
Download src/data/transforms.py from SiemonCha/ImageTrust-AI: direct link, hf CLI and curl.
- Browser
- Download file 674 Bytes
-
https://huggingface.co/spaces/SiemonCha/ImageTrust-AI/resolve/main/src/data/transforms.py
- Command line
-
hf download hf://spaces/SiemonCha/ImageTrust-AI/src/data/transforms.py
-
curl -L -o transforms.py https://huggingface.co/spaces/SiemonCha/ImageTrust-AI/resolve/main/src/data/transforms.py
674 Bytes
| from torchvision import transforms | |
| # Image size for ResNet18 | |
| IMAGE_SIZE = 224 | |
| train_transforms = transforms.Compose([ | |
| transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)), | |
| transforms.RandomHorizontalFlip(), | |
| transforms.RandomRotation(10), | |
| transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2), | |
| transforms.ToTensor(), | |
| transforms.Normalize(mean=[0.485, 0.456, 0.406], | |
| std=[0.229, 0.224, 0.225]) | |
| ]) | |
| val_transforms = transforms.Compose([ | |
| transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)), | |
| transforms.ToTensor(), | |
| transforms.Normalize(mean=[0.485, 0.456, 0.406], | |
| std=[0.229, 0.224, 0.225]) | |
| ]) |