Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to estimate a face's age/gender using cv::dnn APIs

Hi, OpenCV developer,

This is a subsequent question from http://answers.opencv.org/question/186005/dnnreadnetfromtensorflow-fail-on-loading-pre-trained-network-on-age-gender-detection/?answer=186571#post-id-186571 . Now I am able to load a deep age-gender detection model(developed in tensorFlow) into opencv dnn module(using cv::dnn::readNetFromTensorflow(...)) --Thank you, @dkurt.

However, after loading the deep model, I called cv::Mat blobImg = cv::dnn::blobFromImage(...); ageGenderNet.setInput(blobImg); cv::Mat result= ageGenderNet.forward(); to estimate age/gender (details of how I have used these APIs are in the previous post), the result is incorrect. I feel I am not far from the finish line, but just need to make sure input argments (eg. the image channel(RGB, BGR) order, input parameters for cv::dnn::blobFrmImage() and whether there are some additional processing before or after calling these APIs. Any good suggestions are welcome~~

Thank you in advance

click to hide/show revision 2
None

updated 2018-04-23 05:13:20 -0600

berak gravatar image

How to estimate a face's age/gender using cv::dnn APIs

Hi, OpenCV developer,

This is a subsequent question from http://answers.opencv.org/question/186005/dnnreadnetfromtensorflow-fail-on-loading-pre-trained-network-on-age-gender-detection/?answer=186571#post-id-186571 . Now I am able to load a deep age-gender detection model(developed in tensorFlow) into opencv dnn module(using cv::dnn::readNetFromTensorflow(...)) --Thank you, @dkurt.

However, after loading the deep model, I called

cv::Mat blobImg = cv::dnn::blobFromImage(...);
ageGenderNet.setInput(blobImg);
cv::Mat result= ageGenderNet.forward();

to estimate age/gender (details of how I have used these APIs are in the previous post), the result is incorrect. I feel I am not far from the finish line, but just need to make sure input argments (eg. the image channel(RGB, BGR) order, input parameters for cv::dnn::blobFrmImage() and whether there are some additional processing before or after calling these APIs. Any good suggestions are welcome~~

Thank you in advance