Load custom dataset for Keras
<p><strong>MNIST Example:</strong></p>

<p>From [neon example] (<a href="http://neon.nervanasys.com/index.html/mnist.html" rel="nofollow noreferrer">http://neon.nervanasys.com/index.html/mnist.html</a>): (similar to keras)</p>

<pre><code>from neon.data import MNIST

 mnist = MNIST()

(X_train, y_train), (X_test, y_test), nclass = mnist.load_data()
</code></pre>

<p>I want to obtain the same set of tuples for UCF_CC_50 dataset.</p>

<p>It's a dataset of 50 distinct images, of an aerial view of crowded areas.
I'm modifying <a href="http://neon.nervanasys.com/index.html/_modules/neon/data/image.html" rel="nofollow noreferrer">the segment behind this</a>.</p>

<p>All the images are downloaded and contained in the folder 'Images'.</p>

<p>This is the <strong>init</strong> </p>

<pre><code>def __init__(self, filename, url, size, path='.', subset_pct=100):
    # parameters to use in dataset config serialization
    super(Dataset, self).__init__(name=None)
    self.filename = filename
    self.url = url
    self.size = size
    self.path = path
    self.subset_pct = subset_pct
    self._data_dict = None
    if subset_pct != 100:
        # placeholder to use partial data set
        raise NotImplemented('subset percentage feature is not yet implemented')
</code></pre>

<p>This is what i have so far. I dont understand how to modify <strong>init</strong>.</p>

<pre><code>class UCF(Dataset):
**def __init__(self, path='.', subset_pct=100, normalize=True):
    super(UCF, self).__init__('Images',
                                '//url',
                                15296311,
                                path=path,
                                subset_pct=subset_pct)**
    self.normalize = normalize

def load_data(self):
    filepath = self._valid_path_append(self.path, self.filename)

    with open(filepath, 'rb') as ucf:
        (X_train, y_train), (X_test, y_test) = pickle_load(ucf)
        X_train = X_train.reshape(-1, 784)
        X_test = X_test.reshape(-1, 784)

        if self.normalize:
            X_train = X_train / 255.
            X_test = X_test / 255.

    return (X_train, y_train), (X_test, y_test), 10

def gen_iterators(self):
    (X_train, y_train), (X_test, y_test), nclass = self.load_data()
    train = ArrayIterator(X_train,
                          y_train,
                          nclass=nclass,
                          lshape=(1, 28, 28),
                          name='train')
    val = ArrayIterator(X_test,
                        y_test,
                        nclass=nclass,
                        lshape=(1, 28, 28),
                        name='valid')
    self._data_dict = {'train': train,
                       'valid': val}
    return self._data_dict
</code></pre>

<p>Can anyone help me with this?</p>