Код: Выделить всё
# Specify root path
root_path = './Datasets_1'
name_class = os.listdir(root_path)
dataset_Path = list(glob.glob(root_path+'/**/*.*'))
labels = list(map(lambda x : os.path.split(os.path.split(x)[0])[1],dataset_Path))
dataset_Path = pd.Series(dataset_Path,name = 'FilePath').astype(str)
labels = pd.Series(labels,name='Label')
data = pd.concat([dataset_Path,labels],axis =1)
data = data.sample(frac=1).reset_index(drop= True)
Подробнее здесь: https://stackoverflow.com/questions/788 ... een-images