harvitronix / five-video-classification-methods

Code that accompanies my blog post outlining five video classification methods in Keras and TensorFlow
https://medium.com/@harvitronix/five-video-classification-methods-implemented-in-keras-and-tensorflow-99cad29cc0b5
MIT License
1.17k stars 479 forks source link

TypeError: 'threadsafe_iterator' object is not an iterator #111

Open shubhamshekhar opened 5 years ago

shubhamshekhar commented 5 years ago

I ran following commands initially as mentioned in the README document pip install -r requirements.txt cd data && wget http://crcv.ucf.edu/data/UCF101/UCF101.rar mkdir train && mkdir test && mkdir sequences && mkdir checkpoints python 1_move_files.py' 'python 2_extract_files.py

Then I extracted feature by running extract_features.py . As mentioned, I limited to first 8 classes by setting that option.

Earlier I was using python 2.7 but now I have migrated to python 3.4 after getting TypeError: instance has no next() method. So I am running the below code on Python 3.4 but still I am getting following log errors:

Using TensorFlow backend.
Loading LSTM model.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
None
Epoch 1/1000
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 606, in data_generator_task
    generator_output = next(self._generator)
TypeError: 'threadsafe_iterator' object is not an iterator
Traceback (most recent call last):
  File "train.py", line 110, in <module>
    main()
  File "train.py", line 107, in main
    load_to_memory=load_to_memory, batch_size=batch_size, nb_epoch=nb_epoch)
  File "train.py", line 81, in train
    workers=4)
  File "/usr/local/lib/python3.4/dist-packages/keras/legacy/interfaces.py", line 88, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/keras/models.py", line 1097, in fit_generator
    initial_epoch=initial_epoch)
  File "/usr/local/lib/python3.4/dist-packages/keras/legacy/interfaces.py", line 88, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 1851, in fit_generator
    str(generator_output))
ValueError: output of generator should be a tuple `(x, y, sample_weight)` or `(x, y)`. Found: None
Exception ignored in: <bound method Session.__del__ of <tensorflow.python.client.session.Session object at 0x7f6aade63828>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/client/session.py", line 582, in __del__
AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'