| 730 | self.saturation = saturation |
| 731 | |
| 732 | def __call__(self, results): |
| 733 | brightness_factor = random.uniform(0, self.brightness) |
| 734 | contrast_factor = random.uniform(0, self.contrast) |
| 735 | saturation_factor = random.uniform(0, self.saturation) |
| 736 | color_jitter_transforms = [ |
| 737 | dict(type='Brightness', |
| 738 | magnitude=brightness_factor, |
| 739 | prob=1., |
| 740 | random_negative_prob=0.5), |
| 741 | dict(type='Contrast', |
| 742 | magnitude=contrast_factor, |
| 743 | prob=1., |
| 744 | random_negative_prob=0.5), |
| 745 | dict(type='ColorTransform', |
| 746 | magnitude=saturation_factor, |
| 747 | prob=1., |
| 748 | random_negative_prob=0.5) |
| 749 | ] |
| 750 | random.shuffle(color_jitter_transforms) |
| 751 | transform = Compose(color_jitter_transforms) |
| 752 | return transform(results) |
| 753 | |
| 754 | def __repr__(self): |
| 755 | repr_str = self.__class__.__name__ |