MCPcopy Create free account
hub / github.com/ali-vilab/ACE_plus / image_check

Method image_check

inference/utils.py:34–43  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

32 ])
33
34 def image_check(self, image):
35 if image is None:
36 return image
37 # preprocess
38 W, H = image.size
39 if H / W > self.max_aspect_ratio:
40 image = T.CenterCrop([int(self.max_aspect_ratio * W), W])(image)
41 elif W / H > self.max_aspect_ratio:
42 image = T.CenterCrop([H, int(self.max_aspect_ratio * H)])(image)
43 return self.transforms(image)
44
45
46 def preprocess(self,

Callers 1

preprocessMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected