Convert dataset to Parquet (#1)
Browse files- Convert dataset to Parquet (58be35a0b63b43a8952f20f79d04b4c6f9f1c2c1)
- Delete data file (d76a26091743d51f002e826ad379c79bfbf574c8)
- Delete data file (31a31b35ce66e4a972536a31adb9ab5bf82d10cb)
- Delete loading script (0527717d2eab6213e6a5d92ca4edbc5907caf2f5)
- Delete data file (0204f31e592c7dce37954da86d406581be8c5eb1)
- Delete data file (a88f372faac8c76aac49267491e779a3d9b62ad2)
- Delete data file (b248f46cccbcc254a1fb7ad9a6953d9bf90f4996)
- README.md +12 -4
- emnist-letters-mapping.txt +0 -26
- raw/emnist-letters-train-labels-idx1-ubyte.gz → emnist-letters/test-00000-of-00001.parquet +2 -2
- raw/emnist-letters-train-images-idx3-ubyte.gz → emnist-letters/train-00000-of-00001.parquet +2 -2
- emnist_letters.py +0 -89
- raw/emnist-letters-test-images-idx3-ubyte.gz +0 -3
- raw/emnist-letters-test-labels-idx1-ubyte.gz +0 -3
README.md
CHANGED
@@ -36,13 +36,21 @@ dataset_info:
|
|
36 |
'25': Z
|
37 |
splits:
|
38 |
- name: train
|
39 |
-
num_bytes:
|
40 |
num_examples: 124800
|
41 |
- name: test
|
42 |
-
num_bytes:
|
43 |
num_examples: 20800
|
44 |
-
download_size:
|
45 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
---
|
47 |
|
48 |
# Dataset Card for "emnist-letters"
|
|
|
36 |
'25': Z
|
37 |
splits:
|
38 |
- name: train
|
39 |
+
num_bytes: 52114000.0
|
40 |
num_examples: 124800
|
41 |
- name: test
|
42 |
+
num_bytes: 8689953.0
|
43 |
num_examples: 20800
|
44 |
+
download_size: 58971617
|
45 |
+
dataset_size: 60803953.0
|
46 |
+
configs:
|
47 |
+
- config_name: emnist-letters
|
48 |
+
data_files:
|
49 |
+
- split: train
|
50 |
+
path: emnist-letters/train-*
|
51 |
+
- split: test
|
52 |
+
path: emnist-letters/test-*
|
53 |
+
default: true
|
54 |
---
|
55 |
|
56 |
# Dataset Card for "emnist-letters"
|
emnist-letters-mapping.txt
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
1 65 97
|
2 |
-
2 66 98
|
3 |
-
3 67 99
|
4 |
-
4 68 100
|
5 |
-
5 69 101
|
6 |
-
6 70 102
|
7 |
-
7 71 103
|
8 |
-
8 72 104
|
9 |
-
9 73 105
|
10 |
-
10 74 106
|
11 |
-
11 75 107
|
12 |
-
12 76 108
|
13 |
-
13 77 109
|
14 |
-
14 78 110
|
15 |
-
15 79 111
|
16 |
-
16 80 112
|
17 |
-
17 81 113
|
18 |
-
18 82 114
|
19 |
-
19 83 115
|
20 |
-
20 84 116
|
21 |
-
21 85 117
|
22 |
-
22 86 118
|
23 |
-
23 87 119
|
24 |
-
24 88 120
|
25 |
-
25 89 121
|
26 |
-
26 90 122
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
raw/emnist-letters-train-labels-idx1-ubyte.gz → emnist-letters/test-00000-of-00001.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:76421442e28d4ba81c10016df2713d18105df34169f405e0eb43470e88b5d98e
|
3 |
+
size 8407069
|
raw/emnist-letters-train-images-idx3-ubyte.gz → emnist-letters/train-00000-of-00001.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:756ccd59b40c47fd5a7fc622ed1c34d32576d64edc37aaf9accc89de2bf0bb35
|
3 |
+
size 50564548
|
emnist_letters.py
DELETED
@@ -1,89 +0,0 @@
|
|
1 |
-
import struct
|
2 |
-
|
3 |
-
import numpy as np
|
4 |
-
|
5 |
-
import datasets
|
6 |
-
from datasets.tasks import ImageClassification
|
7 |
-
|
8 |
-
|
9 |
-
_URL = "./raw/"
|
10 |
-
_URLS = {
|
11 |
-
"train_images": "emnist-letters-train-images-idx3-ubyte.gz",
|
12 |
-
"train_labels": "emnist-letters-train-labels-idx1-ubyte.gz",
|
13 |
-
"test_images": "emnist-letters-test-images-idx3-ubyte.gz",
|
14 |
-
"test_labels": "emnist-letters-test-labels-idx1-ubyte.gz",
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
class EMNIST(datasets.GeneratorBasedBuilder):
|
19 |
-
|
20 |
-
BUILDER_CONFIGS = [
|
21 |
-
datasets.BuilderConfig(
|
22 |
-
name="emnist-letters",
|
23 |
-
version=datasets.Version("1.0.0"),
|
24 |
-
)
|
25 |
-
]
|
26 |
-
|
27 |
-
def _info(self):
|
28 |
-
return datasets.DatasetInfo(
|
29 |
-
features=datasets.Features(
|
30 |
-
{
|
31 |
-
"image": datasets.Image(),
|
32 |
-
"label": datasets.features.ClassLabel(
|
33 |
-
names=list(chr(i) for i in range(65, 91))
|
34 |
-
),
|
35 |
-
}
|
36 |
-
),
|
37 |
-
supervised_keys=("image", "label"),
|
38 |
-
task_templates=[
|
39 |
-
ImageClassification(
|
40 |
-
image_column="image",
|
41 |
-
label_column="label",
|
42 |
-
)
|
43 |
-
],
|
44 |
-
)
|
45 |
-
|
46 |
-
def _split_generators(self, dl_manager):
|
47 |
-
urls_to_download = {key: _URL + fname for key, fname in _URLS.items()}
|
48 |
-
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
49 |
-
return [
|
50 |
-
datasets.SplitGenerator(
|
51 |
-
name=datasets.Split.TRAIN,
|
52 |
-
gen_kwargs={
|
53 |
-
"filepath": (
|
54 |
-
downloaded_files["train_images"],
|
55 |
-
downloaded_files["train_labels"],
|
56 |
-
),
|
57 |
-
"split": "train",
|
58 |
-
},
|
59 |
-
),
|
60 |
-
datasets.SplitGenerator(
|
61 |
-
name=datasets.Split.TEST,
|
62 |
-
gen_kwargs={
|
63 |
-
"filepath": (
|
64 |
-
downloaded_files["test_images"],
|
65 |
-
downloaded_files["test_labels"],
|
66 |
-
),
|
67 |
-
"split": "test",
|
68 |
-
},
|
69 |
-
),
|
70 |
-
]
|
71 |
-
|
72 |
-
def _generate_examples(self, filepath, split):
|
73 |
-
"""This function returns the examples in the raw form."""
|
74 |
-
# Images
|
75 |
-
with open(filepath[0], "rb") as f:
|
76 |
-
# First 16 bytes contain some metadata
|
77 |
-
_ = f.read(4)
|
78 |
-
size = struct.unpack(">I", f.read(4))[0]
|
79 |
-
_ = f.read(8)
|
80 |
-
images = np.frombuffer(f.read(), dtype=np.uint8).reshape(size, 28, 28)
|
81 |
-
|
82 |
-
# Labels
|
83 |
-
with open(filepath[1], "rb") as f:
|
84 |
-
# First 8 bytes contain some metadata
|
85 |
-
_ = f.read(8)
|
86 |
-
labels = np.frombuffer(f.read(), dtype=np.uint8) - 1
|
87 |
-
|
88 |
-
for idx in range(size):
|
89 |
-
yield idx, {"image": images[idx], "label": str(labels[idx])}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
raw/emnist-letters-test-images-idx3-ubyte.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:201c0a59fa093429287ae63a69d551fc68e07848e076d7c75b14e99d21985c4f
|
3 |
-
size 5105171
|
|
|
|
|
|
|
|
raw/emnist-letters-test-labels-idx1-ubyte.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:6c27a54187ec374e126764d8a67d8db4584829e07dcec40ed9da015112fb3866
|
3 |
-
size 144
|
|
|
|
|
|
|
|