Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. from os import listdir
  2. from os.path import isfile, join
  3.  
  4. images_directory = './flower_data/flower_data_flat'
  5. # read names of all image files
  6. image_files = [f for f in listdir(image_dir) if isfile(join(image_dir, f))]
  7.  
  8. # we create a data frame with the image names and dummy labels - label_1, label_2
  9. data = pd.DataFrame(list(zip(image_files,
  10. list(range(len(image_files))),
  11. list(range(len(image_files))))),
  12. columns=['image_filename', 'label_1', 'label_2'])
  13.  
  14. processed_data_file = 'flower_dummy_data.ssv'
  15. data.to_csv(processed_data_file, index=False, header=False, sep=' ')
  16.  
  17. print(data.head())
  18. # image_filename label_1 label_2
  19. # 0 image_05973.jpg 0 0
  20. # 1 image_00956.jpg 1 1
  21. # 2 image_06047.jpg 2 2
  22. # 3 image_07168.jpg 3 3
  23. # 4 image_04466.jpg 4 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement