MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / __call__

Method __call__

openrec/preprocess/resize.py:14–26  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

12 self.image_shape = image_shape
13
14 def __call__(self, data):
15 img = data['image']
16 _, h, w = self.image_shape
17 # keep_aspect_ratio = False
18 image_pil = Image.fromarray(np.uint8(img))
19 image = image_pil.resize((w, h), Image.LANCZOS)
20 image = np.array(image)
21 # rgb2gray = False
22 image = image.transpose((2, 0, 1))
23 image = image.astype(np.float32) / 128.0 - 1.0
24 data['image'] = image
25 data['valid_ratio'] = 1
26 return data
27
28
29class ABINetResize(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected