| 9 | import torch |
| 10 | |
| 11 | class PedAttrAugmentation(object): |
| 12 | def __init__(self, height, width): |
| 13 | normalize = T.Normalize(mean=[0, 0, 0], std=[1, 1, 1]) |
| 14 | train_transform = T.Compose([ |
| 15 | T.Resize((height, width)), |
| 16 | T.Pad(10), |
| 17 | T.RandomCrop((height, width)), |
| 18 | T.RandomHorizontalFlip(), |
| 19 | T.PILToTensor(), |
| 20 | ]) |
| 21 | |
| 22 | self.transform = train_transform |
| 23 | |
| 24 | def __call__(self, img): |
| 25 | return self.transform(img) |
| 26 | |
| 27 | class PedAttrTestAugmentation(object): |
| 28 | def __init__(self, height, width): |