(self, img, binary_mask=None)
| 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 | |
| 576 | class ReidTestAugmentationCV2(object): |
nothing calls this directly
no test coverage detected