{"id":10952,"date":"2019-08-30T09:00:51","date_gmt":"2019-08-30T13:00:51","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=10952"},"modified":"2019-08-29T23:09:07","modified_gmt":"2019-08-30T03:09:07","slug":"how-old-do-i-look","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2019\/08\/30\/how-old-do-i-look\/","title":{"rendered":"How Old Do I Look?"},"content":{"rendered":"<div class=\"content\"><!--introduction--><\/p>\n<p><a href=\"http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911\">Brett<\/a>&#8216;s Pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/72577-age-and-gender-estimation-from-face\"><tt>Age and Gender Estimation from Face<\/tt><\/a>, by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3502213-masayuki-tanaka\">Masayuki Tanaka<\/a>.<\/p>\n<p><!--\/introduction--><\/p>\n<p>Back in 2014, I &#8220;co-selected&#8221; <a href=\"https:\/\/blogs.mathworks.com\/pick\/2014\/09\/05\/how-noisy-are-your-images\/\">one of Masayuki&#8217;s files<\/a> as a  Pick of the Week when I was looking for ways to quantify blur&#8211;I was (rightly) taken to task for calling it &#8220;noise&#8221;&#8211; in single images. Today, I return to his oeuvre to highlight a fun new submission that estimates age and gender from a photo.<\/p>\n<p>Downloading and installing Masayuki&#8217;s code will lead you to <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/36855-face-parts-detection\">another of his submissions<\/a> that detects face parts&#8211;eyes, nose, mouth&#8211;in images. (That code primarily modifies the defaults of the &#8220;face-parts detector&#8221; in <a href=\"https:\/\/www.mathworks.com\/help\/vision\/ref\/vision.cascadeobjectdetector-system-object.html\">vision.CascadeObjectDetector<\/a>, purportedly with better results.) Then his code will automatically install a pre-trained <a href=\"https:\/\/www.mathworks.com\/help\/deeplearning\/ref\/vgg16.html\">vgg-based<\/a> neural network that does the classification (gender) and regression (age).<\/p>\n<p>I really like that Masayuki provided sample code for training a network, even though he provided pre-trained models. And I like that his code predicts both age <i>and<\/i> gender. But mostly I just like how much fun I had playing around with it!<\/p>\n<p>Here I was a few years ago; the age-gender predictor got it pretty right:<\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/Prediction1.png\" alt=\"\"> <\/p>\n<p>Apparently, I look a year older if I flip the image left-to-right:<\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/Prediction2.png\" alt=\"\"> <\/p>\n<p>Try it on some of your own images&#8211;it&#8217;s fun! Just be sure to shield it from your partner if it turns out to predict that she is a he, and that &#8220;he&#8221; is a few years older than she really is!<\/p>\n<p>Oh, and you&#8217;ll need the <a href=\"https:\/\/www.mathworks.com\/help\/vision\/ref\/vision.cascadeobjectdetector-system-object.html\">Deep Learning Toolbox<\/a> to run Masayuki&#8217;s code.<\/p>\n<p>As always, I welcome your <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=10952#respond\">thoughts and comments<\/a>.<\/p>\n<p><script language=\"JavaScript\"> <!-- \n    function grabCode_ce2b68967f254cf58c4514c057b0e445() {\n        \/\/ Remember the title so we can use it in the new page\n        title = document.title;\n\n        \/\/ Break up these strings so that their presence\n        \/\/ in the Javascript doesn't mess up the search for\n        \/\/ the MATLAB code.\n        t1='ce2b68967f254cf58c4514c057b0e445 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\n        t2='##### ' + 'SOURCE END' + ' #####' + ' ce2b68967f254cf58c4514c057b0e445';\n    \n        b=document.getElementsByTagName('body')[0];\n        i1=b.innerHTML.indexOf(t1)+t1.length;\n        i2=b.innerHTML.indexOf(t2);\n \n        code_string = b.innerHTML.substring(i1, i2);\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\n\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \n        \/\/ in the XML parser.\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\n        \/\/ doesn't go ahead and substitute the less-than character. \n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\n\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\n\n        w = window.open();\n        d = w.document;\n        d.write('\n\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\n\n\\n');\n\n        d.title = title + ' (MATLAB code)';\n        d.close();\n    }   \n     --> <\/script><\/p>\n<p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><a href=\"javascript:grabCode_ce2b68967f254cf58c4514c057b0e445()\"><span style=\"font-size: x-small;        font-style: italic;\">Get<br \/>\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><\/p>\n<p>      Published with MATLAB&reg; R2019a<\/p>\n<\/div>\n<p><!--\nce2b68967f254cf58c4514c057b0e445 ##### SOURCE BEGIN #####\n%% How Old Do I Look?\n%\n% <http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911 Brett>'s\n% Pick this week is\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/72577-age-and-gender-estimation-from-face |Age and Gender Estimation from Face|>,\n% by <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3502213-masayuki-tanaka Masayuki Tanaka>.\n%\n%%\n% Back in 2014, I \"co-selected\" \n% <https:\/\/blogs.mathworks.com\/pick\/2014\/09\/05\/how-noisy-are-your-images\/ one of Masayuki's files> as a \n%  Pick of the Week when I was looking for ways to quantify blurREPLACE_WITH_DASH_DASHI was (rightly) taken to task for calling it \"noise\"REPLACE_WITH_DASH_DASH\n% in single images. Today, I return to his\n% oeuvre to highlight a fun new submission that estimates age and gender from a photo.\n\n%%\n% Downloading and installing Masayuki's code will lead you to \n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/36855-face-parts-detection another of his submissions> that \n% detects face partsREPLACE_WITH_DASH_DASHeyes, nose, mouthREPLACE_WITH_DASH_DASHin images. (That code primarily modifies the defaults of the \"face-parts detector\" in \n% <https:\/\/www.mathworks.com\/help\/vision\/ref\/vision.cascadeobjectdetector-system-object.html vision.CascadeObjectDetector>, \n% purportedly with better results.) Then his code will automatically install\n% a pre-trained <https:\/\/www.mathworks.com\/help\/deeplearning\/ref\/vgg16.html vgg-based>\n% neural network that does the classification (gender) and regression (age).\n\n%% \n% I really like that Masayuki provided sample code for training a network, even\n% though he provided pre-trained models. And I like that his code predicts\n% both age _and_ gender. But mostly I just like how much fun I had playing\n% around with it! \n%\n%% \n% Here I was a few years ago; the age-gender predictor got it pretty right:\n\n%%\n% \n% <<https:\/\/blogs.mathworks.com\/pick\/files\/Prediction1.png>>\n% \n%%\n% Apparently, I look a year older if I flip the image left-to-right:\n%%\n% \n% <<https:\/\/blogs.mathworks.com\/pick\/files\/Prediction2.png>>\n% \n\n%%\n% Try it on some of your own imagesREPLACE_WITH_DASH_DASHit's fun! Just be sure to shield it from your partner if it turns out to predict that she is a he, and that \"he\" is a few years older than she really is!\n\n%%\n% Oh, and you'll need the <https:\/\/www.mathworks.com\/help\/vision\/ref\/vision.cascadeobjectdetector-system-object.html Deep Learning Toolbox> \n% to run Masayuki's code. \n%%\n% As always, I welcome your\n% <http:\/\/blogs.mathworks.com\/pick\/?p=10952#respond thoughts and comments>.\n##### SOURCE END ##### ce2b68967f254cf58c4514c057b0e445\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/Prediction1.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>\nBrett&#8216;s Pick this week is Age and Gender Estimation from Face, by Masayuki Tanaka.<\/p>\n<p>Back in 2014, I &#8220;co-selected&#8221; one of Masayuki&#8217;s files as a  Pick of the Week when I was&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2019\/08\/30\/how-old-do-i-look\/\">read more >><\/a><\/p>\n","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10952"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=10952"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10952\/revisions"}],"predecessor-version":[{"id":10972,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10952\/revisions\/10972"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=10952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=10952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=10952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}