Я дал ему немного времени и понял:
пройти через каждое имя файла в файле CSV
import pandas as pd
dff = pd.read_csv(path, index_col="Column_with_all_filenames")
получить доступ к файлу из местоположения PATH
for img_name, Class in dff.iterrows():
if(".png" in img_name): #Check is the name is that of a PNG file
if(find(img_name, path) ): #Check if the file was found in the path
im=test_img_dir+'/'+img_name #Modify the path of the
print(im)
im = image.imread(im)
#Make Predictions
сохранить прогнозируемый класс в другом столбце в строке изображения
#Create a list of the [filename--Prediction]
listof_rows.append([file_name, prediction])
#After all the files have been processed...
df=pd.DataFrame(listof_rows, columns=['Image_File', 'Class'])
df.to_csv('Result1.csv', index=False)