Created
July 16, 2021 09:32
-
-
Save Chris-hughes10/a79860ca33c049f7cbe6068ce79e62ee to your computer and use it in GitHub Desktop.
Effdet-blog-transformations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import albumentations as A | |
from albumentations.pytorch.transforms import ToTensorV2 | |
def get_train_transforms(target_img_size=512): | |
return A.Compose( | |
[ | |
A.HorizontalFlip(p=0.5), | |
A.Resize(height=target_img_size, width=target_img_size, p=1), | |
A.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), | |
ToTensorV2(p=1), | |
], | |
p=1.0, | |
bbox_params=A.BboxParams( | |
format="pascal_voc", min_area=0, min_visibility=0, label_fields=["labels"] | |
), | |
) | |
def get_valid_transforms(target_img_size=512): | |
return A.Compose( | |
[ | |
A.Resize(height=target_img_size, width=target_img_size, p=1), | |
A.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]), | |
ToTensorV2(p=1), | |
], | |
p=1.0, | |
bbox_params=A.BboxParams( | |
format="pascal_voc", min_area=0, min_visibility=0, label_fields=["labels"] | |
), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment