{"id":3659,"date":"2022-04-08T21:38:26","date_gmt":"2022-04-08T13:38:26","guid":{"rendered":"http:\/\/139.9.1.231\/?p=3659"},"modified":"2022-04-08T21:38:28","modified_gmt":"2022-04-08T13:38:28","slug":"depthwisepointwise","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/04\/08\/depthwisepointwise\/","title":{"rendered":"Depthwise\u5377\u79ef\u4e0ePointwise\u5377\u79ef"},"content":{"rendered":"\n<p class=\"has-light-pink-background-color has-background\">Depthwise(DW)\u5377\u79ef\u4e0ePointwise(PW)\u5377\u79ef\uff0c\u5408\u8d77\u6765\u88ab\u79f0\u4f5cDepthwise Separable Convolution(\u53c2\u89c1Google\u7684Xception)\uff0c\u8be5\u7ed3\u6784\u548c\u5e38\u89c4\u5377\u79ef\u64cd\u4f5c\u7c7b\u4f3c\uff0c\u53ef\u7528\u6765\u63d0\u53d6\u7279\u5f81\uff0c\u4f46\u76f8\u6bd4\u4e8e\u5e38\u89c4\u5377\u79ef\u64cd\u4f5c\uff0c\u5176\u53c2\u6570\u91cf\u548c\u8fd0\u7b97\u6210\u672c\u8f83\u4f4e\u3002\u6240\u4ee5\u5728\u4e00\u4e9b\u8f7b\u91cf\u7ea7\u7f51\u7edc\u4e2d\u4f1a\u78b0\u5230\u8fd9\u79cd\u7ed3\u6784\u5982MobileNet\u3002<\/p>\n\n\n\n<p>\u6458\u81ea\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/80041030<\/p>\n\n\n\n<h2><strong>\u5e38\u89c4\u5377\u79ef\u64cd\u4f5c<\/strong><\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u4e00\u5f205\u00d75\u50cf\u7d20\u3001\u4e09\u901a\u9053\u5f69\u8272\u8f93\u5165\u56fe\u7247\uff08shape\u4e3a5\u00d75\u00d73\uff09\u3002\u7ecf\u8fc73\u00d73\u5377\u79ef\u6838\u7684\u5377\u79ef\u5c42\uff08\u5047\u8bbe\u8f93\u51fa\u901a\u9053\u6570\u4e3a4\uff0c\u5219\u5377\u79ef\u6838shape\u4e3a3\u00d73\u00d73\u00d74\uff09\uff0c\u6700\u7ec8\u8f93\u51fa4\u4e2aFeature Map\uff0c\u5982\u679c\u6709same padding\u5219\u5c3a\u5bf8\u4e0e\u8f93\u5165\u5c42\u76f8\u540c\uff085\u00d75\uff09\uff0c\u5982\u679c\u6ca1\u6709\u5219\u4e3a\u5c3a\u5bf8\u53d8\u4e3a3\u00d73\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic1.zhimg.com\/v2-66fe37cf594ec52801e8005b07f959f4_r.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6b64\u65f6\uff0c\u5377\u79ef\u5c42\u51714\u4e2aFilter\uff0c\u6bcf\u4e2aFilter\u5305\u542b\u4e863\u4e2aKernel\uff0c\u6bcf\u4e2aKernel\u7684\u5927\u5c0f\u4e3a3\u00d73\u3002\u56e0\u6b64\u5377\u79ef\u5c42\u7684\u53c2\u6570\u6570\u91cf\u53ef\u4ee5\u7528\u5982\u4e0b\u516c\u5f0f\u6765\u8ba1\u7b97\uff1a<br>N_std = 4 \u00d7 3 \u00d7 3 \u00d7 3 = 108<\/p>\n\n\n\n<h2><strong>Depthwise Separable Convolution<\/strong><\/h2>\n\n\n\n<p class=\"has-light-pink-background-color has-background\">Depthwise Separable Convolution\u662f\u5c06\u4e00\u4e2a\u5b8c\u6574\u7684\u5377\u79ef\u8fd0\u7b97\u5206\u89e3\u4e3a\u4e24\u6b65\u8fdb\u884c\uff0c\u5373Depthwise Convolution\u4e0ePointwise Convolution\u3002<\/p>\n\n\n\n<p><strong>Depthwise Convolution<\/strong>&nbsp;is a type of convolution where we apply a single convolutional filter for each input channel. In the regular 2D&nbsp;<a href=\"https:\/\/paperswithcode.com\/method\/convolution\">convolution<\/a>&nbsp;performed over multiple input channels, the filter is as deep as the input and lets us freely mix channels to generate each element in the output. In contrast, depthwise convolutions keep each channel separate. To summarize the steps, we:<\/p>\n\n\n\n<ol><li>Split the input and filter into channels.<\/li><li>We convolve each input with the respective filter.<\/li><li>We stack the convolved outputs together.<\/li><\/ol>\n\n\n\n<p>\u540c\u4e8e\u5e38\u89c4\u5377\u79ef\u64cd\u4f5c\uff0cDepthwise Convolution\u7684\u4e00\u4e2a\u5377\u79ef\u6838\u8d1f\u8d23\u4e00\u4e2a\u901a\u9053\uff0c\u4e00\u4e2a\u901a\u9053\u53ea\u88ab\u4e00\u4e2a\u5377\u79ef\u6838\u5377\u79ef\u3002\u4e0a\u9762\u6240\u63d0\u5230\u7684\u5e38\u89c4\u5377\u79ef\u6bcf\u4e2a\u5377\u79ef\u6838\u662f\u540c\u65f6\u64cd\u4f5c\u8f93\u5165\u56fe\u7247\u7684\u6bcf\u4e2a\u901a\u9053\u3002<\/p>\n\n\n\n<p>\u540c\u6837\u662f\u5bf9\u4e8e\u4e00\u5f205\u00d75\u50cf\u7d20\u3001\u4e09\u901a\u9053\u5f69\u8272\u8f93\u5165\u56fe\u7247\uff08shape\u4e3a5\u00d75\u00d73\uff09\uff0cDepthwise Convolution\u9996\u5148\u7ecf\u8fc7\u7b2c\u4e00\u6b21\u5377\u79ef\u8fd0\u7b97\uff0c\u4e0d\u540c\u4e8e\u4e0a\u9762\u7684\u5e38\u89c4\u5377\u79ef\uff0cDW\u5b8c\u5168\u662f\u5728\u4e8c\u7ef4\u5e73\u9762\u5185\u8fdb\u884c\u3002\u5377\u79ef\u6838\u7684\u6570\u91cf\u4e0e\u4e0a\u4e00\u5c42\u7684\u901a\u9053\u6570\u76f8\u540c\uff08\u901a\u9053\u548c\u5377\u79ef\u6838\u4e00\u4e00\u5bf9\u5e94\uff09\u3002\u6240\u4ee5\u4e00\u4e2a\u4e09\u901a\u9053\u7684\u56fe\u50cf\u7ecf\u8fc7\u8fd0\u7b97\u540e\u751f\u6210\u4e863\u4e2aFeature map(\u5982\u679c\u6709same padding\u5219\u5c3a\u5bf8\u4e0e\u8f93\u5165\u5c42\u76f8\u540c\u4e3a5\u00d75)\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic2.zhimg.com\/v2-bf151ff051e8ba1c234230ccd5a51d39_r.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5176\u4e2d\u4e00\u4e2aFilter\u53ea\u5305\u542b\u4e00\u4e2a\u5927\u5c0f\u4e3a3\u00d73\u7684Kernel\uff0c\u5377\u79ef\u90e8\u5206\u7684\u53c2\u6570\u4e2a\u6570\u8ba1\u7b97\u5982\u4e0b\uff1a<br>N_depthwise = 3 \u00d7 3 \u00d7 3 = 27<\/p>\n\n\n\n<p>Depthwise Convolution\u5b8c\u6210\u540e\u7684Feature map\u6570\u91cf\u4e0e\u8f93\u5165\u5c42\u7684\u901a\u9053\u6570\u76f8\u540c\uff0c\u65e0\u6cd5\u6269\u5c55Feature map\u3002\u800c\u4e14\u8fd9\u79cd\u8fd0\u7b97\u5bf9\u8f93\u5165\u5c42\u7684\u6bcf\u4e2a\u901a\u9053\u72ec\u7acb\u8fdb\u884c\u5377\u79ef\u8fd0\u7b97\uff0c\u6ca1\u6709\u6709\u6548\u7684\u5229\u7528\u4e0d\u540c\u901a\u9053\u5728\u76f8\u540c\u7a7a\u95f4\u4f4d\u7f6e\u4e0a\u7684feature\u4fe1\u606f\u3002\u56e0\u6b64\u9700\u8981Pointwise Convolution\u6765\u5c06\u8fd9\u4e9bFeature map\u8fdb\u884c\u7ec4\u5408\u751f\u6210\u65b0\u7684Feature map\u3002<\/p>\n\n\n\n<h3><strong>Pointwise Convolution<\/strong>\uff08\u76ee\u7684\uff1a \u5229\u7528\u4e0d\u540c\u901a\u9053\u5728\u76f8\u540c\u7a7a\u95f4\u4f4d\u7f6e\u4e0a\u7684feature\u4fe1\u606f \uff09<\/h3>\n\n\n\n<p>Pointwise Convolution\u7684\u8fd0\u7b97\u4e0e\u5e38\u89c4\u5377\u79ef\u8fd0\u7b97\u975e\u5e38\u76f8\u4f3c\uff0c\u5b83\u7684\u5377\u79ef\u6838\u7684\u5c3a\u5bf8\u4e3a 1\u00d71\u00d7M\uff0cM\u4e3a\u4e0a\u4e00\u5c42\u7684\u901a\u9053\u6570\u3002\u6240\u4ee5\u8fd9\u91cc\u7684\u5377\u79ef\u8fd0\u7b97\u4f1a\u5c06\u4e0a\u4e00\u6b65\u7684map\u5728\u6df1\u5ea6\u65b9\u5411\u4e0a\u8fdb\u884c\u52a0\u6743\u7ec4\u5408\uff0c\u751f\u6210\u65b0\u7684Feature map\u3002\u6709\u51e0\u4e2a\u5377\u79ef\u6838\u5c31\u6709\u51e0\u4e2a\u8f93\u51faFeature map\u3002\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic1.zhimg.com\/v2-767f5e181c73be50b8d58b8ea9086d70_r.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u7531\u4e8e\u91c7\u7528\u7684\u662f1\u00d71\u5377\u79ef\u7684\u65b9\u5f0f\uff0c\u6b64\u6b65\u4e2d\u5377\u79ef\u6d89\u53ca\u5230\u7684\u53c2\u6570\u4e2a\u6570\u53ef\u4ee5\u8ba1\u7b97\u4e3a\uff1a<br>N_pointwise = 1 \u00d7 1 \u00d7 3 \u00d7 4 = 12<\/p>\n\n\n\n<p>\u7ecf\u8fc7Pointwise Convolution\u4e4b\u540e\uff0c\u540c\u6837\u8f93\u51fa\u4e864\u5f20Feature map\uff0c\u4e0e\u5e38\u89c4\u5377\u79ef\u7684\u8f93\u51fa\u7ef4\u5ea6\u76f8\u540c\u3002<\/p>\n\n\n\n<h2><strong>\u53c2\u6570\u5bf9\u6bd4<\/strong><\/h2>\n\n\n\n<p>\u56de\u987e\u4e00\u4e0b\uff0c\u5e38\u89c4\u5377\u79ef\u7684\u53c2\u6570\u4e2a\u6570\u4e3a\uff1a<br>N_std = 4 \u00d7 3 \u00d7 3 \u00d7 3 = 108<\/p>\n\n\n\n<p>Separable Convolution\u7684\u53c2\u6570\u7531\u4e24\u90e8\u5206\u76f8\u52a0\u5f97\u5230\uff1a<br>N_depthwise = 3 \u00d7 3 \u00d7 3 = 27<br>N_pointwise = 1 \u00d7 1 \u00d7 3 \u00d7 4 = 12<br>N_separable = N_depthwise + N_pointwise = 39<\/p>\n\n\n\n<p>\u76f8\u540c\u7684\u8f93\u5165\uff0c\u540c\u6837\u662f\u5f97\u52304\u5f20Feature map\uff0cSeparable Convolution\u7684\u53c2\u6570\u4e2a\u6570\u662f\u5e38\u89c4\u5377\u79ef\u7684\u7ea61\/3\u3002\u56e0\u6b64\uff0c\u5728\u53c2\u6570\u91cf\u76f8\u540c\u7684\u524d\u63d0\u4e0b\uff0c\u91c7\u7528Separable Convolution\u7684\u795e\u7ecf\u7f51\u7edc\u5c42\u6570\u53ef\u4ee5\u505a\u7684\u66f4\u6df1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Depthwise(DW)\u5377\u79ef\u4e0ePointwise(PW)\u5377\u79ef\uff0c\u5408\u8d77\u6765\u88ab\u79f0\u4f5cDepthwise Separab &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/04\/08\/depthwisepointwise\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Depthwise\u5377\u79ef\u4e0ePointwise\u5377\u79ef<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,12],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/3659"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=3659"}],"version-history":[{"count":7,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/3659\/revisions"}],"predecessor-version":[{"id":3666,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/3659\/revisions\/3666"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=3659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=3659"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=3659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}