MCPcopy Create free account
hub / github.com/apache/singa / preprocess

Function preprocess

examples/onnx/arcface.py:35–42  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

33
34
35def preprocess(img):
36 w, h = img.size
37 img = img.crop((0, (h - w) // 2, w, h - (h - w) // 2))
38 img = img.resize((112, 112))
39 img = np.array(img).astype(np.float32)
40 img = np.rollaxis(img, 2, 0)
41 img = np.expand_dims(img, axis=0)
42 return img
43
44
45def get_image():

Callers 1

arcface.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected