MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / ReidAugmentation

Class ReidAugmentation

PATH/core/data/transforms/reid_transforms.py:44–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43
44class ReidAugmentation(object):
45 def __init__(self, height, width, re, vit=False):
46 normalizer = T.Normalize(mean=[0.485, 0.456, 0.406],
47 std=[0.229, 0.224, 0.225])
48
49 if not vit:
50 self.train_transformer = T.Compose([
51 T.Resize((height, width)),
52 T.RandomHorizontalFlip(),
53 T.Pad(10),
54 T.RandomCrop((height, width)),
55 T.ToTensor(),
56 normalizer,
57 ])
58
59 if re:
60 self.train_transformer = T.Compose([
61 T.Resize((height, width)),
62 T.RandomHorizontalFlip(),
63 T.Pad(10),
64 T.RandomCrop((height, width)),
65 RandomSizedEarser(),
66 T.ToTensor(),
67 normalizer,
68 ])
69 else:
70 self.train_transformer = T.Compose([
71 T.Resize((height, width)),
72 T.RandomHorizontalFlip(),
73 T.Pad(10),
74 T.RandomCrop((height, width)),
75 T.PILToTensor(),
76 ])
77
78 if re:
79 self.train_transformer = T.Compose([
80 T.Resize((height, width)),
81 T.RandomHorizontalFlip(),
82 T.Pad(10),
83 T.RandomCrop((height, width)),
84 RandomSizedEarser(),
85 T.PILToTensor(),
86 ])
87
88 def __call__(self, img):
89 ## transform
90 return self.train_transformer(img)
91
92
93

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected