MCPcopy Create free account
hub / github.com/VisionRush/DeepFakeDefenders / __call__

Method __call__

toolkit/dtransform.py:16–22  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

14 self.p = p
15
16 def __call__(self, img):
17 if np.random.rand() < self.p:
18 img_np = np.array(img)
19 _, buffer = cv2.imencode('.jpg', img_np[:, :, ::-1], [int(cv2.IMWRITE_JPEG_QUALITY), self.quality])
20 jpeg_img = cv2.imdecode(buffer, 1)
21 return Image.fromarray(jpeg_img[:, :, ::-1])
22 return img
23
24
25# 原始数据增强

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected