Ejemplo n.º 1
0
def preprocess_image(image_path):
    """
    Loads an image into a Numpy array

    Args:
        image_path: Path or file object.

    Returns:
        Numpy array
    """
    logging.debug('Processing: %s', image_path)
    img = crop2square(image.load_img(image_path)).resize((224, 224))
    x = image.img_to_array(img)
    x = np.expand_dims(x, axis=0)
    x = deepseenet_risk_factor.preprocess_input(x)
    return x
def preprocess_image(image_path, target_size=(224, 224)):
    """
    Loads an image into a Numpy array

    Args:
        image_path: Path or file object.
        model_name: only 'inceptionv3' supported
        target_size: 224x224 by default

    Returns:
        Numpy array
    """
    logging.info('Processing: %s', image_path)
    img = crop2square(image.load_img(image_path)).resize(target_size)
    x = image.img_to_array(img)
    x = np.expand_dims(x, axis=0)
    return x
Ejemplo n.º 3
0
def preprocess_image(image_path):
    img = crop2square(image.load_img(image_path)).resize((224, 224))
    x = image.img_to_array(img)
    x = np.expand_dims(x, axis=0)
    x = deepseenet_risk_factor.preprocess_input(x)
    return x