Update Stomatal_Images_Datasets.py
Browse files
Stomatal_Images_Datasets.py
CHANGED
@@ -39,7 +39,6 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
39 |
"scientific_name": datasets.Value("string"),
|
40 |
"image_path": datasets.Value("string"),
|
41 |
"image": datasets.Image(),
|
42 |
-
# datasets.Array3D(dtype="uint8", shape=(3,768, 1024)), # Assuming images are RGB with shape 768x1024
|
43 |
"image_resolution": {
|
44 |
"width": datasets.Value("int32"),
|
45 |
"height": datasets.Value("int32"),
|
@@ -65,9 +64,8 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
65 |
def _split_generators(self, dl_manager):
|
66 |
|
67 |
data_files = dl_manager.download_and_extract({
|
68 |
-
"csv": "https://huggingface.co/datasets/XintongHe/
|
69 |
-
"zip": "https://huggingface.co/datasets/XintongHe/
|
70 |
-
"annotations_json": "https://huggingface.co/datasets/XintongHe/Populus_Stomatal_Images_Datasets/resolve/main/data/annotations.json"
|
71 |
})
|
72 |
|
73 |
|
@@ -112,7 +110,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
112 |
def _generate_examples(self, filepaths, species_info, data_dir):
|
113 |
"""Yields examples as (key, example) tuples."""
|
114 |
for file_name in filepaths:
|
115 |
-
image_id = os.path.splitext(file_name)[0]
|
116 |
image_path = os.path.join(data_dir, f"{image_id}.jpg")
|
117 |
label_path = os.path.join(data_dir, f"{image_id}.txt")
|
118 |
img = Image.open(image_path)
|
|
|
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"),
|
|
|
64 |
def _split_generators(self, dl_manager):
|
65 |
|
66 |
data_files = dl_manager.download_and_extract({
|
67 |
+
"csv": "https://huggingface.co/datasets/XintongHe/Stomatal_Images_Datasets/resolve/main/data/Labeled Stomatal Images.csv",
|
68 |
+
"zip": "https://huggingface.co/datasets/XintongHe/Stomatal_Images_Datasets/resolve/main/data/Labeled Stomatal Images.zip"
|
|
|
69 |
})
|
70 |
|
71 |
|
|
|
110 |
def _generate_examples(self, filepaths, species_info, data_dir):
|
111 |
"""Yields examples as (key, example) tuples."""
|
112 |
for file_name in filepaths:
|
113 |
+
image_id = os.path.splitext(file_name)[0]
|
114 |
image_path = os.path.join(data_dir, f"{image_id}.jpg")
|
115 |
label_path = os.path.join(data_dir, f"{image_id}.txt")
|
116 |
img = Image.open(image_path)
|