I'm using a very naive way to make predictions based on pre-trained model in keras. But it becomes much slower later. Anyone knows why? I'm very very very new to tensorflow.
count = 0
first = True
for nm in image_names:
    img = image.load_img(TEST_PATH + nm, target_size=(299, 299))
    img = image.img_to_array(img)
    image_batch = np.expand_dims(img, axis=0)
    processed_image = inception_v3.preprocess_input(image_batch.copy())
    prob = inception_model.predict(processed_image)
    df1 = pd.DataFrame({'photo_id': [nm]})
    df2 = pd.DataFrame(prob, columns=['feat' + str(j + 1) for j in range(prob.shape[1])])
    df = pd.concat([df1, df2], axis=1)
    header = first
    mode = 'w' if first else 'a'
    df.to_csv(outfile, index=False, header=header, mode=mode)
    first = False
    count += 1
    if count % 100 == 0:
        print('%d processed' % count)