{"id":7985,"date":"2022-09-20T11:46:12","date_gmt":"2022-09-20T03:46:12","guid":{"rendered":"http:\/\/139.9.1.231\/?p=7985"},"modified":"2022-10-10T21:36:59","modified_gmt":"2022-10-10T13:36:59","slug":"vision-mlp-resmlp","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/09\/20\/vision-mlp-resmlp\/","title":{"rendered":"Vision MLP &#8211;ResMLP"},"content":{"rendered":"\n<p><strong><a href=\"https:\/\/arxiv.org\/abs\/2105.03404\" data-type=\"URL\" data-id=\"https:\/\/arxiv.org\/abs\/2105.03404\" target=\"_blank\" rel=\"noreferrer noopener\">Feedforward networks for image classification with data-efficient training<\/a><\/strong><\/p>\n\n\n\n<p>\u6211\u4eec\u63d0\u51fa\u4e86ResMLP\uff0c\u4e00\u79cd\u5b8c\u5168\u57fa\u4e8e\u591a\u5c42\u611f\u77e5\u673a(MLP)\u8fdb\u884c\u56fe\u50cf\u5206\u7c7b\u7684\u4f53\u7cfb\u7ed3\u6784\u3002 \u5b83\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u6b8b\u5dee\u7f51\u7edc\uff0c\u5b83\u4ea4\u66ff\uff08i\uff09\u7ebf\u6027\u5c42\uff0c\u5176\u4e2d\u56fe\u50cf patches\u5728\u901a\u9053\u4e4b\u95f4\u72ec\u7acb\u4e14\u76f8\u540c\u5730\u4ea4\u4e92\uff1b\u4ee5\u53ca\uff08ii\uff09\u4e24\u5c42\u524d\u9988\u7f51\u7edc\uff0c\u5176\u4e2d\u901a\u9053\u4e2d\u7684\u6bcf\u4e2a patch\u72ec\u7acb\u5730\u76f8\u4e92\u4f5c\u7528\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-217.png\" alt=\"\" class=\"wp-image-7988\" width=\"690\" height=\"191\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-217.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-217-300x83.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-217-768x213.png 768w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><\/figure>\n\n\n\n<h2><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/rishikksh20\/ResMLP-pytorch\" target=\"_blank\">CODE:<\/a><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import torch\nimport numpy as np\nfrom resmlp import ResMLP\n\nimg = torch.ones(&#91;1, 3, 224, 224])\n\nmodel = ResMLP(in_channels=3, image_size=224, patch_size=16, num_classes=1000,\n                 dim=384, depth=12, mlp_dim=384*4)\n\nparameters = filter(lambda p: p.requires_grad, model.parameters())\nparameters = sum(&#91;np.prod(p.size()) for p in parameters]) \/ 1_000_000\nprint('Trainable Parameters: %.3fM' % parameters)\n\nout_img = model(img)\n\nprint(\"Shape of out :\", out_img.shape)  # &#91;B, in_channels, image_size, image_size]<\/code><\/pre>\n\n\n\n<p>\u672c\u6587\u4f5c\u8005\u63d0\u51fa\u4e86\u4e00\u79cd\u57fa\u4e8e\u5168\u8fde\u63a5\u5c42\u7684\u56fe\u50cf\u5206\u7c7b\u7f51\u7edc\u3002\u7f51\u7edc\u7ed3\u6784\u4e0eMLP-Mixer\u76f8\u4f3c\uff0c\u5373\u5148\u5c06\u8f93\u5165\u56fe\u50cf\u62c6\u5206\u6210\u82e5\u5e72patch\uff0c\u5bf9\u6bcf\u4e2apatch\u901a\u8fc7\u5168\u8fde\u63a5\u5c42\u8f6c\u6362\u4e3a\u7279\u5f81\u5d4c\u5165\u77e9\u9635\uff0c\u8be5\u77e9\u9635\u7684\u4e24\u4e2a\u7ef4\u5ea6\u5206\u522b\u8868\u793achannel\u7ef4\u5ea6(\u6bcf\u4e2a\u5c40\u90e8\u4f4d\u7f6e\u7684\u7279\u5f81\u7ef4\u5ea6)\u548cpatch\u7ef4\u5ea6(\u8868\u793a\u5c40\u90e8\u4f4d\u7f6e\u7684\u7ef4\u5ea6)\u3002\u9996\u5148\u5c06\u8be5\u77e9\u9635\u8f6c\u7f6e\u540e\u6cbfpatch\u7ef4\u5ea6\u8fdb\u884c\u5168\u8fde\u63a5\u5c42\u8fd0\u7b97\uff0c\u5b9e\u73b0\u4e0d\u540cpatch\u4e4b\u95f4\u7684\u4ea4\u4e92\uff1b\u518d\u6cbfchannel\u7ef4\u5ea6\u8fdb\u884c\u5168\u8fde\u63a5\u8fd0\u7b97\uff0c\u5b9e\u73b0\u4e0d\u540cchannel\u4e4b\u95f4\u7684\u4ea4\u4e92\u3002\u6700\u540e\u4f7f\u7528\u6c60\u5316\u5c42\u548c\u8f93\u51fa\u5c42\u83b7\u5f97\u5206\u7c7b\u7ed3\u679c\u3002\u672c\u6587\u4e0eMLP-Mixer\u7684\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u91c7\u7528\u4e86\u66f4\u5f3a\u7684\u6570\u636e\u589e\u5f3a\u65b9\u6cd5\u548c\u84b8\u998f\u7b56\u7565\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" width=\"1024\" height=\"334\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-218-1024x334.png\" alt=\"\" class=\"wp-image-7992\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-218-1024x334.png 1024w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-218-300x98.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-218-768x250.png 768w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/09\/image-218.png 1366w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u5f53\u91c7\u7528\u73b0\u4ee3\u7684\u8bad\u7ec3\u7b56\u7565\u8fdb\u884c\u8bad\u7ec3\u65f6\uff0c\u4f7f\u7528\u5927\u91cf\u7684\u6570\u636e\u589e\u5e7f\u548c\u53ef\u9009\u7684\u84b8\u998f\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728ImageNet\u4e0a\u83b7\u5f97\u4ee4\u4eba\u60ca\u8bb6\u7684\u826f\u597d\u7cbe\u5ea6\/\u590d\u6742\u5ea6\u6298\u8877\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img src=\"https:\/\/pic3.zhimg.com\/v2-5ef5402f227a6ac0f6947308b72163da_r.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>Affine\u4eff\u5c04\u53d8\u6362\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-43.png\" alt=\"\" class=\"wp-image-9065\" width=\"690\" height=\"147\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-43.png 856w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-43-300x64.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/10\/image-43-768x164.png 768w\" sizes=\"(max-width: 690px) 100vw, 690px\" \/><\/figure>\n\n\n\n<p>\u51fd\u6570\u540d\u79f0\uff1adiag(x)<br>\u51fd\u6570\u529f\u80fd\uff1a\u6784\u5efa\u4e00\u4e2an\u7ef4\u7684\u65b9\u9635\uff0c\u5b83\u7684\u4e3b\u5bf9\u89d2\u7ebf\u5143\u7d20\u503c\u53d6\u81ea\u5411\u91cfx\uff0c\u5176\u4f59\u5143\u7d20\u90fd\u4e3a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Feedforward networks for image classification with data &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/09\/20\/vision-mlp-resmlp\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Vision MLP &#8211;ResMLP<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[30,4,9],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/7985"}],"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=7985"}],"version-history":[{"count":10,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/7985\/revisions"}],"predecessor-version":[{"id":9068,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/7985\/revisions\/9068"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=7985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=7985"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=7985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}