Download Small NORB database of images of toys.
Format
A data frame with 18,439 variables:
c0px1,c0px2,c0px3...c0px9216: Integer pixel value, from 0 (white) to 255 (black) for the first image in the pairc1px1,c1px2,c1px3...c1px9216: Integer pixel value, from 0 (white) to 255 (black) for the second image in the pairInstance: The index of the toy in a particular category, represented by a factor in the range 0-9. The training set consists of instances 4, 6, 7, 8 and 9, and the test set consists of 0, 1, 2, 3 and 5.Elevation: The elevation of the camera represented by a factor in the range 0-8. These represent elevations of 30 to 70 degrees from the horizontal, in increments of 5 degrees.Azimuth: The azimuth, represented by a factor in the range 0, 2, 4 .. 34. Multiply by ten to get the value in degrees.Lighting: The lighting condition, represened by a factor in the range 0-5.Label: The toy category, represented by a factor in the range 0-4.Split: Whether the toy in is in thetrainingortestingset, represented by a factorDescription: The name of the toy category associated withLabel, represented by a factor.
The pixel features are organized row-wise from the top left of each image.
The Label levels correspond to:
0: Four-legged animal1: Human figure2: Airplane3: Truck4: Car
There are 48,600 items in the data set. The first 24,300 are the training
set, and the remaining 24,300 are the testing set, but you can also use
the Split column (or meta$split in a list result) to determine which
split a given row is in.
Items in the dataset can be visualized with the
show_norb_object() function.
For more information see https://cs.nyu.edu/~ylclab/data/norb-v1.0-small/.
Arguments
- base_url
Base URL that the files are located at.
- verbose
If
TRUE, then download progress will be logged as a message.- split
Which split to download. Use
"all"for both the training and testing sets, or"training"or"testing"for one split.- as
Return format. Use
"data.frame"for the original data frame shape, or"list"for the canonical image result described indownload_mnist(). Forsplit = "all", the integer pixel matrix uses about 3.34 GiB; the wide data-frame result needs additional memory. Use"list"if that result is sufficient.- timeout
Minimum download timeout in seconds. The default is 30 minutes; a larger existing global R timeout is preserved.
Value
If as = "data.frame", a data frame containing the Small NORB
dataset. If as = "list", a canonical image result with an integer
image-pair matrix and lower-case metadata names in meta.
Details
Downloads the image and label files for the training and test datasets and converts them to a data frame or canonical list result.
The Small NORB dataset contains images of 50 toys. The toys are divided into
five categories (animal, human, airplane, truck, car) with ten examples per
category. Each object was then images under 6 different lighting conditions,
9 elevations and 18 different azimuths, so there are 972 images per toy. The
process was then repeated with a different camera, so there are actually
1,944 images per toy. This dataset stores each pair of images for a
given toy, lighting, elevation and azimuth as a single row. Each image is
96 by 96 pixels, so the first 9,216 columns contain the pixels of the first
image, and the second 9,216 (9217:18432) columns contain the pixels of
the second image. The other information (lighting and so on) are also stored
as factors.
References
The Small NORB Dataset, v1.0 https://cs.nyu.edu/~ylclab/data/norb-v1.0-small/
LeCun, Y., Huang, F. J., & Bottou, L. (2004, June). Learning methods for generic object recognition with invariance to pose and lighting. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR) 2004 (pp. 97-104). IEEE. http://doi.ieeecomputersociety.org/10.1109/CVPR.2004.144
Examples
if (FALSE) { # \dontrun{
# download the data set as a canonical list
norb <- download_norb_small(verbose = TRUE, as = "list")
# first 24,300 instances are the training set
norb_train <- head(norb$data, 24300)
# the remaining 24,300 are the test set
norb_test <- tail(norb$data, 24300)
# Or equivalently
norb_train2 <- norb$data[norb$meta$split == "training", ]
norb_test2 <- norb$data[norb$meta$split == "testing", ]
identical(norb_train, norb_train2) # TRUE
identical(norb_test, norb_test2) # also TRUE
# PCA on 1000 examples
sample_rows <- sample(nrow(norb$data), 1000)
norb_r1000 <- norb$data[sample_rows, ]
pca <- prcomp(norb_r1000, retx = TRUE, rank. = 2)
# plot the scores of the first two components
plot(pca$x[, 1:2], type = "n")
text(pca$x[, 1:2],
labels = norb$meta$label[sample_rows],
col = rainbow(length(levels(norb$meta$label)))[norb$meta$label[sample_rows]]
)
} # }