apal commited on
Commit
8cf7f85
·
1 Parent(s): 0aa8f66

Update SkyScenes.py

Browse files
Files changed (1) hide show
  1. SkyScenes.py +6 -2
SkyScenes.py CHANGED
@@ -89,11 +89,15 @@ class SKYSCENES(datasets.GeneratorBasedBuilder):
89
  # with open(metadata_path, encoding="utf-8") as f:
90
  # files_to_keep = set(f.read().split("\n"))
91
  # print('KEEP',files_to_keep)
92
- for file_path, file_obj in images:
 
 
 
 
93
  # print('FILE',file_path)
94
  # if file_path.startswith(_IMAGES_DIR):
95
  # if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
96
  # label = file_path.split("/")[2]
97
  yield file_path, {
98
- "image": {"path": file_path, "bytes": file_obj.read()},
99
  }
 
89
  # with open(metadata_path, encoding="utf-8") as f:
90
  # files_to_keep = set(f.read().split("\n"))
91
  # print('KEEP',files_to_keep)
92
+ # for file_path, file_obj in images:
93
+ for filename in os.listdir(images):
94
+ filepath = os.path.join(images, filename)
95
+ with open(filepath, "rb") as f:
96
+ image_bytes = f.read()
97
  # print('FILE',file_path)
98
  # if file_path.startswith(_IMAGES_DIR):
99
  # if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
100
  # label = file_path.split("/")[2]
101
  yield file_path, {
102
+ "image": {"path": filepath, "bytes": image_bytes},
103
  }