XintongHe commited on
Commit
80d0a83
1 Parent(s): 6339f17

Update Populus_Stomatal_Images_Datasets.py

Browse files
Populus_Stomatal_Images_Datasets.py CHANGED
@@ -225,9 +225,9 @@ class NewDataset(datasets.GeneratorBasedBuilder):
225
  width = 1024 # Default value
226
  height = 768 # Default value
227
 
228
- pics_array = None
229
- with Image.open(image_path) as img:
230
- pics_array = np.array(img) # Convert the PIL image to a numpy array
231
 
232
  # Retrieve annotations for the current image from the dictionary
233
  annotations = annotations_dict.get(image_id, [])
@@ -237,7 +237,8 @@ class NewDataset(datasets.GeneratorBasedBuilder):
237
  "image_id": image_id,
238
  "species": species,
239
  "scientific_name": scientific_name,
240
- "pics_array": pics_array.tolist(), # Convert numpy array to list for JSON serializability
 
241
  "image_resolution": {"width": width, "height": height},
242
  "annotations": annotations
243
  }
 
225
  width = 1024 # Default value
226
  height = 768 # Default value
227
 
228
+ # pics_array = None
229
+ # with Image.open(image_path) as img:
230
+ # pics_array = np.array(img) # Convert the PIL image to a numpy array
231
 
232
  # Retrieve annotations for the current image from the dictionary
233
  annotations = annotations_dict.get(image_id, [])
 
237
  "image_id": image_id,
238
  "species": species,
239
  "scientific_name": scientific_name,
240
+ #"pics_array": pics_array.tolist(), # Convert numpy array to list for JSON serializability
241
+ "image_path": image_path,
242
  "image_resolution": {"width": width, "height": height},
243
  "annotations": annotations
244
  }