我对Python还是很陌生,我正在尝试使图像显示在输出的网格中,以便更好地查看群集。它当前显示为列表。
for i in range(0, max(km.labels_)+1):
print(" ")
print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
print("Images in cluster " + str(i))
print("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
for j in range(0, len(km.labels_)):
if km.labels_[j] == i:
from IPython.display import Image, display, HTML
from glob import glob
images = Image(filename='/Users/Name/Desktop/img_small/'+ str(j+2) +'_small.jpg', width=40, height=40, unconfined=True)
display(images)
我希望它显示为网格。