Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir
- from os.path import isfile, join
- images_directory = './flower_data/flower_data_flat'
- # read names of all image files
- image_files = [f for f in listdir(image_dir) if isfile(join(image_dir, f))]
- # we create a data frame with the image names and dummy labels - label_1, label_2
- data = pd.DataFrame(list(zip(image_files,
- list(range(len(image_files))),
- list(range(len(image_files))))),
- columns=['image_filename', 'label_1', 'label_2'])
- processed_data_file = 'flower_dummy_data.ssv'
- data.to_csv(processed_data_file, index=False, header=False, sep=' ')
- print(data.head())
- # image_filename label_1 label_2
- # 0 image_05973.jpg 0 0
- # 1 image_00956.jpg 1 1
- # 2 image_06047.jpg 2 2
- # 3 image_07168.jpg 3 3
- # 4 image_04466.jpg 4 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement