| 72 | return jpeg_coding_cv2(image_rgb=image_rgb.cpu(), jpeg_quality=jpeg_quality).squeeze(0).cuda() / 255 |
| 73 | |
| 74 | class CropAttack(nn.Module): |
| 75 | def __init__(self): |
| 76 | super().__init__() |
| 77 | self.scale = 0.4 |
| 78 | |
| 79 | def forward(self, image): |
| 80 | cw, ch = [int(self.scale * x) for x in image.shape[-2:]] |
| 81 | cropped_img = F.center_crop(image, (cw, ch)) |
| 82 | return cropped_img |
| 83 | |
| 84 | class RotationAttack(nn.Module): |
| 85 | def __init__(self): |
nothing calls this directly
no outgoing calls
no test coverage detected