{"id":1826,"date":"2025-02-17T16:50:35","date_gmt":"2025-02-17T08:50:35","guid":{"rendered":"https:\/\/www.forillusion.com\/?p=1826"},"modified":"2025-02-17T16:50:36","modified_gmt":"2025-02-17T08:50:36","slug":"5-1-conv-layer","status":"publish","type":"post","link":"https:\/\/www.forillusion.com\/index.php\/5-1-conv-layer\/","title":{"rendered":"5.1 \u4e8c\u7ef4\u5377\u79ef\u5c42"},"content":{"rendered":"\n<p><div class=\"has-toc have-toc\"><\/div><\/p>\n\n\n\n<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff08convolutional neural network\uff09\u662f\u542b\u6709\u5377\u79ef\u5c42\uff08convolutional layer\uff09\u7684\u795e\u7ecf\u7f51\u7edc\uff0c\u6700\u5e38\u89c1\u7684\u4e3a\u4e8c\u7ef4\u5377\u79ef\u5c42\u3002\u5b83\u6709\u9ad8\u548c\u5bbd\u4e24\u4e2a\u7a7a\u95f4\u7ef4\u5ea6\uff0c\u5e38\u7528\u6765\u5904\u7406\u56fe\u50cf\u6570\u636e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u7ef4\u4e92\u76f8\u5173\u8fd0\u7b97<\/h2>\n\n\n\n<p>\u867d\u7136\u5377\u79ef\u5c42\u5f97\u540d\u4e8e\u5377\u79ef\uff08convolution\uff09\u8fd0\u7b97\uff0c\u4f46\u901a\u5e38\u5728\u5377\u79ef\u5c42\u4e2d\u4f7f\u7528\u66f4\u52a0\u76f4\u89c2\u7684\u4e92\u76f8\u5173\uff08cross-correlation\uff09\u8fd0\u7b97\u3002\u5728\u4e8c\u7ef4\u5377\u79ef\u5c42\u4e2d\uff0c\u4e00\u4e2a\u4e8c\u7ef4\u8f93\u5165\u6570\u7ec4\u548c\u4e00\u4e2a\u4e8c\u7ef4\u6838\uff08kernel\uff09\u6570\u7ec4\u901a\u8fc7\u4e92\u76f8\u5173\u8fd0\u7b97\u8f93\u51fa\u4e00\u4e2a\u4e8c\u7ef4\u6570\u7ec4\u3002<br>\u4e8c\u7ef4\u4e92\u76f8\u5173\u8fd0\u7b97\u7684\u542b\u4e49\uff1a\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u8f93\u5165\u662f\u4e00\u4e2a\u9ad8\u548c\u5bbd\u5747\u4e3a3\u7684\u4e8c\u7ef4\u6570\u7ec4\u3002\u5c06\u8be5\u6570\u7ec4\u7684\u5f62\u72b6\u8bb0\u4e3a$3 \\times 3$\u6216\uff083\uff0c3\uff09\u3002\u6838\u6570\u7ec4\u7684\u9ad8\u548c\u5bbd\u5206\u522b\u4e3a2\u3002\u8be5\u6570\u7ec4\u5728\u5377\u79ef\u8ba1\u7b97\u4e2d\u53c8\u79f0\u5377\u79ef\u6838\u6216\u8fc7\u6ee4\u5668\uff08filter\uff09\u3002\u5377\u79ef\u6838\u7a97\u53e3\uff08\u53c8\u79f0\u5377\u79ef\u7a97\u53e3\uff09\u7684\u5f62\u72b6\u53d6\u51b3\u4e8e\u5377\u79ef\u6838\u7684\u9ad8\u548c\u5bbd\uff0c\u5373$2 \\times 2$\u3002\u4e0b\u56fe\u4e2d\u7684\u9634\u5f71\u90e8\u5206\u4e3a\u7b2c\u4e00\u4e2a\u8f93\u51fa\u5143\u7d20\u53ca\u5176\u8ba1\u7b97\u6240\u4f7f\u7528\u7684\u8f93\u5165\u548c\u6838\u6570\u7ec4\u5143\u7d20\uff1a$0\\times0+1\\times1+3\\times2+4\\times3=19$\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\"   class=\"lazyload\" data-src=\"https:\/\/cos.forillusion.top\/wp-content\/uploads\/2025\/02\/5.1_correlation.png\" src=\"https:\/\/cdn.forillusion.com\/moezx\/img\/svg\/loader\/trans.ajax-spinner-preloader.svg\" onerror=\"imgError(this)\"  alt=\"\"\/><\/figure >\n<noscript><img decoding=\"async\" src=\"https:\/\/cos.forillusion.top\/wp-content\/uploads\/2025\/02\/5.1_correlation.png\" alt=\"\"\/><\/figure><\/noscript>\n\n\n\n<p>\u5728\u4e8c\u7ef4\u4e92\u76f8\u5173\u8fd0\u7b97\u4e2d\uff0c\u5377\u79ef\u7a97\u53e3\u4ece\u8f93\u5165\u6570\u7ec4\u7684\u6700\u5de6\u4e0a\u65b9\u5f00\u59cb\uff0c\u6309\u4ece\u5de6\u5f80\u53f3\u3001\u4ece\u4e0a\u5f80\u4e0b\u7684\u987a\u5e8f\uff0c\u4f9d\u6b21\u5728\u8f93\u5165\u6570\u7ec4\u4e0a\u6ed1\u52a8\u3002\u5f53\u5377\u79ef\u7a97\u53e3\u6ed1\u52a8\u5230\u67d0\u4e00\u4f4d\u7f6e\u65f6\uff0c\u7a97\u53e3\u4e2d\u7684\u8f93\u5165\u5b50\u6570\u7ec4\u4e0e\u6838\u6570\u7ec4\u6309\u5143\u7d20\u76f8\u4e58\u5e76\u6c42\u548c\uff0c\u5f97\u5230\u8f93\u51fa\u6570\u7ec4\u4e2d\u76f8\u5e94\u4f4d\u7f6e\u7684\u5143\u7d20\u3002\u4e0a\u56fe\u4e2d\u7684\u8f93\u51fa\u6570\u7ec4\u9ad8\u548c\u5bbd\u5206\u522b\u4e3a2\uff0c\u5176\u4e2d\u76844\u4e2a\u5143\u7d20\u7531\u4e8c\u7ef4\u4e92\u76f8\u5173\u8fd0\u7b97\u5f97\u51fa\uff1a<\/p>\n\n\n\n<p>$$<br>0\\times0+1\\times1+3\\times2+4\\times3=19,\\<br>1\\times0+2\\times1+4\\times2+5\\times3=25,\\<br>3\\times0+4\\times1+6\\times2+7\\times3=37,\\<br>4\\times0+5\\times1+7\\times2+8\\times3=43.\\<br>$$<\/p>\n\n\n\n<p>\u4e0b\u9762\u5c06\u4e0a\u8ff0\u8fc7\u7a0b\u5b9e\u73b0\u5728<code>corr2d<\/code>\u51fd\u6570\u91cc\u3002\u5b83\u63a5\u53d7\u8f93\u5165\u6570\u7ec4<code>X<\/code>\u4e0e\u6838\u6570\u7ec4<code>K<\/code>\uff0c\u5e76\u8f93\u51fa\u6570\u7ec4<code>Y<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import torch \nfrom torch import nn\n\ndef corr2d(X, K):\n    h, w = K.shape # \u5377\u79ef\u6838\u7684\u9ad8\u548c\u5bbd\n    Y = torch.zeros((X.shape&#91;0] - h + 1, X.shape&#91;1] - w + 1)) # \u5377\u79ef\u8f93\u51fa\u7684\u9ad8\u548c\u5bbd\n    for i in range(Y.shape&#91;0]): # \u5377\u79ef\u6838\u5728\u8f93\u5165\u6570\u7ec4\u4e0a\u9010\u5143\u7d20\u76f8\u4e58\u5e76\u6c42\u548c\n        for j in range(Y.shape&#91;1]):\n            Y&#91;i, j] = (X&#91;i: i + h, j: j + w] * K).sum()\n    return Y<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u6784\u9020\u56fe5.1\u4e2d\u7684\u8f93\u5165\u6570\u7ec4<code>X<\/code>\u3001\u6838\u6570\u7ec4<code>K<\/code>\u6765\u9a8c\u8bc1\u4e8c\u7ef4\u4e92\u76f8\u5173\u8fd0\u7b97\u7684\u8f93\u51fa\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>X = torch.tensor(&#91;&#91;0, 1, 2], &#91;3, 4, 5], &#91;6, 7, 8]])\nK = torch.tensor(&#91;&#91;0, 1], &#91;2, 3]])\nprint(corr2d(X, K))<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tensor(&#91;&#91;19., 25.],\n        &#91;37., 43.]])<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e8c\u7ef4\u5377\u79ef\u5c42<\/h2>\n\n\n\n<p>\u4e8c\u7ef4\u5377\u79ef\u5c42\u5c06\u8f93\u5165\u548c\u5377\u79ef\u6838\u505a\u4e92\u76f8\u5173\u8fd0\u7b97\uff0c\u5e76\u52a0\u4e0a\u4e00\u4e2a\u6807\u91cf\u504f\u5dee\u6765\u5f97\u5230\u8f93\u51fa\u3002\u5377\u79ef\u5c42\u7684\u6a21\u578b\u53c2\u6570\u5305\u62ec\u4e86\u5377\u79ef\u6838\u548c\u6807\u91cf\u504f\u5dee\u3002\u5728\u8bad\u7ec3\u6a21\u578b\u7684\u65f6\u5019\uff0c\u901a\u5e38\u5148\u5bf9\u5377\u79ef\u6838\u968f\u673a\u521d\u59cb\u5316\uff0c\u7136\u540e\u4e0d\u65ad\u8fed\u4ee3\u5377\u79ef\u6838\u548c\u504f\u5dee\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u57fa\u4e8e<code>corr2d<\/code>\u51fd\u6570\u6765\u5b9e\u73b0\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u4e8c\u7ef4\u5377\u79ef\u5c42\u3002\u5728\u6784\u9020\u51fd\u6570<code>__init__<\/code>\u91cc\u58f0\u660e<code>weight<\/code>\u548c<code>bias<\/code>\u8fd9\u4e24\u4e2a\u6a21\u578b\u53c2\u6570\u3002\u524d\u5411\u8ba1\u7b97\u51fd\u6570<code>forward<\/code>\u5219\u662f\u76f4\u63a5\u8c03\u7528<code>corr2d<\/code>\u51fd\u6570\u518d\u52a0\u4e0a\u504f\u5dee\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Conv2D(nn.Module):\n    def __init__(self, kernel_size):\n        super(Conv2D, self).__init__()\n        self.weight = nn.Parameter(torch.randn(kernel_size)) # \u5377\u79ef\u6838\u53c2\u6570\n        self.bias = nn.Parameter(torch.randn(1)) # \u504f\u5dee\u53c2\u6570\n\n    def forward(self, x):\n        return corr2d(x, self.weight) + self.bias # \u5377\u79ef\u8fd0\u7b97<\/code><\/pre>\n\n\n\n<p>\u5377\u79ef\u7a97\u53e3\u5f62\u72b6\u4e3a$p \\times q$\u7684\u5377\u79ef\u5c42\u79f0\u4e3a$p \\times q$\u5377\u79ef\u5c42\u3002\u540c\u6837\uff0c$p \\times q$\u5377\u79ef\u6216$p \\times q$\u5377\u79ef\u6838\u8bf4\u660e\u5377\u79ef\u6838\u7684\u9ad8\u548c\u5bbd\u5206\u522b\u4e3a$p$\u548c$q$\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u56fe\u50cf\u4e2d\u7269\u4f53\u8fb9\u7f18\u68c0\u6d4b<\/h2>\n\n\n\n<p>\u4e0b\u9762\u6765\u770b\u4e00\u4e2a\u5377\u79ef\u5c42\u7684\u7b80\u5355\u5e94\u7528\uff1a\u68c0\u6d4b\u56fe\u50cf\u4e2d\u7269\u4f53\u7684\u8fb9\u7f18\uff0c\u5373\u627e\u5230\u50cf\u7d20\u53d8\u5316\u7684\u4f4d\u7f6e\u3002\u9996\u5148\u6784\u9020\u4e00\u5f20$6\\times 8$\u7684\u56fe\u50cf\uff08\u5373\u9ad8\u548c\u5bbd\u5206\u522b\u4e3a6\u50cf\u7d20\u548c8\u50cf\u7d20\u7684\u56fe\u50cf\uff09\u3002\u5b83\u4e2d\u95f44\u5217\u4e3a\u9ed1\uff080\uff09\uff0c\u5176\u4f59\u4e3a\u767d\uff081\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>X = torch.ones(6, 8)\nX&#91;:, 2:6] = 0\nprint(X)<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tensor(&#91;&#91;1., 1., 0., 0., 0., 0., 1., 1.],\n        &#91;1., 1., 0., 0., 0., 0., 1., 1.],\n        &#91;1., 1., 0., 0., 0., 0., 1., 1.],\n        &#91;1., 1., 0., 0., 0., 0., 1., 1.],\n        &#91;1., 1., 0., 0., 0., 0., 1., 1.],\n        &#91;1., 1., 0., 0., 0., 0., 1., 1.]])<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u6784\u9020\u4e00\u4e2a\u9ad8\u548c\u5bbd\u5206\u522b\u4e3a1\u548c2\u7684\u5377\u79ef\u6838<code>K<\/code>\u3002\u5f53\u5b83\u4e0e\u8f93\u5165\u505a\u4e92\u76f8\u5173\u8fd0\u7b97\u65f6\uff0c\u5982\u679c\u6a2a\u5411\u76f8\u90bb\u5143\u7d20\u76f8\u540c\uff0c\u8f93\u51fa\u4e3a0\uff1b\u5426\u5219\u8f93\u51fa\u4e3a\u975e0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>K = torch.tensor(&#91;&#91;1, -1]]) # \u5b9a\u4e49\u5377\u79ef\u6838\n# \u5982\u679c\u4e24\u4e2a\u8f93\u5165\u76f8\u540c\uff0c\u90a3\u4e48\u8f93\u51fa\u4e3a0\uff0c\u5426\u5219\u8f93\u51fa\u975e0<\/code><\/pre>\n\n\n\n<p>\u4e0b\u9762\u5c06\u8f93\u5165<code>X<\/code>\u548c\u8bbe\u8ba1\u7684\u5377\u79ef\u6838<code>K<\/code>\u505a\u4e92\u76f8\u5173\u8fd0\u7b97\u3002\u53ef\u4ee5\u770b\u51fa\uff0c\u5c06\u4ece\u767d\u5230\u9ed1\u7684\u8fb9\u7f18\u548c\u4ece\u9ed1\u5230\u767d\u7684\u8fb9\u7f18\u5206\u522b\u68c0\u6d4b\u6210\u4e861\u548c-1\u3002\u5176\u4f59\u90e8\u5206\u7684\u8f93\u51fa\u5168\u662f0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Y = corr2d(X, K)\nprint(Y)<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tensor(&#91;&#91; 0.,  1.,  0.,  0.,  0., -1.,  0.],\n        &#91; 0.,  1.,  0.,  0.,  0., -1.,  0.],\n        &#91; 0.,  1.,  0.,  0.,  0., -1.,  0.],\n        &#91; 0.,  1.,  0.,  0.,  0., -1.,  0.],\n        &#91; 0.,  1.,  0.,  0.,  0., -1.,  0.],\n        &#91; 0.,  1.,  0.,  0.,  0., -1.,  0.]])<\/code><\/pre>\n\n\n\n<p>\u7531\u6b64\uff0c\u53ef\u4ee5\u770b\u51fa\uff0c\u5377\u79ef\u5c42\u53ef\u901a\u8fc7\u91cd\u590d\u4f7f\u7528\u5377\u79ef\u6838\u6709\u6548\u5730\u8868\u5f81\u5c40\u90e8\u7a7a\u95f4\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u901a\u8fc7\u6570\u636e\u5b66\u4e60\u6838\u6570\u7ec4<\/h2>\n\n\n\n<p>\u6700\u540e\u6765\u770b\u4e00\u4e2a\u4f8b\u5b50\uff0c\u5b83\u4f7f\u7528\u7269\u4f53\u8fb9\u7f18\u68c0\u6d4b\u4e2d\u7684\u8f93\u5165\u6570\u636e<code>X<\/code>\u548c\u8f93\u51fa\u6570\u636e<code>Y<\/code>\u6765\u5b66\u4e60\u6784\u9020\u7684\u6838\u6570\u7ec4<code>K<\/code>\u3002\u9996\u5148\u6784\u9020\u4e00\u4e2a\u5377\u79ef\u5c42\uff0c\u5176\u5377\u79ef\u6838\u5c06\u88ab\u521d\u59cb\u5316\u6210\u968f\u673a\u6570\u7ec4\u3002\u63a5\u4e0b\u6765\u5728\u6bcf\u4e00\u6b21\u8fed\u4ee3\u4e2d\uff0c\u4f7f\u7528\u5e73\u65b9\u8bef\u5dee\u6765\u6bd4\u8f83<code>Y<\/code>\u548c\u5377\u79ef\u5c42\u7684\u8f93\u51fa\uff0c\u7136\u540e\u8ba1\u7b97\u68af\u5ea6\u6765\u66f4\u65b0\u6743\u91cd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u6784\u9020\u4e00\u4e2a\u6838\u6570\u7ec4\u5f62\u72b6\u662f(1, 2)\u7684\u4e8c\u7ef4\u5377\u79ef\u5c42\nconv2d = Conv2D(kernel_size=(1, 2))\n\nstep = 20 # \u8bbe\u7f6e\u8d85\u53c2\u6570\nlr = 0.01 # \u5b66\u4e60\u7387\nfor i in range(step):\n    Y_hat = conv2d(X) # \u9884\u6d4b\n    l = ((Y_hat - Y) ** 2).sum() # \u8ba1\u7b97\u635f\u5931\n    l.backward() # \u8ba1\u7b97\u68af\u5ea6\n\n    # \u68af\u5ea6\u4e0b\u964d\uff0c\u4f18\u5316\u53c2\u6570\n    conv2d.weight.data -= lr * conv2d.weight.grad\n    conv2d.bias.data -= lr * conv2d.bias.grad\n\n    # \u68af\u5ea6\u6e050\n    conv2d.weight.grad.fill_(0)\n    conv2d.bias.grad.fill_(0)\n    if (i + 1) % 5 == 0:\n        print('Step %d, loss %.3f' % (i + 1, l.item()))<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Step 5, loss 7.182\nStep 10, loss 1.319\nStep 15, loss 0.292\nStep 20, loss 0.073\nStep 25, loss 0.019\nStep 30, loss 0.005<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c30\u6b21\u8fed\u4ee3\u540e\u8bef\u5dee\u5df2\u7ecf\u964d\u5230\u4e86\u4e00\u4e2a\u6bd4\u8f83\u5c0f\u7684\u503c\u3002\u73b0\u5728\u6765\u770b\u4e00\u4e0b\u5b66\u4e60\u5230\u7684\u5377\u79ef\u6838\u7684\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"weight: \", conv2d.weight.data)\nprint(\"bias: \", conv2d.bias.data)<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>weight:  tensor(&#91;&#91; 0.9829, -0.9805]])\nbias:  tensor(&#91;-0.0013])<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5b66\u5230\u7684\u5377\u79ef\u6838\u7684\u6743\u91cd\u53c2\u6570\u4e0e\u4e4b\u524d\u5b9a\u4e49\u7684\u6838\u6570\u7ec4<code>K<\/code>\u8f83\u63a5\u8fd1\uff0c\u800c\u504f\u7f6e\u53c2\u6570\u63a5\u8fd10\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e92\u76f8\u5173\u8fd0\u7b97\u548c\u5377\u79ef\u8fd0\u7b97<\/h2>\n\n\n\n<p>\u5b9e\u9645\u4e0a\uff0c\u5377\u79ef\u8fd0\u7b97\u4e0e\u4e92\u76f8\u5173\u8fd0\u7b97\u7c7b\u4f3c\u3002<strong>\u4e3a\u4e86\u5f97\u5230\u5377\u79ef\u8fd0\u7b97\u7684\u8f93\u51fa\uff0c\u53ea\u9700\u5c06\u6838\u6570\u7ec4\u5de6\u53f3\u7ffb\u8f6c\u5e76\u4e0a\u4e0b\u7ffb\u8f6c\uff0c\u518d\u4e0e\u8f93\u5165\u6570\u7ec4\u505a\u4e92\u76f8\u5173\u8fd0\u7b97<\/strong>\u3002\u53ef\u89c1\uff0c\u5377\u79ef\u8fd0\u7b97\u548c\u4e92\u76f8\u5173\u8fd0\u7b97\u867d\u7136\u7c7b\u4f3c\uff0c\u4f46\u5982\u679c\u5b83\u4eec\u4f7f\u7528\u76f8\u540c\u7684\u6838\u6570\u7ec4\uff0c\u5bf9\u4e8e\u540c\u4e00\u4e2a\u8f93\u5165\uff0c\u8f93\u51fa\u5f80\u5f80\u5e76\u4e0d\u76f8\u540c\u3002<\/p>\n\n\n\n<p>\u5377\u79ef\u5c42\u80fd\u4f7f\u7528\u4e92\u76f8\u5173\u8fd0\u7b97\u66ff\u4ee3\u5377\u79ef\u8fd0\u7b97\uff1a\u5047\u8bbe\u5377\u79ef\u5c42\u4f7f\u7528\u4e92\u76f8\u5173\u8fd0\u7b97\u5b66\u51fa\u4e0a\u56fe\u4e2d\u7684\u6838\u6570\u7ec4\u3002\u8bbe\u5176\u4ed6\u6761\u4ef6\u4e0d\u53d8\uff0c\u4f7f\u7528\u5377\u79ef\u8fd0\u7b97\u5b66\u51fa\u7684\u6838\u6570\u7ec4\u5373\u4e0a\u56fe\u4e2d\u7684\u6838\u6570\u7ec4\u6309\u4e0a\u4e0b\u3001\u5de6\u53f3\u7ffb\u8f6c\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e0a\u56fe\u4e2d\u7684\u8f93\u5165\u4e0e\u5b66\u51fa\u7684\u5df2\u7ffb\u8f6c\u7684\u6838\u6570\u7ec4\u518d\u505a\u5377\u79ef\u8fd0\u7b97\u65f6\uff0c\u4f9d\u7136\u5f97\u5230\u4e0a\u56fe\u4e2d\u7684\u8f93\u51fa\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7279\u5f81\u56fe\u548c\u611f\u53d7\u91ce<\/h2>\n\n\n\n<p>\u4e8c\u7ef4\u5377\u79ef\u5c42\u8f93\u51fa\u7684\u4e8c\u7ef4\u6570\u7ec4\u53ef\u4ee5\u770b\u4f5c\u662f\u8f93\u5165\u5728\u7a7a\u95f4\u7ef4\u5ea6\uff08\u5bbd\u548c\u9ad8\uff09\u4e0a\u67d0\u4e00\u7ea7\u7684\u8868\u5f81\uff0c\u4e5f\u53eb\u7279\u5f81\u56fe\uff08feature map\uff09\u3002\u5f71\u54cd\u5143\u7d20$x$\u7684\u524d\u5411\u8ba1\u7b97\u7684\u6240\u6709\u53ef\u80fd\u8f93\u5165\u533a\u57df\uff08\u53ef\u80fd\u5927\u4e8e\u8f93\u5165\u7684\u5b9e\u9645\u5c3a\u5bf8\uff09\u53eb\u505a$x$\u7684\u611f\u53d7\u91ce\uff08receptive field\uff09\u3002\u4ee5\u4e0a\u56fe\u4e3a\u4f8b\uff0c\u8f93\u5165\u4e2d\u9634\u5f71\u90e8\u5206\u7684\u56db\u4e2a\u5143\u7d20\u662f\u8f93\u51fa\u4e2d\u9634\u5f71\u90e8\u5206\u5143\u7d20\u7684\u611f\u53d7\u91ce\u3002\u5c06\u4e0a\u56fe\u4e2d\u5f62\u72b6\u4e3a$2 \\times 2$\u7684\u8f93\u51fa\u8bb0\u4e3a$Y$\uff0c\u5e76\u8003\u8651\u4e00\u4e2a\u66f4\u6df1\u7684\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff1a\u5c06$Y$\u4e0e\u53e6\u4e00\u4e2a\u5f62\u72b6\u4e3a$2 \\times 2$\u7684\u6838\u6570\u7ec4\u505a\u4e92\u76f8\u5173\u8fd0\u7b97\uff0c\u8f93\u51fa\u5355\u4e2a\u5143\u7d20$z$\u3002\u90a3\u4e48\uff0c$z$\u5728$Y$\u4e0a\u7684\u611f\u53d7\u91ce\u5305\u62ec$Y$\u7684\u5168\u90e8\u56db\u4e2a\u5143\u7d20\uff0c\u5728\u8f93\u5165\u4e0a\u7684\u611f\u53d7\u91ce\u5305\u62ec\u5176\u4e2d\u5168\u90e89\u4e2a\u5143\u7d20\u3002\u53ef\u89c1\uff0c\u53ef\u4ee5\u901a\u8fc7\u66f4\u6df1\u7684\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\u4f7f\u7279\u5f81\u56fe\u4e2d\u5355\u4e2a\u5143\u7d20\u7684\u611f\u53d7\u91ce\u53d8\u5f97\u66f4\u52a0\u5e7f\u9614\uff0c\u4ece\u800c\u6355\u6349\u8f93\u5165\u4e0a\u66f4\u5927\u5c3a\u5bf8\u7684\u7279\u5f81\u3002<\/p>\n\n\n\n<p>\u5e38\u4f7f\u7528\u201c\u5143\u7d20\u201d\u4e00\u8bcd\u6765\u63cf\u8ff0\u6570\u7ec4\u6216\u77e9\u9635\u4e2d\u7684\u6210\u5458\u3002\u5728\u795e\u7ecf\u7f51\u7edc\u7684\u672f\u8bed\u4e2d\uff0c\u8fd9\u4e9b\u5143\u7d20\u4e5f\u53ef\u79f0\u4e3a\u201c\u5355\u5143\u201d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff08convolutional neural network\uff09\u662f\u542b\u6709\u5377\u79ef\u5c42\uff08convolutional layer\uff09\u7684\u795e &#8230;<\/p>","protected":false},"author":1,"featured_media":1825,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,3],"tags":[45,44,12,22],"class_list":["post-1826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-46","category-3","tag-45","tag-44","tag-12","tag-22"],"_links":{"self":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/comments?post=1826"}],"version-history":[{"count":1,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1826\/revisions"}],"predecessor-version":[{"id":1827,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/posts\/1826\/revisions\/1827"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/media\/1825"}],"wp:attachment":[{"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/media?parent=1826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/categories?post=1826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.forillusion.com\/index.php\/wp-json\/wp\/v2\/tags?post=1826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}