Apply Solarization to the PIL image.
| 61 | return img |
| 62 | |
| 63 | class gray_scale(object): |
| 64 | """ |
| 65 | Apply Solarization to the PIL image. |
| 66 | """ |
| 67 | def __init__(self, p=0.2): |
| 68 | self.p = p |
| 69 | self.transf = transforms.Grayscale(3) |
| 70 | |
| 71 | def __call__(self, img): |
| 72 | if random.random() < self.p: |
| 73 | return self.transf(img) |
| 74 | else: |
| 75 | return img |
| 76 | |
| 77 | |
| 78 |
no outgoing calls
no test coverage detected