parquet-converter
commited on
Commit
•
047cd55
1
Parent(s):
525a71c
Update parquet files
Browse files- README.md +0 -272
- cropped_digits/svhn-extra-00000-of-00002.parquet +3 -0
- cropped_digits/svhn-extra-00001-of-00002.parquet +3 -0
- cropped_digits/svhn-test.parquet +3 -0
- cropped_digits/svhn-train.parquet +3 -0
- dataset_infos.json +0 -1
- full_numbers/svhn-extra-00000-of-00004.parquet +3 -0
- full_numbers/svhn-extra-00001-of-00004.parquet +3 -0
- full_numbers/svhn-extra-00002-of-00004.parquet +3 -0
- full_numbers/svhn-extra-00003-of-00004.parquet +3 -0
- full_numbers/svhn-test.parquet +3 -0
- full_numbers/svhn-train.parquet +3 -0
- svhn.py +0 -199
README.md
DELETED
@@ -1,272 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- machine-generated
|
4 |
-
- expert-generated
|
5 |
-
language_creators:
|
6 |
-
- machine-generated
|
7 |
-
language:
|
8 |
-
- en
|
9 |
-
license:
|
10 |
-
- other
|
11 |
-
multilinguality:
|
12 |
-
- monolingual
|
13 |
-
size_categories:
|
14 |
-
- 100K<n<1M
|
15 |
-
source_datasets:
|
16 |
-
- original
|
17 |
-
task_categories:
|
18 |
-
- image-classification
|
19 |
-
- object-detection
|
20 |
-
task_ids: []
|
21 |
-
paperswithcode_id: svhn
|
22 |
-
pretty_name: Street View House Numbers
|
23 |
-
dataset_info:
|
24 |
-
- config_name: full_numbers
|
25 |
-
features:
|
26 |
-
- name: image
|
27 |
-
dtype: image
|
28 |
-
- name: digits
|
29 |
-
sequence:
|
30 |
-
- name: bbox
|
31 |
-
sequence: int32
|
32 |
-
length: 4
|
33 |
-
- name: label
|
34 |
-
dtype:
|
35 |
-
class_label:
|
36 |
-
names:
|
37 |
-
0: '0'
|
38 |
-
1: '1'
|
39 |
-
2: '2'
|
40 |
-
3: '3'
|
41 |
-
4: '4'
|
42 |
-
5: '5'
|
43 |
-
6: '6'
|
44 |
-
7: '7'
|
45 |
-
8: '8'
|
46 |
-
9: '9'
|
47 |
-
splits:
|
48 |
-
- name: train
|
49 |
-
num_bytes: 390404309
|
50 |
-
num_examples: 33402
|
51 |
-
- name: test
|
52 |
-
num_bytes: 271503052
|
53 |
-
num_examples: 13068
|
54 |
-
- name: extra
|
55 |
-
num_bytes: 1868720340
|
56 |
-
num_examples: 202353
|
57 |
-
download_size: 2636187279
|
58 |
-
dataset_size: 2530627701
|
59 |
-
- config_name: cropped_digits
|
60 |
-
features:
|
61 |
-
- name: image
|
62 |
-
dtype: image
|
63 |
-
- name: label
|
64 |
-
dtype:
|
65 |
-
class_label:
|
66 |
-
names:
|
67 |
-
0: '0'
|
68 |
-
1: '1'
|
69 |
-
2: '2'
|
70 |
-
3: '3'
|
71 |
-
4: '4'
|
72 |
-
5: '5'
|
73 |
-
6: '6'
|
74 |
-
7: '7'
|
75 |
-
8: '8'
|
76 |
-
9: '9'
|
77 |
-
splits:
|
78 |
-
- name: train
|
79 |
-
num_bytes: 128364360
|
80 |
-
num_examples: 73257
|
81 |
-
- name: test
|
82 |
-
num_bytes: 44464040
|
83 |
-
num_examples: 26032
|
84 |
-
- name: extra
|
85 |
-
num_bytes: 967853504
|
86 |
-
num_examples: 531131
|
87 |
-
download_size: 1575594780
|
88 |
-
dataset_size: 1140681904
|
89 |
-
---
|
90 |
-
|
91 |
-
# Dataset Card for Street View House Numbers
|
92 |
-
|
93 |
-
## Table of Contents
|
94 |
-
- [Table of Contents](#table-of-contents)
|
95 |
-
- [Dataset Description](#dataset-description)
|
96 |
-
- [Dataset Summary](#dataset-summary)
|
97 |
-
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
98 |
-
- [Languages](#languages)
|
99 |
-
- [Dataset Structure](#dataset-structure)
|
100 |
-
- [Data Instances](#data-instances)
|
101 |
-
- [Data Fields](#data-fields)
|
102 |
-
- [Data Splits](#data-splits)
|
103 |
-
- [Dataset Creation](#dataset-creation)
|
104 |
-
- [Curation Rationale](#curation-rationale)
|
105 |
-
- [Source Data](#source-data)
|
106 |
-
- [Annotations](#annotations)
|
107 |
-
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
108 |
-
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
109 |
-
- [Social Impact of Dataset](#social-impact-of-dataset)
|
110 |
-
- [Discussion of Biases](#discussion-of-biases)
|
111 |
-
- [Other Known Limitations](#other-known-limitations)
|
112 |
-
- [Additional Information](#additional-information)
|
113 |
-
- [Dataset Curators](#dataset-curators)
|
114 |
-
- [Licensing Information](#licensing-information)
|
115 |
-
- [Citation Information](#citation-information)
|
116 |
-
- [Contributions](#contributions)
|
117 |
-
|
118 |
-
## Dataset Description
|
119 |
-
|
120 |
-
- **Homepage:** http://ufldl.stanford.edu/housenumbers
|
121 |
-
- **Repository:**
|
122 |
-
- **Paper:** [Reading Digits in Natural Images with Unsupervised Feature Learning](http://ufldl.stanford.edu/housenumbers/nips2011_housenumbers.pdf)
|
123 |
-
- **Leaderboard:** https://paperswithcode.com/sota/image-classification-on-svhn
|
124 |
-
- **Point of Contact:** streetviewhousenumbers@gmail.com
|
125 |
-
|
126 |
-
### Dataset Summary
|
127 |
-
|
128 |
-
SVHN is a real-world image dataset for developing machine learning and object recognition algorithms with minimal requirement on data preprocessing and formatting. It can be seen as similar in flavor to MNIST (e.g., the images are of small cropped digits), but incorporates an order of magnitude more labeled data (over 600,000 digit images) and comes from a significantly harder, unsolved, real world problem (recognizing digits and numbers in natural scene images). SVHN is obtained from house numbers in Google Street View images. The dataset comes in two formats:
|
129 |
-
1. Original images with character level bounding boxes.
|
130 |
-
2. MNIST-like 32-by-32 images centered around a single character (many of the images do contain some distractors at the sides).
|
131 |
-
|
132 |
-
### Supported Tasks and Leaderboards
|
133 |
-
|
134 |
-
- `object-detection`: The dataset can be used to train a model for digit detection.
|
135 |
-
- `image-classification`: The dataset can be used to train a model for Image Classification where the task is to predict a correct digit on the image. The leaderboard for this task is available at:
|
136 |
-
https://paperswithcode.com/sota/image-classification-on-svhn
|
137 |
-
|
138 |
-
### Languages
|
139 |
-
|
140 |
-
English
|
141 |
-
|
142 |
-
## Dataset Structure
|
143 |
-
|
144 |
-
### Data Instances
|
145 |
-
|
146 |
-
#### full_numbers
|
147 |
-
|
148 |
-
The original, variable-resolution, color house-number images with character level bounding boxes.
|
149 |
-
|
150 |
-
```
|
151 |
-
{
|
152 |
-
'image': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=98x48 at 0x259E3F01780>,
|
153 |
-
'digits': {
|
154 |
-
'bbox': [
|
155 |
-
[36, 7, 13, 32],
|
156 |
-
[50, 7, 12, 32]
|
157 |
-
],
|
158 |
-
'label': [6, 9]
|
159 |
-
}
|
160 |
-
}
|
161 |
-
```
|
162 |
-
|
163 |
-
#### cropped_digits
|
164 |
-
|
165 |
-
Character level ground truth in an MNIST-like format. All digits have been resized to a fixed resolution of 32-by-32 pixels. The original character bounding boxes are extended in the appropriate dimension to become square windows, so that resizing them to 32-by-32 pixels does not introduce aspect ratio distortions. Nevertheless this preprocessing introduces some distracting digits to the sides of the digit of interest.
|
166 |
-
|
167 |
-
```
|
168 |
-
{
|
169 |
-
'image': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=32x32 at 0x25A89494780>,
|
170 |
-
'label': 1
|
171 |
-
}
|
172 |
-
```
|
173 |
-
|
174 |
-
### Data Fields
|
175 |
-
|
176 |
-
#### full_numbers
|
177 |
-
|
178 |
-
- `image`: A `PIL.Image.Image` object containing the image. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`
|
179 |
-
- `digits`: a dictionary containing digits' bounding boxes and labels
|
180 |
-
- `bbox`: a list of bounding boxes (in the [coco](https://albumentations.ai/docs/getting_started/bounding_boxes_augmentation/#coco) format) corresponding to the digits present on the image
|
181 |
-
- `label`: a list of integers between 0 and 9 representing the digit.
|
182 |
-
|
183 |
-
#### cropped_digits
|
184 |
-
|
185 |
-
- `image`: A `PIL.Image.Image` object containing the image. Note that when accessing the image column: `dataset[0]["image"]` the image file is automatically decoded. Decoding of a large number of image files might take a significant amount of time. Thus it is important to first query the sample index before the `"image"` column, *i.e.* `dataset[0]["image"]` should **always** be preferred over `dataset["image"][0]`
|
186 |
-
- `digit`: an integer between 0 and 9 representing the digit.
|
187 |
-
|
188 |
-
### Data Splits
|
189 |
-
|
190 |
-
#### full_numbers
|
191 |
-
|
192 |
-
The data is split into training, test and extra set. The training set contains 33402 images, test set 13068 and the extra set 202353 images.
|
193 |
-
|
194 |
-
#### cropped_digits
|
195 |
-
|
196 |
-
The data is split into training, test and extra set. The training set contains 73257 images, test set 26032 and the extra set 531131 images.
|
197 |
-
|
198 |
-
The extra set can be used as extra training data. The extra set was obtained in a similar manner to the training and test set, but with the increased detection threshold in order to generate this large amount of labeled data. The SVHN extra subset is thus somewhat biased toward less difficult detections, and is thus easier than SVHN train/SVHN test.
|
199 |
-
|
200 |
-
## Dataset Creation
|
201 |
-
|
202 |
-
### Curation Rationale
|
203 |
-
|
204 |
-
From the paper:
|
205 |
-
> As mentioned above, the venerable MNIST dataset has been a valuable goal post for researchers seeking to build better learning systems whose benchmark performance could be expected to translate into improved performance on realistic applications. However, computers have now reached essentially human levels of performance on this problem—a testament to progress in machine learning and computer vision. The Street View House Numbers (SVHN) digit database that we provide can be seen as similar in flavor to MNIST (e.g., the images are of small cropped characters), but the SVHN dataset incorporates an order of magnitude more labeled data and comes from a significantly harder, unsolved, real world problem. Here the gap between human performance and state of the art feature representations is significant. Going forward, we expect that this dataset may fulfill a similar role for modern feature learning algorithms: it provides a new and difficult benchmark where increased performance can be expected to translate into tangible gains on a realistic application.
|
206 |
-
|
207 |
-
### Source Data
|
208 |
-
|
209 |
-
#### Initial Data Collection and Normalization
|
210 |
-
|
211 |
-
From the paper:
|
212 |
-
> The SVHN dataset was obtained from a large number of Street View images using a combination
|
213 |
-
of automated algorithms and the Amazon Mechanical Turk (AMT) framework, which was
|
214 |
-
used to localize and transcribe the single digits. We downloaded a very large set of images from
|
215 |
-
urban areas in various countries.
|
216 |
-
|
217 |
-
#### Who are the source language producers?
|
218 |
-
|
219 |
-
[More Information Needed]
|
220 |
-
|
221 |
-
### Annotations
|
222 |
-
|
223 |
-
#### Annotation process
|
224 |
-
|
225 |
-
From the paper:
|
226 |
-
> From these randomly selected images, the house-number patches were extracted using a dedicated sliding window house-numbers detector using a low threshold on the detector’s confidence score in order to get a varied, unbiased dataset of house-number signs. These low precision detections were screened and transcribed by AMT workers.
|
227 |
-
|
228 |
-
#### Who are the annotators?
|
229 |
-
|
230 |
-
The AMT workers.
|
231 |
-
|
232 |
-
### Personal and Sensitive Information
|
233 |
-
|
234 |
-
[More Information Needed]
|
235 |
-
|
236 |
-
## Considerations for Using the Data
|
237 |
-
|
238 |
-
### Social Impact of Dataset
|
239 |
-
|
240 |
-
[More Information Needed]
|
241 |
-
|
242 |
-
### Discussion of Biases
|
243 |
-
|
244 |
-
[More Information Needed]
|
245 |
-
|
246 |
-
### Other Known Limitations
|
247 |
-
|
248 |
-
[More Information Needed]
|
249 |
-
|
250 |
-
## Additional Information
|
251 |
-
|
252 |
-
### Dataset Curators
|
253 |
-
|
254 |
-
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu and Andrew Y. Ng
|
255 |
-
|
256 |
-
### Licensing Information
|
257 |
-
|
258 |
-
Non-commerical use only.
|
259 |
-
|
260 |
-
### Citation Information
|
261 |
-
|
262 |
-
```
|
263 |
-
@article{netzer2011reading,
|
264 |
-
title={Reading digits in natural images with unsupervised feature learning},
|
265 |
-
author={Netzer, Yuval and Wang, Tao and Coates, Adam and Bissacco, Alessandro and Wu, Bo and Ng, Andrew Y},
|
266 |
-
year={2011}
|
267 |
-
}
|
268 |
-
```
|
269 |
-
|
270 |
-
### Contributions
|
271 |
-
|
272 |
-
Thanks to [@mariosasko](https://github.com/mariosasko) for adding this dataset.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cropped_digits/svhn-extra-00000-of-00002.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:39a962c367f4f0c8c7dd604e09a0853d984741b7a01a7f15a95ee48d613ce48a
|
3 |
+
size 501213476
|
cropped_digits/svhn-extra-00001-of-00002.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:31b18a34da0c622bb9ff21509c874638d71fedcf2d1379d3da1de023aa13463a
|
3 |
+
size 467018470
|
cropped_digits/svhn-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e93c2f59077400ddde8c793f28612a540aa2f622f93cccf75b5fe5c5be6a0f2e
|
3 |
+
size 44477871
|
cropped_digits/svhn-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2c248ddffda6903a5bb590ab3f8d40748a358c832354a13659f4e83885278c86
|
3 |
+
size 128387775
|
dataset_infos.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"full_numbers": {"description": "SVHN is a real-world image dataset for developing machine learning and object recognition algorithms with minimal requirement on data preprocessing and formatting.\nIt can be seen as similar in flavor to MNIST (e.g., the images are of small cropped digits), but incorporates an order of magnitude more labeled data (over 600,000 digit images)\nand comes from a significantly harder, unsolved, real world problem (recognizing digits and numbers in natural scene images). SVHN is obtained from house numbers in Google Street View images.\n", "citation": "@article{netzer2011reading,\n title={Reading digits in natural images with unsupervised feature learning},\n author={Netzer, Yuval and Wang, Tao and Coates, Adam and Bissacco, Alessandro and Wu, Bo and Ng, Andrew Y},\n year={2011}\n}\n", "homepage": "http://ufldl.stanford.edu/housenumbers/", "license": "Custom (non-commercial)", "features": {"image": {"id": null, "_type": "Image"}, "digits": {"feature": {"bbox": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": 4, "id": null, "_type": "Sequence"}, "label": {"num_classes": 10, "names": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "svhn", "config_name": "full_numbers", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 390404309, "num_examples": 33402, "dataset_name": "svhn"}, "test": {"name": "test", "num_bytes": 271503052, "num_examples": 13068, "dataset_name": "svhn"}, "extra": {"name": "extra", "num_bytes": 1868720340, "num_examples": 202353, "dataset_name": "svhn"}}, "download_checksums": {"http://ufldl.stanford.edu/housenumbers/train.tar.gz": {"num_bytes": 404141560, "checksum": "4b17bb33b6cd8f963493168f80143da956f28ec406cc12f8e5745a9f91a51898"}, "http://ufldl.stanford.edu/housenumbers/test.tar.gz": {"num_bytes": 276555967, "checksum": "57ac9ceb530e4aa85b55d991be8fc49c695b3d71c6f6a88afea86549efde7fb5"}, "http://ufldl.stanford.edu/housenumbers/extra.tar.gz": {"num_bytes": 1955489752, "checksum": "e857e27d1e65bd1e7d3959b094061777f6506bbc39889a0df3bba6a729d60f9c"}}, "download_size": 2636187279, "post_processing_size": null, "dataset_size": 2530627701, "size_in_bytes": 5166814980}, "cropped_digits": {"description": "SVHN is a real-world image dataset for developing machine learning and object recognition algorithms with minimal requirement on data preprocessing and formatting.\nIt can be seen as similar in flavor to MNIST (e.g., the images are of small cropped digits), but incorporates an order of magnitude more labeled data (over 600,000 digit images)\nand comes from a significantly harder, unsolved, real world problem (recognizing digits and numbers in natural scene images). SVHN is obtained from house numbers in Google Street View images.\n", "citation": "@article{netzer2011reading,\n title={Reading digits in natural images with unsupervised feature learning},\n author={Netzer, Yuval and Wang, Tao and Coates, Adam and Bissacco, Alessandro and Wu, Bo and Ng, Andrew Y},\n year={2011}\n}\n", "homepage": "http://ufldl.stanford.edu/housenumbers/", "license": "Custom (non-commercial)", "features": {"image": {"id": null, "_type": "Image"}, "label": {"num_classes": 10, "names": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "image-classification", "image_column": "image", "label_column": "label", "labels": null}], "builder_name": "svhn", "config_name": "cropped_digits", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 128364360, "num_examples": 73257, "dataset_name": "svhn"}, "test": {"name": "test", "num_bytes": 44464040, "num_examples": 26032, "dataset_name": "svhn"}, "extra": {"name": "extra", "num_bytes": 967853504, "num_examples": 531131, "dataset_name": "svhn"}}, "download_checksums": {"http://ufldl.stanford.edu/housenumbers/train_32x32.mat": {"num_bytes": 182040794, "checksum": "435e94d69a87fde4fd4d7f3dd208dfc32cb6ae8af2240d066de1df7508d083b8"}, "http://ufldl.stanford.edu/housenumbers/test_32x32.mat": {"num_bytes": 64275384, "checksum": "cdce80dfb2a2c4c6160906d0bd7c68ec5a99d7ca4831afa54f09182025b6a75b"}, "http://ufldl.stanford.edu/housenumbers/extra_32x32.mat": {"num_bytes": 1329278602, "checksum": "a133a4beb38a00fcdda90c9489e0c04f900b660ce8a316a5e854838379a71eb3"}}, "download_size": 1575594780, "post_processing_size": null, "dataset_size": 1140681904, "size_in_bytes": 2716276684}}
|
|
|
|
full_numbers/svhn-extra-00000-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0aacd7b3688603a8a4e39e1fd409a68a995ab3b6f94f04b66e4eabffe1c02b5e
|
3 |
+
size 497604227
|
full_numbers/svhn-extra-00001-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:277ecc4fd28911bc5319c9634c132a64e359bce22423a70f63e1980e033ad5f8
|
3 |
+
size 503362262
|
full_numbers/svhn-extra-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3de636c09faaf4648af4d6197da0fed4b753a630386e3aa0a5a07c41235cc078
|
3 |
+
size 505390918
|
full_numbers/svhn-extra-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:56dac711ce2360c9eed6961758d79a38a24dac6baf695443b14a15ac32a6299d
|
3 |
+
size 349660674
|
full_numbers/svhn-test.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c27f648f2fadb638d0914e6de0fab9cc8c3568f277afe58aa69589563e87cdcd
|
3 |
+
size 270881696
|
full_numbers/svhn-train.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3de4f181147d45dff9a13e780647c434288571b423fa0fa5d275458c668a2570
|
3 |
+
size 388561950
|
svhn.py
DELETED
@@ -1,199 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""Street View House Numbers (SVHN) dataset."""
|
16 |
-
|
17 |
-
import io
|
18 |
-
import os
|
19 |
-
|
20 |
-
import h5py
|
21 |
-
import numpy as np
|
22 |
-
import scipy.io as sio
|
23 |
-
|
24 |
-
import datasets
|
25 |
-
from datasets.tasks import ImageClassification
|
26 |
-
|
27 |
-
|
28 |
-
logger = datasets.logging.get_logger(__name__)
|
29 |
-
|
30 |
-
|
31 |
-
_CITATION = """\
|
32 |
-
@article{netzer2011reading,
|
33 |
-
title={Reading digits in natural images with unsupervised feature learning},
|
34 |
-
author={Netzer, Yuval and Wang, Tao and Coates, Adam and Bissacco, Alessandro and Wu, Bo and Ng, Andrew Y},
|
35 |
-
year={2011}
|
36 |
-
}
|
37 |
-
"""
|
38 |
-
|
39 |
-
_DESCRIPTION = """\
|
40 |
-
SVHN is a real-world image dataset for developing machine learning and object recognition algorithms with minimal requirement on data preprocessing and formatting.
|
41 |
-
It can be seen as similar in flavor to MNIST (e.g., the images are of small cropped digits), but incorporates an order of magnitude more labeled data (over 600,000 digit images)
|
42 |
-
and comes from a significantly harder, unsolved, real world problem (recognizing digits and numbers in natural scene images). SVHN is obtained from house numbers in Google Street View images.
|
43 |
-
"""
|
44 |
-
|
45 |
-
_HOMEPAGE = "http://ufldl.stanford.edu/housenumbers/"
|
46 |
-
|
47 |
-
_LICENSE = "Custom (non-commercial)"
|
48 |
-
|
49 |
-
_URLs = {
|
50 |
-
"full_numbers": [
|
51 |
-
"http://ufldl.stanford.edu/housenumbers/train.tar.gz",
|
52 |
-
"http://ufldl.stanford.edu/housenumbers/test.tar.gz",
|
53 |
-
"http://ufldl.stanford.edu/housenumbers/extra.tar.gz",
|
54 |
-
],
|
55 |
-
"cropped_digits": [
|
56 |
-
"http://ufldl.stanford.edu/housenumbers/train_32x32.mat",
|
57 |
-
"http://ufldl.stanford.edu/housenumbers/test_32x32.mat",
|
58 |
-
"http://ufldl.stanford.edu/housenumbers/extra_32x32.mat",
|
59 |
-
],
|
60 |
-
}
|
61 |
-
|
62 |
-
_DIGIT_LABELS = [str(num) for num in range(10)]
|
63 |
-
|
64 |
-
|
65 |
-
class SVHN(datasets.GeneratorBasedBuilder):
|
66 |
-
"""Street View House Numbers (SVHN) dataset."""
|
67 |
-
|
68 |
-
VERSION = datasets.Version("1.0.0")
|
69 |
-
|
70 |
-
BUILDER_CONFIGS = [
|
71 |
-
datasets.BuilderConfig(
|
72 |
-
name="full_numbers",
|
73 |
-
version=VERSION,
|
74 |
-
description="Contains the original, variable-resolution, color house-number images with character level bounding boxes.",
|
75 |
-
),
|
76 |
-
datasets.BuilderConfig(
|
77 |
-
name="cropped_digits",
|
78 |
-
version=VERSION,
|
79 |
-
description="Character level ground truth in an MNIST-like format. All digits have been resized to a fixed resolution of 32-by-32 pixels. The original character bounding boxes are extended in the appropriate dimension to become square windows, so that resizing them to 32-by-32 pixels does not introduce aspect ratio distortions. Nevertheless this preprocessing introduces some distracting digits to the sides of the digit of interest.",
|
80 |
-
),
|
81 |
-
]
|
82 |
-
|
83 |
-
def _info(self):
|
84 |
-
if self.config.name == "full_numbers":
|
85 |
-
features = datasets.Features(
|
86 |
-
{
|
87 |
-
"image": datasets.Image(),
|
88 |
-
"digits": datasets.Sequence(
|
89 |
-
{
|
90 |
-
"bbox": datasets.Sequence(datasets.Value("int32"), length=4),
|
91 |
-
"label": datasets.ClassLabel(num_classes=10),
|
92 |
-
}
|
93 |
-
),
|
94 |
-
}
|
95 |
-
)
|
96 |
-
else:
|
97 |
-
features = datasets.Features(
|
98 |
-
{
|
99 |
-
"image": datasets.Image(),
|
100 |
-
"label": datasets.ClassLabel(num_classes=10),
|
101 |
-
}
|
102 |
-
)
|
103 |
-
return datasets.DatasetInfo(
|
104 |
-
description=_DESCRIPTION,
|
105 |
-
features=features,
|
106 |
-
supervised_keys=None,
|
107 |
-
homepage=_HOMEPAGE,
|
108 |
-
license=_LICENSE,
|
109 |
-
citation=_CITATION,
|
110 |
-
task_templates=[ImageClassification(image_column="image", label_column="label")]
|
111 |
-
if self.config.name == "cropped_digits"
|
112 |
-
else None,
|
113 |
-
)
|
114 |
-
|
115 |
-
def _split_generators(self, dl_manager):
|
116 |
-
if self.config.name == "full_numbers":
|
117 |
-
train_archive, test_archive, extra_archive = dl_manager.download(_URLs[self.config.name])
|
118 |
-
for path, f in dl_manager.iter_archive(train_archive):
|
119 |
-
if path.endswith("digitStruct.mat"):
|
120 |
-
train_annot_data = f.read()
|
121 |
-
break
|
122 |
-
for path, f in dl_manager.iter_archive(test_archive):
|
123 |
-
if path.endswith("digitStruct.mat"):
|
124 |
-
test_annot_data = f.read()
|
125 |
-
break
|
126 |
-
for path, f in dl_manager.iter_archive(extra_archive):
|
127 |
-
if path.endswith("digitStruct.mat"):
|
128 |
-
extra_annot_data = f.read()
|
129 |
-
break
|
130 |
-
train_archive = dl_manager.iter_archive(train_archive)
|
131 |
-
test_archive = dl_manager.iter_archive(test_archive)
|
132 |
-
extra_archive = dl_manager.iter_archive(extra_archive)
|
133 |
-
train_filepath, test_filepath, extra_filepath = None, None, None
|
134 |
-
else:
|
135 |
-
train_annot_data, test_annot_data, extra_annot_data = None, None, None
|
136 |
-
train_archive, test_archive, extra_archive = None, None, None
|
137 |
-
train_filepath, test_filepath, extra_filepath = dl_manager.download(_URLs[self.config.name])
|
138 |
-
return [
|
139 |
-
datasets.SplitGenerator(
|
140 |
-
name=datasets.Split.TRAIN,
|
141 |
-
gen_kwargs={
|
142 |
-
"annot_data": train_annot_data,
|
143 |
-
"files": train_archive,
|
144 |
-
"filepath": train_filepath,
|
145 |
-
},
|
146 |
-
),
|
147 |
-
datasets.SplitGenerator(
|
148 |
-
name=datasets.Split.TEST,
|
149 |
-
gen_kwargs={
|
150 |
-
"annot_data": test_annot_data,
|
151 |
-
"files": test_archive,
|
152 |
-
"filepath": test_filepath,
|
153 |
-
},
|
154 |
-
),
|
155 |
-
datasets.SplitGenerator(
|
156 |
-
name="extra",
|
157 |
-
gen_kwargs={
|
158 |
-
"annot_data": extra_annot_data,
|
159 |
-
"files": extra_archive,
|
160 |
-
"filepath": extra_filepath,
|
161 |
-
},
|
162 |
-
),
|
163 |
-
]
|
164 |
-
|
165 |
-
def _generate_examples(self, annot_data, files, filepath):
|
166 |
-
if self.config.name == "full_numbers":
|
167 |
-
|
168 |
-
def _get_digits(bboxes, h5_file):
|
169 |
-
def key_to_values(key, bbox):
|
170 |
-
if bbox[key].shape[0] == 1:
|
171 |
-
return [int(bbox[key][0][0])]
|
172 |
-
else:
|
173 |
-
return [int(h5_file[bbox[key][i][0]][()].item()) for i in range(bbox[key].shape[0])]
|
174 |
-
|
175 |
-
bbox = h5_file[bboxes[0]]
|
176 |
-
assert bbox.keys() == {"height", "left", "top", "width", "label"}
|
177 |
-
bbox_columns = [key_to_values(key, bbox) for key in ["left", "top", "width", "height", "label"]]
|
178 |
-
return [
|
179 |
-
{"bbox": [left, top, width, height], "label": label % 10}
|
180 |
-
for left, top, width, height, label in zip(*bbox_columns)
|
181 |
-
]
|
182 |
-
|
183 |
-
with h5py.File(io.BytesIO(annot_data), "r") as h5_file:
|
184 |
-
for path, f in files:
|
185 |
-
root, ext = os.path.splitext(path)
|
186 |
-
if ext != ".png":
|
187 |
-
continue
|
188 |
-
img_idx = int(os.path.basename(root)) - 1
|
189 |
-
yield img_idx, {
|
190 |
-
"image": {"path": path, "bytes": f.read()},
|
191 |
-
"digits": _get_digits(h5_file["digitStruct/bbox"][img_idx], h5_file),
|
192 |
-
}
|
193 |
-
else:
|
194 |
-
data = sio.loadmat(filepath)
|
195 |
-
for i, (image_array, label) in enumerate(zip(np.rollaxis(data["X"], -1), data["y"])):
|
196 |
-
yield i, {
|
197 |
-
"image": image_array,
|
198 |
-
"label": label.item() % 10,
|
199 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|