Exemple #1
0
def load_image(path, image_size):
    image = Image.open(path).resize(image_size)
    x = np.asarray(image, dtype=np.float32)
    return VGG19.preprocess(x, input_type='RGB')
Exemple #2
0
def preprocess_image(image, image_size, clip_rect=None):
    if clip_rect is not None:
        image = image.crop(clip_rect)
    image = image.resize(image_size, Image.BILINEAR)
    x = np.asarray(image, dtype=np.float32)
    return VGG19.preprocess(x, input_type='RGB')
Exemple #3
0
def preprocess_image(image, image_size):
    image = image.resize(image_size, Image.BILINEAR)
    x = np.asarray(image, dtype=np.float32)
    return VGG19.preprocess(x, input_type='RGB')