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

Method __call__

PATH/core/augmentation.py:551–573  ·  view source on GitHub ↗
(self, img, binary_mask=None)

Source from the content-addressed store, hash-verified

549 return img
550
551 def __call__(self, img, binary_mask=None):
552 ## transform
553 img = img[:,:,::-1]
554 img = cv2.resize(img, (self.width, self.height))
555 if np.random.rand() <= 0.5: img = cv2.flip(img, 1)
556 if self.bri:
557 img=self.random_brightness(img, binary_mask=binary_mask)
558 if self.contrast:
559 img=self.random_contrast(img, binary_mask=binary_mask)
560 img=img.astype(np.uint8)
561 if self.re:
562 img = self.random_eraser(img, binary_mask=binary_mask)
563 img = self.pad_images(img)
564 img = self.random_crop(img)
565
566 img = img.transpose((2, 0, 1))
567 if not self.vit:
568 img = torch.Tensor(img / 255.)
569 img = self.normalizer(img)
570 else:
571 img = torch.Tensor(img)
572
573 return img
574
575
576class ReidTestAugmentationCV2(object):

Callers

nothing calls this directly

Calls 6

random_brightnessMethod · 0.95
random_contrastMethod · 0.95
random_eraserMethod · 0.95
pad_imagesMethod · 0.95
random_cropMethod · 0.95
resizeMethod · 0.80

Tested by

no test coverage detected