Apply Solarization to the PIL image.
| 54 | return img |
| 55 | |
| 56 | class gray_scale(object): |
| 57 | """ |
| 58 | Apply Solarization to the PIL image. |
| 59 | """ |
| 60 | def __init__(self, p=0.2): |
| 61 | self.p = p |
| 62 | self.transf = transforms.Grayscale(3) |
| 63 | |
| 64 | def __call__(self, img): |
| 65 | if random.random() < self.p: |
| 66 | return self.transf(img) |
| 67 | else: |
| 68 | return img |
| 69 | |
| 70 | |
| 71 |
no outgoing calls
no test coverage detected