Datasets:
Tasks:
Image Classification
Sub-tasks:
multi-class-classification
Languages:
English
Multilinguality:
monolingual
Size Categories:
10K<n<100K
Language Creators:
expert-generated
Annotations Creators:
expert-generated
Source Datasets:
extended|imdb
License:
Francisco Castillo
commited on
Commit
•
5006c5a
1
Parent(s):
d3d63f6
wip
Browse files- fashion_mnist_label_drift.py +14 -7
fashion_mnist_label_drift.py
CHANGED
@@ -160,13 +160,20 @@ class FashionMNISTLabelDrift(datasets.GeneratorBasedBuilder):
|
|
160 |
def _generate_examples(self, filepath):
|
161 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
162 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
# csv_reader = csv.reader(csv_file, delimiter='\t')
|
171 |
# for id_, row in enumerate(csv_reader):
|
172 |
# prediction_ts,language,text,ner_tags = row
|
|
|
160 |
def _generate_examples(self, filepath):
|
161 |
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
162 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
163 |
+
with open(filepath, 'rb') as pkl_file:
|
164 |
+
data = pickle.load(pkl_file, encoding='bytes')
|
165 |
+
pred_ts=data['prediction_ts']
|
166 |
+
images=data['image']
|
167 |
+
labels=data['label']
|
168 |
+
for idx, _ in enumerate(images):
|
169 |
+
if id_==0:
|
170 |
+
continue
|
171 |
+
yield id_, {
|
172 |
+
"prediction_ts":pred_ts[idx],
|
173 |
+
"label":labels[idx],
|
174 |
+
"image":images[idx]
|
175 |
+
}
|
176 |
+
# with open(filepath) as csv_file:
|
177 |
# csv_reader = csv.reader(csv_file, delimiter='\t')
|
178 |
# for id_, row in enumerate(csv_reader):
|
179 |
# prediction_ts,language,text,ner_tags = row
|