Santiago Hincapie-Potes
commited on
Commit
•
b333b72
1
Parent(s):
c5689b8
fix: image relative path
Browse files
bosch-small-traffic-lights-dataset.py
CHANGED
@@ -43,8 +43,8 @@ the color distribution may seem unusual.
|
|
43 |
_HOMEPAGE = "https://hci.iwr.uni-heidelberg.de/content/bosch-small-traffic-lights-dataset"
|
44 |
_LICENSE = "non-commercial use only"
|
45 |
_URL = {
|
46 |
-
"train": "
|
47 |
-
"test": "
|
48 |
}
|
49 |
|
50 |
class BoschSmallTrafficLights(datasets.GeneratorBasedBuilder):
|
@@ -76,28 +76,34 @@ class BoschSmallTrafficLights(datasets.GeneratorBasedBuilder):
|
|
76 |
def _split_generators(self, dl_manager):
|
77 |
urls = _URL
|
78 |
data_dir = dl_manager.download_and_extract(urls)
|
|
|
|
|
79 |
return [
|
80 |
datasets.SplitGenerator(
|
81 |
name=datasets.Split.TRAIN,
|
82 |
# These kwargs will be passed to _generate_examples
|
83 |
gen_kwargs={
|
84 |
-
"
|
|
|
85 |
},
|
86 |
),
|
87 |
datasets.SplitGenerator(
|
88 |
name=datasets.Split.TEST,
|
89 |
# These kwargs will be passed to _generate_examples
|
90 |
gen_kwargs={
|
91 |
-
"
|
|
|
92 |
},
|
93 |
),
|
94 |
]
|
95 |
|
96 |
-
def _generate_examples(self, filepath):
|
|
|
|
|
97 |
with open(filepath, encoding="utf-8") as f:
|
98 |
data = yaml.load(f, Loader=yaml.FullLoader)
|
99 |
for key, row in enumerate(data):
|
100 |
yield key, {
|
101 |
-
"img": os.path.
|
102 |
"boxes": row["boxes"]
|
103 |
}
|
|
|
43 |
_HOMEPAGE = "https://hci.iwr.uni-heidelberg.de/content/bosch-small-traffic-lights-dataset"
|
44 |
_LICENSE = "non-commercial use only"
|
45 |
_URL = {
|
46 |
+
"train": "train.tar.gz",
|
47 |
+
"test": "test.tar.gz",
|
48 |
}
|
49 |
|
50 |
class BoschSmallTrafficLights(datasets.GeneratorBasedBuilder):
|
|
|
76 |
def _split_generators(self, dl_manager):
|
77 |
urls = _URL
|
78 |
data_dir = dl_manager.download_and_extract(urls)
|
79 |
+
print(data_dir)
|
80 |
+
|
81 |
return [
|
82 |
datasets.SplitGenerator(
|
83 |
name=datasets.Split.TRAIN,
|
84 |
# These kwargs will be passed to _generate_examples
|
85 |
gen_kwargs={
|
86 |
+
"root_dir": data_dir["train"],
|
87 |
+
"filepath": "train.yaml",
|
88 |
},
|
89 |
),
|
90 |
datasets.SplitGenerator(
|
91 |
name=datasets.Split.TEST,
|
92 |
# These kwargs will be passed to _generate_examples
|
93 |
gen_kwargs={
|
94 |
+
"root_dir": data_dir["test"],
|
95 |
+
"filepath": "test.yaml",
|
96 |
},
|
97 |
),
|
98 |
]
|
99 |
|
100 |
+
def _generate_examples(self, root_dir, filepath):
|
101 |
+
filepath = os.path.join(root_dir, filepath)
|
102 |
+
|
103 |
with open(filepath, encoding="utf-8") as f:
|
104 |
data = yaml.load(f, Loader=yaml.FullLoader)
|
105 |
for key, row in enumerate(data):
|
106 |
yield key, {
|
107 |
+
"img": os.path.join(root_dir, row["path"]),
|
108 |
"boxes": row["boxes"]
|
109 |
}
|