Update test.py
Browse files
test.py
CHANGED
|
@@ -114,14 +114,16 @@ class imgdataset(datasets.GeneratorBasedBuilder):
|
|
| 114 |
urllib.request.urlretrieve(url, path)
|
| 115 |
|
| 116 |
def _generate_examples(self, filepath, split):
|
|
|
|
| 117 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 118 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 119 |
print("4")
|
| 120 |
with open(filepath, encoding="utf-8") as f:
|
| 121 |
data = csv.reader(f)
|
|
|
|
| 122 |
for row in data:
|
|
|
|
| 123 |
print(row)
|
| 124 |
-
print(f'sadasd{key}')
|
| 125 |
if self.config.name == "train":
|
| 126 |
yield key, {
|
| 127 |
"Class_name": row[0],
|
|
@@ -134,4 +136,5 @@ class imgdataset(datasets.GeneratorBasedBuilder):
|
|
| 134 |
"file_name": row[1],
|
| 135 |
"file_id": row[2]
|
| 136 |
}
|
|
|
|
| 137 |
|
|
|
|
| 114 |
urllib.request.urlretrieve(url, path)
|
| 115 |
|
| 116 |
def _generate_examples(self, filepath, split):
|
| 117 |
+
|
| 118 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 119 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 120 |
print("4")
|
| 121 |
with open(filepath, encoding="utf-8") as f:
|
| 122 |
data = csv.reader(f)
|
| 123 |
+
key = 0
|
| 124 |
for row in data:
|
| 125 |
+
|
| 126 |
print(row)
|
|
|
|
| 127 |
if self.config.name == "train":
|
| 128 |
yield key, {
|
| 129 |
"Class_name": row[0],
|
|
|
|
| 136 |
"file_name": row[1],
|
| 137 |
"file_id": row[2]
|
| 138 |
}
|
| 139 |
+
key +=1
|
| 140 |
|