Update RDD_2020.py
Browse files- RDD_2020.py +31 -30
RDD_2020.py
CHANGED
@@ -61,7 +61,7 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
|
|
61 |
"depth": datasets.Value("int32"),
|
62 |
}),
|
63 |
"image_path": datasets.Value("string"),
|
64 |
-
"pics_array": datasets.Array3D(shape=(None, None, 3), dtype="uint8"),
|
65 |
"crack_type": datasets.Sequence(datasets.Value("string")),
|
66 |
"crack_coordinates": datasets.Sequence(datasets.Features({
|
67 |
"x_min": datasets.Value("int32"),
|
@@ -75,35 +75,36 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
|
|
75 |
)
|
76 |
|
77 |
def _split_generators(self, dl_manager):
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
107 |
|
108 |
def _generate_examples(self, images_dir, annotations_dir, split):
|
109 |
"""Yields examples as (key, example) tuples."""
|
|
|
61 |
"depth": datasets.Value("int32"),
|
62 |
}),
|
63 |
"image_path": datasets.Value("string"),
|
64 |
+
#"pics_array": datasets.Array3D(shape=(None, None, 3), dtype="uint8"),
|
65 |
"crack_type": datasets.Sequence(datasets.Value("string")),
|
66 |
"crack_coordinates": datasets.Sequence(datasets.Features({
|
67 |
"x_min": datasets.Value("int32"),
|
|
|
75 |
)
|
76 |
|
77 |
def _split_generators(self, dl_manager):
|
78 |
+
"""This method downloads/extracts the data and defines the splits."""
|
79 |
+
data_dir = dl_manager.download_and_extract(_URLS["dataset"])
|
80 |
+
|
81 |
+
return [
|
82 |
+
datasets.SplitGenerator(
|
83 |
+
name=datasets.Split.TRAIN,
|
84 |
+
gen_kwargs={
|
85 |
+
"images_dir": os.path.join(data_dir, "train"),
|
86 |
+
"annotations_dir": os.path.join(data_dir, "train", "annotations"),
|
87 |
+
"split": "train",
|
88 |
+
},
|
89 |
+
),
|
90 |
+
datasets.SplitGenerator(
|
91 |
+
name="test1", # Unique name for the first test split
|
92 |
+
gen_kwargs={
|
93 |
+
"images_dir": os.path.join(data_dir, "test1"),
|
94 |
+
"annotations_dir": os.path.join(data_dir, "test1", "annotations"),
|
95 |
+
"split": "test1",
|
96 |
+
},
|
97 |
+
),
|
98 |
+
datasets.SplitGenerator(
|
99 |
+
name="test2", # Unique name for the second test split
|
100 |
+
gen_kwargs={
|
101 |
+
"images_dir": os.path.join(data_dir, "test2"),
|
102 |
+
"annotations_dir": os.path.join(data_dir, "test2", "annotations"),
|
103 |
+
"split": "test2",
|
104 |
+
},
|
105 |
+
),
|
106 |
+
]
|
107 |
+
|
108 |
|
109 |
def _generate_examples(self, images_dir, annotations_dir, split):
|
110 |
"""Yields examples as (key, example) tuples."""
|