Sunday, June 8, 2014

Face detection with OpenCV, Tkinter and multiprocessing: Performace

So it works: code for face detection using multiple processes in parallel with Tkinter; but what about performance?

Dramatis personæ:
- 21773 is the 'Master' process that creates the pipes and two child processes:
- 21774 plays as Tkinter.
- 21777 role is OpenCv, camera capture and face detection.

Activity with face detection and showing the capture in the gui:



CPU is 73% more or less, you can notice the system is working hard.


Activity without showing the frames in the gui:



Overall CPU reduces to aprox. 64%.
Master (21773 ) process spikes up to 60% (from 26%) --> NOK
Tkinter (21774) reduces usage from 22% to 6%. --> OK
OpenCv (21773) does not vary --> OK

Something is not right here, Master should not be working harder if there are no frames to put in the gui.
Most probably its loop runs more than it needs to.


Activity without the capture process, that is, only the gui running and the controller:



Minimal activity --> OK

Ideas to improve performance:
- Show webcam only in gray colours.
- Reduce resolution, these tests are capturing at 640x480
- Reduce the after() call frequency, so there are less updates requested to Tkinter.



No comments:

Post a Comment