{"id":11625,"date":"2020-07-04T12:07:07","date_gmt":"2020-07-04T16:07:07","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=11625"},"modified":"2020-07-04T12:07:07","modified_gmt":"2020-07-04T16:07:07","slug":"face-mask-detection-using-deep-learning","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2020\/07\/04\/face-mask-detection-using-deep-learning\/","title":{"rendered":"Face Mask Detection using Deep Learning"},"content":{"rendered":"\r\n<div class=\"content\"><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871\">Jiro<\/a>'s Pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/76758\">COVID19 Face Mask Detection using Deep Learning<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/6383459\">Wanbin Song<\/a>.<\/p><p>Face masks had always been quite common where I'm from. During flu season, I would see many people wearing face masks in the city. With the COVID-19 pandemic, we see the use of face masks all around the world.<\/p><p>In this entry, my fellow MathWorker, Wanbin, uses deep learning to detect whether a mask is being worn. He has a number of live scripts to walk through the image labeling process, training process, and testing of the model. He includes a pre-trained network that was trained using images provided by his colleagues. If you would like to train your own model, you should supply your own training images.<\/p><p>He also includes a script for testing the model on a live video captured by a webcam. I gave it a try, and his pre-trained network seemed to work fine for me.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_mask_detection\/mask_detection_demo2.gif\" alt=\"\"> <\/p><p>Pretty cool!<\/p><p><b>Comments<\/b><\/p><p>Give it a try and let us know what you think <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=11625#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/76758#comment\">comment<\/a> for Wanbin.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_b4dee2b837dd41e8a722b5fcad81c8c6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='b4dee2b837dd41e8a722b5fcad81c8c6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' b4dee2b837dd41e8a722b5fcad81c8c6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2020 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<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');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_b4dee2b837dd41e8a722b5fcad81c8c6()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2020a<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2020a<br><\/p><\/div><!--\r\nb4dee2b837dd41e8a722b5fcad81c8c6 ##### SOURCE BEGIN #####\r\n%%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/869871 Jiro>'s\r\n% Pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/76758 COVID19 Face\r\n% Mask Detection using Deep Learning> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/6383459 Wanbin\r\n% Song>.\r\n%\r\n% Face masks had always been quite common where I'm from. During flu\r\n% season, I would see many people wearing face masks in the city. With the\r\n% COVID-19 pandemic, we see the use of face masks all around the world.\r\n%\r\n% In this entry, my fellow MathWorker, Wanbin, uses deep learning to detect\r\n% whether a mask is being worn. He has a number of live scripts to walk\r\n% through the image labeling process, training process, and testing of the\r\n% model. He includes a pre-trained network that was trained using images\r\n% provided by his colleagues. If you would like to train your own model,\r\n% you should supply your own training images.\r\n%\r\n% He also includes a script for testing the model on a live video captured\r\n% by a webcam. I gave it a try, and his pre-trained network seemed to work\r\n% fine for me.\r\n%\r\n% <<mask_detection_demo2.gif>>\r\n%\r\n% Pretty cool!\r\n%\r\n% *Comments*\r\n%\r\n% Give it a try and let us know what you think\r\n% <http:\/\/blogs.mathworks.com\/pick\/?p=11625#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/76758#comment\r\n% comment> for Wanbin.\r\n\r\n##### SOURCE END ##### b4dee2b837dd41e8a722b5fcad81c8c6\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/jiro\/potw_mask_detection\/mask_detection_demo2.gif\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nJiro's Pick this week is COVID19 Face Mask Detection using Deep Learning by Wanbin Song.Face masks had always been quite common where I'm from. During flu season, I would see many people wearing... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2020\/07\/04\/face-mask-detection-using-deep-learning\/\">read more >><\/a><\/p>","protected":false},"author":35,"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\/11625"}],"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\/35"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=11625"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11625\/revisions"}],"predecessor-version":[{"id":11629,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11625\/revisions\/11629"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=11625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=11625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=11625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}