MCPcopy Create free account
hub / github.com/NarcissusEx/GuardSplat / CropAttack

Class CropAttack

attack_utils.py:74–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 return jpeg_coding_cv2(image_rgb=image_rgb.cpu(), jpeg_quality=jpeg_quality).squeeze(0).cuda() / 255
73
74class 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
84class RotationAttack(nn.Module):
85 def __init__(self):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected