XintongHe commited on
Commit
c759c95
1 Parent(s): a62507a

Update Stomatal_Images_Datasets.py

Browse files
Files changed (1) hide show
  1. Stomatal_Images_Datasets.py +11 -6
Stomatal_Images_Datasets.py CHANGED
@@ -39,10 +39,10 @@ class NewDataset(datasets.GeneratorBasedBuilder):
39
  "scientific_name": datasets.Value("string"),
40
  "image_path": datasets.Value("string"),
41
  "image": datasets.Image(),
42
- "image_resolution": {
43
- "width": datasets.Value("int32"),
44
- "height": datasets.Value("int32"),
45
- },
46
  "annotations": datasets.Sequence({
47
  "category_id": datasets.Value("int32"),
48
  "bounding_box": {
@@ -119,8 +119,11 @@ class NewDataset(datasets.GeneratorBasedBuilder):
119
  if not species_row.empty:
120
  species = species_row['Species'].values[0]
121
  scientific_name = species_row['ScientificName'].values[0]
 
122
  width = species_row['Witdh'].values[0]
123
  height = species_row['Heigth'].values[0]
 
 
124
  else:
125
  # Default values if not found
126
  species = None
@@ -135,9 +138,11 @@ class NewDataset(datasets.GeneratorBasedBuilder):
135
  "image_id": image_id,
136
  "species": species,
137
  "scientific_name": scientific_name,
138
- #"pics_array": pics_array.tolist(), # Convert numpy array to list for JSON serializability
139
  "image_path": image_path,
140
  "image": img,
141
- "image_resolution": {"width": width, "height": height},
 
 
 
142
  "annotations": annotations
143
  }
 
39
  "scientific_name": datasets.Value("string"),
40
  "image_path": datasets.Value("string"),
41
  "image": datasets.Image(),
42
+ "magnification": datasets.Value("int32"),
43
+ "width": datasets.Value("int32"),
44
+ "height": datasets.Value("int32"),
45
+ "resolution": datasets.Value("int32"),
46
  "annotations": datasets.Sequence({
47
  "category_id": datasets.Value("int32"),
48
  "bounding_box": {
 
119
  if not species_row.empty:
120
  species = species_row['Species'].values[0]
121
  scientific_name = species_row['ScientificName'].values[0]
122
+ magnification = species_row['Magnification'].values[0]
123
  width = species_row['Witdh'].values[0]
124
  height = species_row['Heigth'].values[0]
125
+ resolution = species_row['Resolution'].values[0]
126
+
127
  else:
128
  # Default values if not found
129
  species = None
 
138
  "image_id": image_id,
139
  "species": species,
140
  "scientific_name": scientific_name,
 
141
  "image_path": image_path,
142
  "image": img,
143
+ "magnification": magnification
144
+ "width": width,
145
+ "height": height,
146
+ "resolution": resolution,
147
  "annotations": annotations
148
  }