XintongHe commited on
Commit
e786d5d
·
verified ·
1 Parent(s): 478110a

Update Populus_Stomatal_Images_Datasets.py

Browse files
Populus_Stomatal_Images_Datasets.py CHANGED
@@ -85,7 +85,8 @@ class NewDataset(datasets.GeneratorBasedBuilder):
85
  "image_id": datasets.Value("string"),
86
  "species": datasets.Value("string"),
87
  "scientific_name": datasets.Value("string"),
88
- "pics_array": datasets.Array3D(dtype="uint8", shape=(3,768, 1024)), # Assuming images are RGB with shape 768x1024
 
89
  "image_resolution": {
90
  "width": datasets.Value("int32"),
91
  "height": datasets.Value("int32"),
@@ -179,8 +180,9 @@ class NewDataset(datasets.GeneratorBasedBuilder):
179
 
180
  pics_array = None
181
  with Image.open(image_path) as img:
182
- pics_array = np.array(img) # Convert the PIL image to a numpy array and then to a list
183
-
 
184
  annotations = self._parse_yolo_labels(label_path, width, height)
185
 
186
  # Yield the dataset example
 
85
  "image_id": datasets.Value("string"),
86
  "species": datasets.Value("string"),
87
  "scientific_name": datasets.Value("string"),
88
+ "pics_array": datasets.Image()
89
+ # datasets.Array3D(dtype="uint8", shape=(3,768, 1024)), # Assuming images are RGB with shape 768x1024
90
  "image_resolution": {
91
  "width": datasets.Value("int32"),
92
  "height": datasets.Value("int32"),
 
180
 
181
  pics_array = None
182
  with Image.open(image_path) as img:
183
+ pics_array = np.array(img)# Convert the PIL image to a numpy array and then to a list
184
+ print(pics_array.shape)
185
+
186
  annotations = self._parse_yolo_labels(label_path, width, height)
187
 
188
  # Yield the dataset example