Ask Your Question

How to detect sunglasses in a human/facial region?

asked 2017-05-12 07:22:42 -0500

nickcong gravatar image

Hi guys,

I am working on a project to detect human and check whether he/she is wearing a protection goggle(I simply assume its a sunglasses-like object)

This is what I did:

Trained my own classifier with linear SVM and HOG features,the data set came from Dalal's paper's resource plus my own images. Its performance is acceptable but not that good. (a very high FP rate when detecting). It worked fine in a given background..

Then I tried to detect the goggle in the human body region. I took 50 more pictures and saved the [forehead+sunglasses+noses] regions and trained them with linear SVM and HOG (2x2 pixels each cell and 2x2 cells each block) then almost every thing can be detected on the body excepted for the real sunglasses region....I am wondering if there is a good way to conduct the sunglasses detection? I am in hurry and have not time to try each features one by one....

(My training set is like this image description)

Sorry for my english and a great many thanks guys!


edit retag flag offensive close merge delete


If my post need to modified please let me know :)

nickcong gravatar imagenickcong ( 2017-05-12 07:24:15 -0500 )edit

You can use face detection

Than ROI for eyes Then use DFT

Opencvfaq gravatar imageOpencvfaq ( 2017-05-24 14:19:34 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-06-01 04:59:43 -0500

arunponnusamy gravatar image

updated 2018-06-01 05:06:44 -0500

Hello Nick,

How did you train your SVM classifier ?

Did you take a look at dlib's object detector ? It's really good. Look at the following example. It has neat comments.

you can detect faces first and then look for sunglasses inside the detected face rectangle. For face detection, you can use dlib's frontal face detector if you are just dealing with frontal faces. If your input image has faces in all angles you can consider using cvlib. It detects faces in all angles. (uses OpenCV's dnn module underneath)

Here is a comparison between dlib's frontal and CNN face detector.

Hope this helps. Cheers.

edit flag offensive delete link more

Question Tools



Asked: 2017-05-12 07:22:06 -0500

Seen: 1,699 times

Last updated: Jun 01 '18