In [17]:
import matplotlib.pyplot as plt # plt 用于显示图片
import matplotlib.image as mpimg # mpimg 用于读取图片
import numpy as np
import pandas as pd
In [32]:
data = pd.read_excel('/home/jeffmxh/IMG_Inception/high_end.xlsx')
In [30]:
def img_output(index, data_frame):
class_count = data_frame.groupby('prediction').size().sort_values(ascending = False)
img_type = class_count.index[index]
print(img_type)
data_frame = data_frame[data_frame['prediction']==img_type]
img_url = data_frame['image_url'].tolist()
# print(img_url)
for url in img_url:
img = mpimg.imread(url)
img.shape
plt.imshow(img) # 显示图片
plt.axis('off') # 不显示坐标轴
plt.show()
In [ ]:
img_output(0, data)