rpudlCreateDataSource {rpud}R Documentation

RPUDL Data Source for Deep Learning

Description

Creates an S3 object that contains training and testing data.

Usage

rpudlCreateDataSource(
        data.format = c("lmdb", "cifar10", "cifar100", "minst"),
        data.dir,
        data.shape = NULL,
        data.channels = 1,
        train.data = NULL,
        test.data = NULL,
        url = NULL
    )

Arguments

data.format

format of the data set

data.dir

path location of the data set

data.shape

the width and height of each data item

data.channels

number of channels of each data item

train.data

name of the training LMDB database

test.data

name of the testing LMDB database

url

if non-null, specifies alternative URL for downloading MNIST or CIFAR data

Details

The supported data formats include MNIST, CIFAR, and LMDB. If the data format is MNIST or CIFAR, it will automatically download the data from its origin. For LMDB data, the database must locally exists beforehand. To use custom data for model training, it must be imported into an LMDB database. Each record in the database is a protobuf message with the following type: message Datum { required bytes data = 1; required uint32 label = 2; }

Value

An S3 object that inherits the class rpudlDataSource containing:

data.format

format of the data set

data.dir

path location of the data set

data.shape

the width and height of each data item

data.channels

number of channels of each data item

train.data

name of the training LMDB database

test.data

name of the testing LMDB database

Author(s)

Chi Yau
chi.yau@r-tutor.com

See Also

rpudl,
predict.rpudl,
rpudlTrain,
rpudlPretrain,
rpudlGetTestingDataSamples,
rpudlFindTrainingDataMean,
rpudlWriteLMDB

Examples

## Not run: 
# create data source
ds <- rpudlCreateDataSource(
        data.format="lmdb",
        data.dir="data/mnist",
        train.data="mnist-official-data_train_lmdb",
        test.data="mnist-official-data_test_lmdb",
        data.shape=c(28, 28)
)

# create model
model <- rpudl(
        "mnist_mpl_lenet.prototxt",
        data.source=ds
)   

# train model
model <- rpudlTrain(model, batch=100, iter=1000)

## End(Not run)

[Package rpud version 0.7.0 Index]