Python - How do I utilize ALL cores of my CPU in training my FaceRecognizer?

asked 2017-09-22 06:07:45 -0600

Gensoukyou1337 gravatar image

updated 2017-09-22 06:08:24 -0600

I'm currently training my FisherFaceRecognizer in Python and I noticed something strange. My processor is an Intel Core i5, and apparently only one of the cores is working in the training process - in the Task Manager the Python process also takes only 25% of the CPU usage. I think that using all four cores to train my FisherFaceRecognizer would make the training process faster.

That said, I heard some things concerning the whole 'Global Interpreter Lock', so is it possible to use all four cores of my i5 processor for the training process, and if so, how?

EDIT: Would the multiprocessing module make it possible?

edit retag flag offensive close merge delete

Comments

you can't . the code is not parallelizised at all.

berak gravatar imageberak ( 2017-09-22 07:19:07 -0600 )edit

Is it even theoretically possible to somehow parallelize the training of a FaceRecognizer though?

Gensoukyou1337 gravatar imageGensoukyou1337 ( 2017-09-22 07:53:32 -0600 )edit

imho, you got the better chance with lbph here (which is processing all images independantly of each other), i'd personally give all up on hacking into the pca ;)

but in any case, you'd have to break into the code for it. maybe bytefish's alternative all-python implementation is the easier target to hack it (from python) ?

berak gravatar imageberak ( 2017-09-22 08:05:37 -0600 )edit

You mean LbphFaceRecognizer?

Gensoukyou1337 gravatar imageGensoukyou1337 ( 2017-09-22 08:41:56 -0600 )edit

yes. and here

berak gravatar imageberak ( 2017-09-22 08:43:39 -0600 )edit

By the way, what are the performance differences between the FisherFaceRecognizer, EigenFaceRecognizer, and the LbphFaceRecognizer?

Gensoukyou1337 gravatar imageGensoukyou1337 ( 2017-09-22 22:14:44 -0600 )edit

I've tried the LBPHFaceRecognizer. Its training time is indeed quick, but I can't use the resulting YAML file in my Android device, because it's 900 MB in size.

Gensoukyou1337 gravatar imageGensoukyou1337 ( 2017-09-24 11:32:29 -0600 )edit