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

Function load_img

python/singa/image_tool.py:41–48  ·  view source on GitHub ↗

Read the image from a give path

(path, grayscale=False)

Source from the content-addressed store, hash-verified

39
40
41def load_img(path, grayscale=False):
42 '''Read the image from a give path'''
43 img = Image.open(path)
44 if grayscale:
45 img = img.convert('L')
46 else: # Ensure 3 channel even when loaded image is grayscale
47 img = img.convert('RGB')
48 return img
49
50
51def crop(img, patch, position):

Callers 1

loadMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected