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.18k stars 478 forks source link

ValueError: Can't find sequence. Did you generate them? #69

Closed inders closed 6 years ago

inders commented 6 years ago

Facing this while running python3 train.py

Using TensorFlow backend.
Loading LSTM model.
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
lstm_1 (LSTM)                (None, 2048)              33562624  
_________________________________________________________________
dense_1 (Dense)              (None, 512)               1049088   
_________________________________________________________________
dropout_1 (Dropout)          (None, 512)               0         
_________________________________________________________________
dense_2 (Dense)              (None, 101)               51813     
=================================================================
Total params: 34,663,525
Trainable params: 34,663,525
Non-trainable params: 0
_________________________________________________________________
None
2018-02-05 17:37:13.867040: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2 AVX AVX2 FMA
Creating test generator with 3418 samples.
Creating train generator with 8596 samples.
Epoch 1/1000
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 "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/models.py", line 1256, in fit_generator
    initial_epoch=initial_epoch)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/engine/training.py", line 2145, in fit_generator
    generator_output = next(output_generator)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/utils/data_utils.py", line 770, in get
    six.reraise(value.__class__, value, value.__traceback__)
  File "/Users/indersingh/tensorflow/lib/python3.5/site-packages/six.py", line 693, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/keras/utils/data_utils.py", line 635, in _data_generator_task
    generator_output = next(self._generator)
  File "/Users/indersingh/projects/five-video-classification-methods/data.py", line 25, in __next__
    return next(self.iterator)
  File "/Users/indersingh/projects/five-video-classification-methods/data.py", line 188, in frame_generator
    raise ValueError("Can't find sequence. Did you generate them?")
ValueError: Can't find sequence. Did you generate them?
harvitronix commented 6 years ago

Did you generate your sequences?

You need to run extract_features.py before you can use the LSTM model.

inders commented 6 years ago

Thanks @harvitronix yes i did generate the sequences in the form of numpy arrays.

