|
| 1 | +# [The Street View House Numbers (SVHN) Dataset](@id SVHN2) |
| 2 | + |
| 3 | +Description from the [official |
| 4 | +website](http://ufldl.stanford.edu/housenumbers/): |
| 5 | + |
| 6 | +> SVHN is a real-world image dataset for developing machine |
| 7 | +> learning and object recognition algorithms with minimal |
| 8 | +> requirement on data preprocessing and formatting. It can be |
| 9 | +> seen as similar in flavor to MNIST (e.g., the images are of |
| 10 | +> small cropped digits), but incorporates an order of magnitude |
| 11 | +> more labeled data (over 600,000 digit images) and comes from a |
| 12 | +> significantly harder, unsolved, real world problem (recognizing |
| 13 | +> digits and numbers in natural scene images). SVHN is obtained |
| 14 | +> from house numbers in Google Street View images. |
| 15 | +
|
| 16 | +About Format 2 (Cropped Digits): |
| 17 | + |
| 18 | +> All digits have been resized to a fixed resolution of 32-by-32 |
| 19 | +> pixels. The original character bounding boxes are extended in |
| 20 | +> the appropriate dimension to become square windows, so that |
| 21 | +> resizing them to 32-by-32 pixels does not introduce aspect |
| 22 | +> ratio distortions. Nevertheless this preprocessing introduces |
| 23 | +> some distracting digits to the sides of the digit of interest. |
| 24 | +
|
| 25 | +!!! note |
| 26 | + |
| 27 | + For non-commercial use only |
| 28 | + |
| 29 | +## Contents |
| 30 | + |
| 31 | +```@contents |
| 32 | +Pages = ["SVHN2.md"] |
| 33 | +Depth = 3 |
| 34 | +``` |
| 35 | + |
| 36 | +## Overview |
| 37 | + |
| 38 | +The `MLDatasets.SVHN2` sub-module provides a programmatic |
| 39 | +interface to download, load, and work with the SVHN2 dataset of |
| 40 | +handwritten digits. |
| 41 | + |
| 42 | +```julia |
| 43 | +using MLDatasets |
| 44 | + |
| 45 | +# load full training set |
| 46 | +train_x, train_y = SVHN2.traindata() |
| 47 | + |
| 48 | +# load full test set |
| 49 | +test_x, test_y = SVHN2.testdata() |
| 50 | + |
| 51 | +# load additional train set |
| 52 | +extra_x, extra_y = SVHN2.extradata() |
| 53 | +``` |
| 54 | + |
| 55 | +The provided functions also allow for optional arguments, such as |
| 56 | +the directory `dir` where the dataset is located, or the specific |
| 57 | +observation `indices` that one wants to work with. For more |
| 58 | +information on the interface take a look at the documentation |
| 59 | +(e.g. `?SVHN2.traindata`). |
| 60 | + |
| 61 | +Function | Description |
| 62 | +---------|------------- |
| 63 | +[`download([dir])`](@ref SVHN2.download) | Trigger interactive download of the dataset |
| 64 | +[`classnames()`](@ref SVHN2.classnames) | Return the class names as a vector of strings |
| 65 | +[`traindata([T], [indices]; [dir])`](@ref SVHN2.traindata) | Load images and labels of the training data |
| 66 | +[`testdata([T], [indices]; [dir])`](@ref SVHN2.testdata) | Load images and labels of the test data |
| 67 | +[`extradata([T], [indices]; [dir])`](@ref SVHN2.extradata) | Load images and labels of the extra training data |
| 68 | + |
| 69 | +This module also provides utility functions to make working with |
| 70 | +the SVHN (format 2) dataset in Julia more convenient. |
| 71 | + |
| 72 | +Function | Description |
| 73 | +---------|------------- |
| 74 | +[`convert2features(array)`](@ref SVHN2.convert2features) | Convert the SVHN tensor to a flat feature matrix |
| 75 | +[`convert2image(array)`](@ref SVHN2.convert2image) | Convert the SVHN tensor/matrix to a colorant array |
| 76 | + |
| 77 | +You can use the function |
| 78 | +[`convert2features`](@ref SVHN2.convert2features) to convert |
| 79 | +the given SVHN tensor to a feature matrix (or feature vector |
| 80 | +in the case of a single image). The purpose of this function is |
| 81 | +to drop the spatial dimensions such that traditional ML |
| 82 | +algorithms can process the dataset. |
| 83 | + |
| 84 | +```julia |
| 85 | +julia> SVHN2.convert2features(SVHN2.traindata()[1]) # full training data |
| 86 | +3072×73257 Array{N0f8,2}: |
| 87 | +[...] |
| 88 | +``` |
| 89 | + |
| 90 | +To visualize an image or a prediction we provide the function |
| 91 | +[`convert2image`](@ref SVHN2.convert2image) to convert the |
| 92 | +given SVHN2 horizontal-major tensor (or feature matrix) to a |
| 93 | +vertical-major `Colorant` array. |
| 94 | + |
| 95 | +```julia |
| 96 | +julia> SVHN2.convert2image(SVHN2.traindata(1)[1]) # first training image |
| 97 | +32×32 Array{RGB{N0f8},2}: |
| 98 | +[...] |
| 99 | +``` |
| 100 | + |
| 101 | +## API Documentation |
| 102 | + |
| 103 | +```@docs |
| 104 | +SVHN2 |
| 105 | +``` |
| 106 | + |
| 107 | +### Trainingset |
| 108 | + |
| 109 | +```@docs |
| 110 | +SVHN2.traindata |
| 111 | +``` |
| 112 | + |
| 113 | +### Testset |
| 114 | + |
| 115 | +```@docs |
| 116 | +SVHN2.testdata |
| 117 | +``` |
| 118 | + |
| 119 | +### Extraset |
| 120 | + |
| 121 | +```@docs |
| 122 | +SVHN2.extradata |
| 123 | +``` |
| 124 | + |
| 125 | +### Utilities |
| 126 | + |
| 127 | +```@docs |
| 128 | +SVHN2.download |
| 129 | +SVHN2.classnames |
| 130 | +SVHN2.convert2features |
| 131 | +SVHN2.convert2image |
| 132 | +``` |
| 133 | + |
| 134 | +## References |
| 135 | + |
| 136 | +- **Authors**: Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, Andrew Y. Ng |
| 137 | + |
| 138 | +- **Website**: http://ufldl.stanford.edu/housenumbers |
| 139 | + |
| 140 | +- **[Netzer et al., 2011]** Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, Andrew Y. Ng. "Reading Digits in Natural Images with Unsupervised Feature Learning" NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011 |
0 commit comments