keras-video-generators
keras-video-generators copied to clipboard
1/Unknown steps while performing fit
Hello, I'm running over google colab and I got stuck on first Epoch for hours using the exlusive GPU of the colab pro.
Using keras_video I got before
Total data: 4 classes for 91 files for train
Total data: 4 classes for 43 files for validation
Epoch 1/50
1/Unknown - 7s 7s/step - loss: 1.5134 - acc: 0.2500
So I added the "steps_per_epoch" as 240 to fit method, but after that I got stuck here
Total data: 4 classes for 91 files for train
Total data: 4 classes for 43 files for validation
Epoch 1/50
240/240 [==============================] - ETA: 0s - loss: 1.2376 - acc: 0.4552
Maybe I'm doing something wrong?, I did a quite similar code that your example here with the same shapes https://medium.com/smileinnovation/training-neural-network-with-image-sequence-an-example-with-video-as-input-c3407f7a0b0f
After all I solved by adding also the "validation_steps" parameter to the fit_generator. Maybe this could help somebody in the future :)
One more question :) , if you have a unbalanced classes like A-> 10 , B->10, C->20 D->100, can you use the augmenter just for augment the videos of the unbalanced classes?
Hi, For the error you mentioned, it is probably a problem of step counter, I didn't have that problem but I will inspect.
For your question, the splitting of validation and test is balanced. e.g for step_val=.3, the generator takes 33% of data in each class.
Thank you!, yes but if I increase 33% each, I will have at the end A->13 , B -> 13, C->26, D-> 133. So at the end my classes will be still unbalanced. But maybe I can just remove some examples from the D class and use the augmenter with 33% for all.
yes, or maybe I can add a "balance" option to propose several methods.
The problem with unbalanced data is that I cannot guaranty that all classes are represented in validation or test subset if I don't force to pick data in each class.
If you've got an idea, I can try to add that option.
Ye sI will take a look in order to try to add that options. Thank you!
Hi I am facing the exact same problem @metal3d did you find something.
Hi I am facing the exact same problem @metal3d did you find something.
By the moment you have to add to your fit_generator the following options:
steps_per_epoch=number_training_set*NBFRAME//BS,
validation_steps=number_validation_set*NBFRAME//BS
where NBFRAME and BS are the options that you set on the videogenerator library
OK, you're right, there is something wrong with the length computation. I will try to produce a unit test to reproduce that bug and try to fix as soon as possible.
Thanks a lot for your reporting :+1: