Update test.py
Browse files
test.py
CHANGED
|
@@ -110,21 +110,21 @@ class imgdataset(datasets.GeneratorBasedBuilder):
|
|
| 110 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 111 |
print("4")
|
| 112 |
with open(filepath, encoding="utf-8") as f:
|
| 113 |
-
data = csv.
|
| 114 |
key = 0
|
| 115 |
for row in data:
|
| 116 |
|
| 117 |
print(row)
|
| 118 |
if self.config.name == "train":
|
| 119 |
yield key, {
|
| 120 |
-
"Class_name": row[
|
| 121 |
-
"file_name": row[
|
| 122 |
-
"file_id": row[
|
| 123 |
}
|
| 124 |
else:
|
| 125 |
yield key, {
|
| 126 |
-
"Class_name": row[
|
| 127 |
-
"file_name": row[
|
| 128 |
-
"file_id": row[
|
| 129 |
}
|
| 130 |
key +=1
|
|
|
|
| 110 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 111 |
print("4")
|
| 112 |
with open(filepath, encoding="utf-8") as f:
|
| 113 |
+
data = csv.DictReader(f)
|
| 114 |
key = 0
|
| 115 |
for row in data:
|
| 116 |
|
| 117 |
print(row)
|
| 118 |
if self.config.name == "train":
|
| 119 |
yield key, {
|
| 120 |
+
"Class_name": row['Class_name'],
|
| 121 |
+
"file_name": row['file_name'],
|
| 122 |
+
"file_id": row['file_id']
|
| 123 |
}
|
| 124 |
else:
|
| 125 |
yield key, {
|
| 126 |
+
"Class_name": row['Class_name'],
|
| 127 |
+
"file_name": row['file_name'],
|
| 128 |
+
"file_id": row['file_id']
|
| 129 |
}
|
| 130 |
key +=1
|