text_plain_output_1.png
from keras.applications.xception import Xception, preprocess_input, decode_predictions

from skimage.io import imread_collection, imread

import numpy as np

import numpy as np

import os

path = '../input/pneumoniamulti/pneumonia-multi2/'
image_names = os.listdir(path)
gray_images = [imread(path + str(name) + '') for name in image_names]

images = np.zeros((len(gray_images), gray_images[0].shape[0], gray_images[0].shape[1], 3))
for i, im in enumerate(gray_images):
    for j in range(3):
        images[i, :, :, j] = im

pretrained = Xception(weights='imagenet', include_top=False, pooling='avg')

pretrained.summary()

x = preprocess_input(images)
features = pretrained.predict(x)

features