oswaldoludwig/Human-Action-Recognition-with-Keras

ZeroDivisionError: integer division or modulo by zero

muglikar opened this issue · 2 comments

I ran the line:
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32,exception_verbosity=high python HumanActionRecognition.py

for 160 epochs initially, then for 120 and finally for 10. Each time I keep getting this error:

22424/22424 [==============================] - 620s - loss: 12.7184 - mean_squared_logarithmic_error: 0.0349 - acc: 0.4296 - val_loss: 1.5969 - val_mean_squared_logarithmic_error: 0.0334 - val_acc: 0.4687
Traceback (most recent call last):
  File "HumanActionRecognition.py", line 173, in <module>
    aux = model.predict_generator(test_generator, nb_test_samples)
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 945, in predict_generator
    pickle_safe=pickle_safe)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1634, in predict_generator
    outs = self.predict_on_batch(x)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1268, in predict_on_batch
    self.internal_input_shapes)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 70, in standardize_input_data
    'Found: ' + str(data)[:200] + '...')
Exception: Error when checking : data should be a Numpy array, or list/dict of Numpy arrays. Found: None

...
Exception in thread Thread-12:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 425, in data_generator_task
    generator_output = next(generator)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 596, in next
    index_array, current_index, current_batch_size = next(self.index_generator)
  File "/usr/local/lib/python2.7/dist-packages/keras/preprocessing/image.py", line 444, in _flow_index
    current_index = (self.batch_index * batch_size) % N
ZeroDivisionError: integer division or modulo by zero

However, I did get a 65.3 MB whole_model.h5 file at the end of it. Could you guide me if this error is worth ignoring? How does this actually work?

@oswaldoludwig Can you reply please?

Hi,

I didn't have this problem, check the generated csv file with the predicted classes to see if it makes sense.

Best regards,

Oswaldo