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

slow classifier #66

Open
alirezak7 opened this issue Mar 21, 2018 · 3 comments
Open

slow classifier #66

alirezak7 opened this issue Mar 21, 2018 · 3 comments

Comments

@alirezak7
Copy link

in guess.py this following line takes almost a second to predict the age or gender on a 1050Ti gpu:

batch_results = sess.run(softmax_output, feed_dict={images:image_batch.eval()})

I am feeding a batch of one image which includes a cropped face and it takes one second.

Any idea on how i can speed things up to create a realtime age/gender classifier that can work on camera streams?

@dpressel
Copy link
Owner

dpressel commented Mar 21, 2018

I have not seen a single image take that amount of time. How are you profiling?

@alirezak7
Copy link
Author

I am running guess.py and feeding it one image. I put time.time() before and after the line mentioned above (line 99 in guess.py) to measure the time. It takes almost a second executing that line. I have tried feeding batches and for a batch of 100 face images it took 5 seconds (50 ms per image). But for real time age/gender recognition i need to be able to process a frame with one or a few faces in less than 200 ms.

this is how i measured time :
start = time.time()
batch_results = sess.run(softmax_output, feed_dict={images:image_batch.eval()})
end = time.time()
print("to run session : "+str((end-start)))

@dpressel
Copy link
Owner

You will definitely want to batch your images. Also you may want to look at some of the other tickets surrounding video processing. Several people seem to have modified guess.py to work on video. At some point I plan on adding a demo program for this, but havent had time yet.

Also you may be interested in this PR: #50

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

No branches or pull requests

2 participants