ValueError: ('The specified size contains a dimension with value <= 0', (4096, 0))

ubuntu 16.04 LTS, no GPU w/ python 3.5.2
all packages were installed recently (as of 10/7/2017)
Made sure theano backend is setup

Also, because Keras has been upgraded to v2, i applied the updates from this github repo.

in Lesson1.ipynb, i am getting this error.

Any deas?

vgg = Vgg16()
# Grab a few images at a time for training and validation.
# NB: They must be in subdirectories named based on their category
batches = vgg.get_batches(path+'train', batch_size=batch_size)
val_batches = vgg.get_batches(path+'valid', batch_size=batch_size*2)
vgg.finetune(batches)
vgg.fit(batches, val_batches, batch_size, nb_epoch=1)

==================================

ERROR:

==================================

Found 0 images belonging to 0 classes.
Found 0 images belonging to 0 classes.

ValueError Traceback (most recent call last)
in ()
4 batches = vgg.get_batches(path+‘train’, batch_size=batch_size)
5 val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)
----> 6 vgg.finetune(batches)
7 vgg.fit(batches, val_batches, batch_size, nb_epoch=1)

/mnt/hgfs/T/security/fast.ai/courses/deeplearning1/nbs/vgg16.py in finetune(self, batches)
95
96 def finetune(self, batches):
—> 97 self.ft(batches.num_class) # Keras2
98 classes = list(iter(batches.class_indices))
99 for c in batches.class_indices:

/mnt/hgfs/T/security/fast.ai/courses/deeplearning1/nbs/vgg16.py in ft(self, num)
91 model.pop()
92 for layer in model.layers: layer.trainable=False
—> 93 model.add(Dense(num, activation=‘softmax’))
94 self.compile()
95

/usr/local/lib/python3.5/dist-packages/keras/models.py in add(self, layer)
453 output_shapes=[self.outputs[0]._keras_shape])
454 else:
–> 455 output_tensor = layer(self.outputs[0])
456 if isinstance(output_tensor, list):
457 raise TypeError('All layers in a Sequential model ’

/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py in call(self, inputs, **kwargs)
526 ‘layer.build(batch_input_shape)’)
527 if len(input_shapes) == 1:
–> 528 self.build(input_shapes[0])
529 else:
530 self.build(input_shapes)

/usr/local/lib/python3.5/dist-packages/keras/layers/core.py in build(self, input_shape)
825 name=‘kernel’,
826 regularizer=self.kernel_regularizer,
–> 827 constraint=self.kernel_constraint)
828 if self.use_bias:
829 self.bias = self.add_weight((self.units,),

/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py in add_weight(self, shape, initializer, name, trainable, regularizer, constraint)
362 “”"
363 initializer = initializers.get(initializer)
–> 364 weight = K.variable(initializer(shape), dtype=K.floatx(), name=name)
365 if regularizer is not None:
366 self.add_loss(regularizer(weight))

/usr/local/lib/python3.5/dist-packages/keras/initializers.py in call(self, shape, dtype)
203 limit = np.sqrt(3. * scale)
204 return K.random_uniform(shape, -limit, limit,
–> 205 dtype=dtype, seed=self.seed)
206
207 def get_config(self):

/usr/local/lib/python3.5/dist-packages/keras/backend/theano_backend.py in random_uniform(shape, minval, maxval, dtype, seed)
1967 seed = np.random.randint(1, 10e6)
1968 rng = RandomStreams(seed=seed)
-> 1969 return rng.uniform(shape, low=minval, high=maxval, dtype=dtype)
1970
1971

/usr/local/lib/python3.5/dist-packages/theano/sandbox/rng_mrg.py in uniform(self, size, low, high, ndim, dtype, nstreams)
1342 raise ValueError(
1343 “The specified size contains a dimension with value <= 0”,
-> 1344 size)
1345
1346 else:

ValueError: (‘The specified size contains a dimension with value <= 0’, (4096, 0))

The important part is

Found 0 images belonging to 0 classes.
Found 0 images belonging to 0 classes.

Your data is not set up properly.

Thanks @anshbansal

There’s a discussion on github if anyone is having same problem