ls data/sequences/v_ Display all 5698 possibilities? (y or n) v_ApplyEyeMakeup_g01_c01-40-features.npy v_BoxingPunchingBag_g23_c06-40-features.npy v_HandstandWalking_g20_c02-40-features.npy v_ApplyEyeMakeup_g01_c02-40-features.npy v_BoxingPunchingBag_g23_c07-40-features.npy v_HandstandWalking_g20_c03-40-features.npy v_ApplyEyeMakeup_g01_c03-40-features.npy v_BoxingPunchingBag_g24_c01-40-features.npy v_HandstandWalking_g20_c04-40-features.npy v_ApplyEyeMakeup_g01_c04-40-features.npy v_BoxingPunchingBag_g24_c03-40-features.npy v_HandstandWalking_g21_c01-40-features.npy v_ApplyEyeMakeup_g01_c05-40-features.npy v_BoxingPunchingBag_g24_c04-40-features.npy v_HandstandWalking_g21_c02-40-features.npy v_ApplyEyeMakeup_g01_c06-40-features.npy v_BoxingPunchingBag_g24_c06-40-features.npy v_HandstandWalking_g21_c03-40-features.npy v_ApplyEyeMakeup_g02_c01-40-features.npy v_BoxingPunchingBag_g24_c07-40-features.npy v_HandstandWalking_g21_c04-40-features.npy v_ApplyEyeMakeup_g02_c02-40-features.npy v_BoxingPunchingBag_g25_c01-40-features.npy v_HandstandWalking_g22_c01-40-features.npy v_ApplyEyeMakeup_g02_c03-40-features.npy v_BoxingPunchingBag_g25_c02-40-features.npy v_HandstandWalking_g22_c02-40-features.npy v_ApplyEyeMakeup_g02_c04-40-features.npy v_BoxingPunchingBag_g25_c03-40-features.npy v_HandstandWalking_g22_c03-40-features.npy v_ApplyEyeMakeup_g03_c01-40-features.npy v_BoxingPunchingBag_g25_c04-40-features.npy v_HandstandWalking_g22_c04-40-features.npy v_ApplyEyeMakeup_g03_c02-40-features.npy v_BoxingPunchingBag_g25_c05-40-features.npy v_HandstandWalking_g25_c01-40-features.npy v_ApplyEyeMakeup_g03_c03-40-features.npy v_BoxingPunchingBag_g25_c06-40-features.npy v_HandstandWalking_g25_c02-40-features.npy v_ApplyEyeMakeup_g03_c04-40-features.npy v_BoxingPunchingBag_g25_c07-40-features.npy v_HandstandWalking_g25_c03-40-features.npy v_ApplyEyeMakeup_g03_c05-40-features.npy v_BoxingSpeedBag_g08_c01-40-features.npy v_HandstandWalking_g25_c04-40-features.npy v_ApplyEyeMakeup_g03_c06-40-features.npy v_BoxingSpeedBag_g08_c02-40-features.npy v_HeadMassage_g08_c01-40-features.npy v_ApplyEyeMakeup_g04_c01-40-features.npy v_BoxingSpeedBag_g08_c03-40-features.npy v_HeadMassage_g08_c02-40-features.npy v_ApplyEyeMakeup_g04_c02-40-features.npy v_BoxingSpeedBag_g08_c04-40-features.npy v_HeadMassage_g08_c03-40-features.npy v_ApplyEyeMakeup_g04_c03-40-features.npy v_BoxingSpeedBag_g08_c05-40-features.npy v_HeadMassage_g08_c04-40-features.npy v_ApplyEyeMakeup_g04_c04-40-features.npy v_BoxingSpeedBag_g10_c01-40-features.npy v_HeadMassage_g08_c05-40-features.npy v_ApplyEyeMakeup_g04_c05-40-features.npy v_BoxingSpeedBag_g10_c02-40-features.npy v_HeadMassage_g08_c06-40-features.npy v_ApplyEyeMakeup_g04_c06-40-features.npy v_BoxingSpeedBag_g10_c03-40-features.npy v_HeadMassage_g08_c07-40-features.npy v_ApplyEyeMakeup_g04_c07-40-features.npy v_BoxingSpeedBag_g10_c04-40-features.npy v_HeadMassage_g09_c01-40-features.npy v_ApplyEyeMakeup_g05_c01-40-features.npy v_BoxingSpeedBag_g11_c01-40-features.npy v_HeadMassage_g09_c02-40-features.npy v_ApplyEyeMakeup_g05_c02-40-features.npy v_BoxingSpeedBag_g11_c02-40-features.npy v_HeadMassage_g09_c03-40-features.npy v_ApplyEyeMakeup_g05_c03-40-features.npy v_BoxingSpeedBag_g11_c03-40-features.npy v_HeadMassage_g09_c04-40-features.npy v_ApplyEyeMakeup_g05_c04-40-features.npy v_BoxingSpeedBag_g11_c04-40-features.npy v_HeadMassage_g10_c01-40-features.npy v_ApplyEyeMakeup_g05_c05-40-features.npy v_BoxingSpeedBag_g11_c05-40-features.npy v_HeadMassage_g10_c02-40-features.npy v_ApplyEyeMakeup_g05_c06-40-features.npy v_BoxingSpeedBag_g11_c06-40-features.npy v_HeadMassage_g10_c03-40-features.npy v_ApplyEyeMakeup_g05_c07-40-features.npy v_BoxingSpeedBag_g12_c01-40-features.npy v_HeadMassage_g10_c04-40-features.npy v_ApplyEyeMakeup_g06_c01-40-features.npy v_BoxingSpeedBag_g12_c04-40-features.npy v_HeadMassage_g11_c01-40-features.npy v_ApplyEyeMakeup_g06_c02-40-features.npy v_BoxingSpeedBag_g12_c05-40-features.npy v_HeadMassage_g11_c02-40-features.npy v_ApplyEyeMakeup_g06_c03-40-features.npy v_BoxingSpeedBag_g13_c03-40-features.npy v_HeadMassage_g11_c03-40-features.npy v_ApplyEyeMakeup_g06_c04-40-features.npy v_BoxingSpeedBag_g13_c04-40-features.npy v_HeadMassage_g11_c04-40-features.npy v_ApplyEyeMakeup_g06_c05-40-features.npy v_BoxingSpeedBag_g13_c05-40-features.npy v_HeadMassage_g11_c05-40-features.npy v_ApplyEyeMakeup_g06_c06-40-features.npy v_BoxingSpeedBag_g13_c06-40-features.npy v_HeadMassage_g11_c06-40-features.npy

annualrings commented 5 years ago

Thanks @harvitronix yes i did generate the sequences in the form of numpy arrays.

ls data/sequences/v_ Display all 5698 possibilities? (y or n) v_ApplyEyeMakeup_g01_c01-40-features.npy v_BoxingPunchingBag_g23_c06-40-features.npy v_HandstandWalking_g20_c02-40-features.npy v_ApplyEyeMakeup_g01_c02-40-features.npy v_BoxingPunchingBag_g23_c07-40-features.npy v_HandstandWalking_g20_c03-40-features.npy v_ApplyEyeMakeup_g01_c03-40-features.npy v_BoxingPunchingBag_g24_c01-40-features.npy v_HandstandWalking_g20_c04-40-features.npy v_ApplyEyeMakeup_g01_c04-40-features.npy v_BoxingPunchingBag_g24_c03-40-features.npy v_HandstandWalking_g21_c01-40-features.npy v_ApplyEyeMakeup_g01_c05-40-features.npy v_BoxingPunchingBag_g24_c04-40-features.npy v_HandstandWalking_g21_c02-40-features.npy v_ApplyEyeMakeup_g01_c06-40-features.npy v_BoxingPunchingBag_g24_c06-40-features.npy v_HandstandWalking_g21_c03-40-features.npy v_ApplyEyeMakeup_g02_c01-40-features.npy v_BoxingPunchingBag_g24_c07-40-features.npy v_HandstandWalking_g21_c04-40-features.npy v_ApplyEyeMakeup_g02_c02-40-features.npy v_BoxingPunchingBag_g25_c01-40-features.npy v_HandstandWalking_g22_c01-40-features.npy v_ApplyEyeMakeup_g02_c03-40-features.npy v_BoxingPunchingBag_g25_c02-40-features.npy v_HandstandWalking_g22_c02-40-features.npy v_ApplyEyeMakeup_g02_c04-40-features.npy v_BoxingPunchingBag_g25_c03-40-features.npy v_HandstandWalking_g22_c03-40-features.npy v_ApplyEyeMakeup_g03_c01-40-features.npy v_BoxingPunchingBag_g25_c04-40-features.npy v_HandstandWalking_g22_c04-40-features.npy v_ApplyEyeMakeup_g03_c02-40-features.npy v_BoxingPunchingBag_g25_c05-40-features.npy v_HandstandWalking_g25_c01-40-features.npy v_ApplyEyeMakeup_g03_c03-40-features.npy v_BoxingPunchingBag_g25_c06-40-features.npy v_HandstandWalking_g25_c02-40-features.npy v_ApplyEyeMakeup_g03_c04-40-features.npy v_BoxingPunchingBag_g25_c07-40-features.npy v_HandstandWalking_g25_c03-40-features.npy v_ApplyEyeMakeup_g03_c05-40-features.npy v_BoxingSpeedBag_g08_c01-40-features.npy v_HandstandWalking_g25_c04-40-features.npy v_ApplyEyeMakeup_g03_c06-40-features.npy v_BoxingSpeedBag_g08_c02-40-features.npy v_HeadMassage_g08_c01-40-features.npy v_ApplyEyeMakeup_g04_c01-40-features.npy v_BoxingSpeedBag_g08_c03-40-features.npy v_HeadMassage_g08_c02-40-features.npy v_ApplyEyeMakeup_g04_c02-40-features.npy v_BoxingSpeedBag_g08_c04-40-features.npy v_HeadMassage_g08_c03-40-features.npy v_ApplyEyeMakeup_g04_c03-40-features.npy v_BoxingSpeedBag_g08_c05-40-features.npy v_HeadMassage_g08_c04-40-features.npy v_ApplyEyeMakeup_g04_c04-40-features.npy v_BoxingSpeedBag_g10_c01-40-features.npy v_HeadMassage_g08_c05-40-features.npy v_ApplyEyeMakeup_g04_c05-40-features.npy v_BoxingSpeedBag_g10_c02-40-features.npy v_HeadMassage_g08_c06-40-features.npy v_ApplyEyeMakeup_g04_c06-40-features.npy v_BoxingSpeedBag_g10_c03-40-features.npy v_HeadMassage_g08_c07-40-features.npy v_ApplyEyeMakeup_g04_c07-40-features.npy v_BoxingSpeedBag_g10_c04-40-features.npy v_HeadMassage_g09_c01-40-features.npy v_ApplyEyeMakeup_g05_c01-40-features.npy v_BoxingSpeedBag_g11_c01-40-features.npy v_HeadMassage_g09_c02-40-features.npy v_ApplyEyeMakeup_g05_c02-40-features.npy v_BoxingSpeedBag_g11_c02-40-features.npy v_HeadMassage_g09_c03-40-features.npy v_ApplyEyeMakeup_g05_c03-40-features.npy v_BoxingSpeedBag_g11_c03-40-features.npy v_HeadMassage_g09_c04-40-features.npy v_ApplyEyeMakeup_g05_c04-40-features.npy v_BoxingSpeedBag_g11_c04-40-features.npy v_HeadMassage_g10_c01-40-features.npy v_ApplyEyeMakeup_g05_c05-40-features.npy v_BoxingSpeedBag_g11_c05-40-features.npy v_HeadMassage_g10_c02-40-features.npy v_ApplyEyeMakeup_g05_c06-40-features.npy v_BoxingSpeedBag_g11_c06-40-features.npy v_HeadMassage_g10_c03-40-features.npy v_ApplyEyeMakeup_g05_c07-40-features.npy v_BoxingSpeedBag_g12_c01-40-features.npy v_HeadMassage_g10_c04-40-features.npy v_ApplyEyeMakeup_g06_c01-40-features.npy v_BoxingSpeedBag_g12_c04-40-features.npy v_HeadMassage_g11_c01-40-features.npy v_ApplyEyeMakeup_g06_c02-40-features.npy v_BoxingSpeedBag_g12_c05-40-features.npy v_HeadMassage_g11_c02-40-features.npy v_ApplyEyeMakeup_g06_c03-40-features.npy v_BoxingSpeedBag_g13_c03-40-features.npy v_HeadMassage_g11_c03-40-features.npy v_ApplyEyeMakeup_g06_c04-40-features.npy v_BoxingSpeedBag_g13_c04-40-features.npy v_HeadMassage_g11_c04-40-features.npy v_ApplyEyeMakeup_g06_c05-40-features.npy v_BoxingSpeedBag_g13_c05-40-features.npy v_HeadMassage_g11_c05-40-features.npy v_ApplyEyeMakeup_g06_c06-40-features.npy v_BoxingSpeedBag_g13_c06-40-features.npy v_HeadMassage_g11_c06-40-features.npy

Hello, can you solve it?

bruce-wayne-256 commented 4 years ago

If u have reduced the number of classes, change the variable value in data.py and train.py...