Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in train.py #76

Closed
moonikwe opened this issue Feb 27, 2018 · 4 comments · May be fixed by #87
Closed

Error in train.py #76

moonikwe opened this issue Feb 27, 2018 · 4 comments · May be fixed by #87

Comments

@moonikwe
Copy link

moonikwe commented Feb 27, 2018

I ran train.py and this is what I got

Using TensorFlow backend.
2018-02-27 12:22:38.975784: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow
\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow
binary was not compiled to use: AVX AVX2
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, 14)                7182
=================================================================
Total params: 34,618,894
Trainable params: 34,618,894
Non-trainable params: 0
_________________________________________________________________
None
Creating train generator with 850 samples.
Epoch 1/1000
Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in
 _bootstrap_inner
    self.run()
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\threading.py", line 864, in
 run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\utils\d
ata_utils.py", line 579, in data_generator_task
    generator_output = next(self._generator)
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\data.py", line 25, in __n
ext__
    return next(self.iterator)
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\data.py", line 191, in fr
ame_generator
    y.append(self.get_class_one_hot(sample[1]))
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\data.py", line 103, in ge
t_class_one_hot
    assert len(label_hot) == len(self.classes)
AssertionError

Traceback (most recent call last):
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\train.py", line 110, in <
module>
    main()
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\train.py", line 107, in m
ain
    load_to_memory=load_to_memory, batch_size=batch_size, nb_epoch=nb_epoch)
  File "C:\Users\Munic\Documents\Popping-Dance-Style-Classification\train.py", line 81, in tr
ain
    workers=4)
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\
interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\models.
py", line 1156, in fit_generator
    initial_epoch=initial_epoch)
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\legacy\
interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\Munic\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\
training.py", line 2046, in fit_generator
    generator_output = next(output_generator)
StopIteration

What could have went wrong?

@harvitronix
Copy link
Owner

Is this on your own dataset? The assertion error in data.py on line 103 seems to be the problem. Make sure you've set your number of classes to be equal to the list of classes in your dataset. If you can post more information about your dataset, I can probably help further.

mertia-himanshu added a commit to mertia-himanshu/five-video-classification-methods that referenced this issue May 25, 2018
This should resolve [issue76](harvitronix#76) when running by train.py  for 'lstm' model.
@huawang123
Copy link

you only need to fix
assert len(label_hot) == len(self.classes)
return label_hot
as
assert len(label_hot[0]) == len(self.classes)
return label_hot[0]
hope it works for you!

@13293824182
Copy link

I am using your data and code, why is the same problem? i hope you answer.

@huawang123
Copy link

huawang123 commented Jun 29, 2018 via email

@moonikwe moonikwe closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants