five-video-classification-methods icon indicating copy to clipboard operation
five-video-classification-methods copied to clipboard

real-time continuous webcam prediction

Open styap94 opened this issue 7 years ago • 21 comments

hi, may i know, instead of reading an original video file, extract features and sequences, and make prediction, is that possible to let the program read from webcam and predict in real-time continuously with different set of actions? for example, apply-lipstick, followed by apply eye make up.

styap94 avatar Feb 22 '18 18:02 styap94

you can grab n frames, put in a tensor, or make a temp file, predict this file, and then remove/restart the loop this way you predict in real time, i think

mesmerx avatar Feb 23 '18 00:02 mesmerx

is it possible to reach real time? because we not only need to create frames while streaming, we need to extract the features and create the sequence.npy file for prediction. it could take quite sometime to extract sequence of features.

styap94 avatar Feb 24 '18 18:02 styap94

Train the model , and then with a loaded model uses opencv extract lhe first 300 frames and save in array, predict that array, and in next loop add one frame and remove one, so you can predict in real time

mesmerx avatar Feb 24 '18 18:02 mesmerx

I believe this could run at 20 fps or more

mesmerx avatar Feb 24 '18 18:02 mesmerx

I’m using lstm model. Yes, I used the opencv to extract frames. But then it takes some time to extract the features from the frames created(as the author mentioned, lstm will use the feature extracted for prediction).
I think the problem is the feature extraction part. Ps: I’m very new to tf and machine learning. Thanks for explaining to me so patiently.

styap94 avatar Feb 24 '18 19:02 styap94

No problem at all The frame calculations is fast for a small sample, for 300 frames is almost no hardproblem, i dos with 2 vídeos with 30 seg and goes without Dalay at Sol. But give a try, to know

mesmerx avatar Feb 24 '18 19:02 mesmerx

when i finish my actual model i will ttry make that,if you can wait

mesmerx avatar Feb 24 '18 19:02 mesmerx

It’s good to know you will try to make this. I appreciate that so much. Hope you can finish ur model soon. Haha

styap94 avatar Feb 24 '18 19:02 styap94

another question to ask, is that possible to deploy this keras trained model (hdf5) to android ?

styap94 avatar Feb 28 '18 18:02 styap94

I cant se why not, Just a tip, Save only weights and then save json. Its faster oi load

mesmerx avatar Feb 28 '18 18:02 mesmerx

I made a custom demo script, i will push to my git

mesmerx avatar Feb 28 '18 18:02 mesmerx

great!! i will go to have a try

styap94 avatar Feb 28 '18 20:02 styap94

@mesmerx i did not see the demo script that you mentioned.

styap94 avatar Mar 03 '18 12:03 styap94

I have not pushed yet, Just making some work

mesmerx avatar Mar 03 '18 19:03 mesmerx

@mesmerx have you done it? i still unable to solve the problem

styap94 avatar Mar 15 '18 11:03 styap94

Dos anyone been able to do this?

Lelo123 avatar Jun 18 '18 20:06 Lelo123

@mesmerx and @hanako94

Lelo123 avatar Jun 18 '18 20:06 Lelo123

you can convert the keras .hdf5 to tensorflow .pb format and then plug to your tensorflow android project https://github.com/amir-abdi/keras_to_tensorflow

styap94 avatar Jun 19 '18 10:06 styap94

Thanks. Just one more question, i'm still very new to machine learning, but wasn't suppose to exist a Validation and test set? In this cases the Validation set seems to be the test set for me

Lelo123 avatar Jun 20 '18 20:06 Lelo123

@hanako94

Lelo123 avatar Jun 20 '18 20:06 Lelo123

@mesmerx

when i finish my actual model i will ttry make that,if you can wait

Were you able to complete this?

drewgash avatar Aug 21 '18 15:08 drewgash