{"id":1526,"date":"2024-11-12T14:38:57","date_gmt":"2024-11-12T06:38:57","guid":{"rendered":"https:\/\/thereisno.top\/?p=1526"},"modified":"2024-12-19T13:50:53","modified_gmt":"2024-12-19T05:50:53","slug":"%e5%8d%b7%e7%a7%af%e7%a5%9e%e7%bb%8f%e7%bd%91%e7%bb%9c%ef%bc%88%e5%88%86%e7%b1%bb%e7%bd%91%e7%bb%9c%ef%bc%89","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=1526","title":{"rendered":"\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff08\u5206\u7c7b\u7f51\u7edc\uff09"},"content":{"rendered":"\n<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\u662f\u4e00\u79cd\u524d\u9988\u795e\u7ecf\u7f51\u7edc\uff0c\u7528\u4e8e\u56fe\u7247\u5206\u7c7b\u7684\u5377\u79ef\u7f51\u7edc\u4e00\u822c\u5305\u542b\u4e24\u90e8\u5206\uff1a\u5377\u79ef\u90e8\u5206\u548c\u5168\u94fe\u63a5\u90e8\u5206\u3002<\/p>\n\n\n\n<p>\u5377\u79ef\u90e8\u5206\u5c06\u4f20\u7edf\u7684\u5377\u79ef\u64cd\u4f5c\u4e2d\u5377\u79ef\u6838\u7684\u503c\u5f53\u6210\u4e86\u8bad\u7ec3\u7684\u5bf9\u8c61\uff0c\u5e76\u52a0\u5165\u4e86\u6c60\u5316\u5c42\uff0c\u6fc0\u6d3b\u5c42\uff0c\u4e13\u95e8\u7528\u6765\u63d0\u53d6\u56fe\u7247\u7279\u5f81\u3002\u5168\u94fe\u63a5\u90e8\u5206\u5c31\u662f\u666e\u901a\u7684\u795e\u7ecf\u7f51\u7edc\uff0c\u524d\u9762\u4ee5\u56fe\u7247\u7279\u5f81\u4e3a\u8f93\u5165\uff0c\u540e\u9762\u52a0\u4e0asoftmax\u5c42\u6765\u8f93\u51fa\u6bcf\u4e2a\u7c7b\u7684\u6982\u7387\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\u63a8\u7406\u65f6\u53ea\u6709\u524d\u9988\u8fc7\u7a0b\uff1b\u5728\u8bad\u7ec3\u65f6\u591a\u4f7f\u7528\u4e86\u4e00\u4e2a\u540e\u9988\u8fc7\u7a0b\u6765\u66f4\u65b0\u6743\u91cd\uff0c\u8fbe\u5230\u5b66\u4e60\u7684\u76ee\u7684\u3002<\/p>\n\n\n\n<p><strong>\u524d\u9988\u8fc7\u7a0b\uff1a<\/strong><\/p>\n\n\n\n<p><strong>\u56fe\u7247\u9884\u5904\u7406<\/strong><\/p>\n\n\n\n<p>\u8fdb\u5165\u8fd0\u7b97\u4e4b\u524d\uff0c\u56fe\u7247\u5148\u662f\u4ece\u5404\u79cd\u683c\u5f0f\uff0cJPG\uff0cPNG\uff0cBMP\u8f6c\u6362\u6210\u4e3a\u4e00\u4e2a\u5f20\u91cf(Tensor)\u3002\u5f20\u91cf\u7684\u7ef4\u5ea6\u4e00\u822c\u662f\uff08\u56fe\u7247\u9ad8\uff0c\u56fe\u7247\u5bbd\uff0c\u5c42\u6570\uff09\uff0c\u5c42\u6570\u4e00\u822c\u4e3a\uff08R\uff0cG\uff0cB\uff09\u4e09\u5c42\u3002<\/p>\n\n\n\n<p>\u7531\u4e8e\u5168\u94fe\u63a5\u5c42\u7684\u8f93\u5165\u5927\u5c0f\u662f\u56fa\u5b9a\u7684\uff0c\u901a\u5e38\u6539\u53d8\u56fe\u7247\u5c3a\u5bf8\uff0c\u6bd4\u5982\u957f\u5bbdresize\u6210224 * 224\u3002<\/p>\n\n\n\n<p>(\u5982\u679c\u4f60\u7528mini batch\u6765\u8dd1\uff0c\u4e00\u6b21\u6027\u8f93\u5165\u4e00\u4e2abatch\uff0c\u7ef4\u5ea6\u4f1a\u53d8\u6210(batch\u5927\u5c0f\uff0c\u56fe\u7247\u9ad8\uff0c\u56fe\u7247\u5bbd\uff0c\u5c42\u6570))<\/p>\n\n\n\n<p><strong>\u7136\u540e\u8fdb\u884c\u5377\u79ef\u8fd0\u7b97<\/strong><\/p>\n\n\n\n<p><strong>\u6982\u5ff5\uff1apadding<\/strong><\/p>\n\n\n\n<p>\u5377\u79ef\u8fd0\u7b97\u5bf9\u4e8e\u6700\u8fb9\u7f18\u7684\u50cf\u7d20\u4e0d\u662f\u592a\u516c\u5e73\uff0c\u56e0\u4e3a\u4e2d\u95f4\u7684\u50cf\u7d20\u90fd\u80fd\u88ab\u66f4\u591a\u5377\u79ef\u8fd0\u7b97\u8fd0\u7528\u5230\uff0c\u6bd4\u91cd\u66f4\u5927\uff0c\u6240\u4ee5\u53ef\u4ee5\u5728\u5916\u9762\u586b\u5145\u4e00\u5708\u96f6\u3002\uff08\u7c7b\u4f3c\u4e8e\u4f20\u7edf\u5377\u79ef\u8fd0\u7b97\u7684\u8fb9\u7f18\u6548\u5e94\uff09<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u5728\u540c\u6837\u5c3a\u5bf8\u7684\u8f93\u5165\uff0c\u5377\u79ef\u68383*3\uff0cstride\u4e3a(1,1)\u60c5\u51b5\u4e0b\uff0cpadding\u5206\u522b\u4e3a1\uff0c2\u7684\u65f6\u5019\uff1a<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"449\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/same_padding_no_strides.gif\" alt=\"\" class=\"wp-image-1546\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"495\" height=\"576\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/full_padding_no_strides.gif\" alt=\"\" class=\"wp-image-1547\"\/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>\u5de6\u8fb9\u8fd9\u4e2a\u7531\u4e8epadding\u7684\u5b58\u5728\uff0c\u5377\u79ef\u64cd\u4f5c\u7684\u8f93\u5165\u8f93\u51fa\u5c3a\u5bf8\u76f8\u540c\uff0c\u6211\u4eec\u53ebsame padding\u3002<\/p>\n\n\n\n<p><strong>\u6982\u5ff5\uff1astride<\/strong><\/p>\n\n\n\n<p>\u5c31\u662f\u6bcf\u6b21\u5377\u79ef\u64cd\u4f5c\u6bcf\u4e00\u6b21\u79fb\u52a8\u7684\u6b65\u6570\uff0c\u4e0b\u9762\u662f\u5728\u540c\u6837\u76843*3\u5377\u79ef\u6838\uff0cpadding\u4e3a1\u7684\u60c5\u51b5\u4e0b\uff0cstride\u5206\u522b\u4e3a(1,1)\u548c(2,2)\u7684\u65f6\u5019\uff1a<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"449\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/same_padding.gif\" alt=\"\" class=\"wp-image-1552\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"445\" height=\"411\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/padding_strides_odd.gif\" alt=\"\" class=\"wp-image-1553\"\/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p><strong>RGB\u7684\u5377\u79ef\u6838\u64cd\u4f5c\uff1a<\/strong><\/p>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u9488\u5bf9RGB\u7684\u5377\u79ef\u6838\u5176\u5b9e\u662f\u4e09\u5c42\u7684\uff0c\u7ecf\u8fc7\u5377\u79ef\u8fd0\u7b97\u540e\uff0crgb\u4e09\u5c42\u56fe\u7247\u53d8\u6210\u4e86\u4e00\u5c42\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/rgb-conv-1-1024x576.gif\" alt=\"\" class=\"wp-image-1568\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/rgb-conv-1-1024x576.gif 1024w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/rgb-conv-1-300x169.gif 300w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/rgb-conv-1-768x432.gif 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u9884\u89c1\u5982\u679c\u4e2d\u95f4\u7684\u5377\u79ef\u6838\u7684\u8f93\u5165\u662f\u5341\u5c42\uff0c\u90a3\u6211\u4eec\u7684\u6bcf\u4e2a\u5377\u79ef\u6838\u4e5f\u8981\u76f8\u5e94\u7684\u53d8\u6210\u5341\u5c42\uff0c\u6bcf\u4e2a\u5377\u79ef\u7684\u53c2\u6570\u6570\u91cf\u4e5f\u8981\u76f8\u5e94\u589e\u52a0\u3002<\/p>\n\n\n\n<p><strong>\u4e24\u4e2a\u5377\u79ef\u6838\u7684\u60c5\u51b5\u4e0b\uff1a<\/strong><\/p>\n\n\n\n<p>\u7b80\u5355\u7684\u8bb2\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u51e0\u4e2a\u5377\u79ef\u6838(filter)\uff0c\u4e0b\u9762\u5c31\u6709\u51e0\u5c42\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"696\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/conv-multi.gif\" alt=\"\" class=\"wp-image-1555\"\/><\/figure>\n\n\n\n<p><strong>\u6fc0\u6d3b\u51fd\u6570<\/strong><\/p>\n\n\n\n<p>\u5e38\u89c1\u7684\u6fc0\u6d3b\u51fd\u6570\u6709relu\uff0csigmoid\u548ctanh\u7b49\uff0c\u5377\u79ef\u5c42\u5e38\u7528relu\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"357\" height=\"278\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-9.png\" alt=\"\" class=\"wp-image-1533\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-9.png 357w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-9-300x234.png 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/figure>\n\n\n\n<p>&nbsp;Relu\u5bf9\u6b63\u6570\u503c\u7ef4\u6301\u4e00\u4e2a\u7ebf\u6027\u7684\u64cd\u4f5c\uff0c\u8d1f\u6570\u503c\u4f1a\u88ab\u7f6e\u96f6\uff0c\u5373\u4e0d\u4f1a\u88ab\u66f4\u65b0\u3002<\/p>\n\n\n\n<p><strong>\u5377\u79ef\u64cd\u4f5c+\u6fc0\u6d3b\u51fd\u6570 \u4ee3\u7801<\/strong><\/p>\n\n\n\n<p>\u5377\u79ef\u64cd\u4f5c\u540e\u9762\u4e00\u822c\u90fd\u4f1a\u8ddf\u7740\u975e\u7ebf\u5f62\u7684\u6fc0\u6d3b\u51fd\u6570\uff0c\u4e0d\u7136\u5b83\u5377\u79ef\u591a\u5c11\u6b21\u90fd\u662f\u4e2a\u7ebf\u5f62\u51fd\u6570\u3002<\/p>\n\n\n\n<p>\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u4e8632\u4e2a3&#215;3\u7684\u5377\u79ef\u6838\uff0cstride\u4e3a(1,1)\uff0csame padding\uff0c\u6fc0\u6d3b\u51fd\u6570\u4f7f\u7528\u4e86relu\u3002<\/p>\n\n\n\n<p>\u53ef\u4ee5\u9884\u89c1\uff0c\u6211\u4eec\u8fd9\u4e2a\u5377\u79ef\u5c42\u7684\u8f93\u51fa\u4e3a32\u5c42\uff0c\u6bcf\u5c42\u7684\u957f\u5bbd\u4e0e\u524d\u4e00\u5c42\u4e00\u6837\uff0c\u7ecf\u8fc7\u4e86relu\u5c42\u6240\u6709\u7684\u503c\u90fd\u53d8\u6210&gt;=0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>conv1 = tf.layers.conv2d(<br>&nbsp;&nbsp;&nbsp;&nbsp;inputs=prevous_layer,<br>&nbsp;&nbsp;&nbsp;&nbsp;filters=32,<br>&nbsp;&nbsp;&nbsp;&nbsp;kernel_size=&#91;3, 3],<br>&nbsp;&nbsp;&nbsp;&nbsp;strides=(1, 1),<br>&nbsp;&nbsp;&nbsp;&nbsp;padding=\"same\",<br>&nbsp;&nbsp;&nbsp;&nbsp;activation=tf.nn.relu)<\/code><\/pre>\n\n\n\n<p><strong>\u6c60\u5316\u5c42\uff08Pooling Layer\uff09<\/strong><\/p>\n\n\n\n<p>\u4f7f\u7528\u6c60\u5316\u5c42\u5728\u4fdd\u7559\u4e3b\u8981\u7684\u7279\u5f81\u540c\u65f6\u51cf\u5c11\u53c2\u6570\u91cf\uff0c\u4ee5\u51cf\u5c11\u4e0b\u4e00\u5c42\u7684\u8ba1\u7b97\u91cf\uff08\u964d\u7ef4\uff09\u3002\u4e5f\u53ef\u4ee5\u9632\u6b62\u8fc7\u62df\u5408\uff0c\u63d0\u9ad8\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002\u4e0b\u56fe\u6f14\u793a\u5e38\u7528\u7684Max Pooling<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"543\" height=\"544\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/maxpool.gif\" alt=\"\" class=\"wp-image-1556\"\/><\/figure>\n\n\n\n<p>\u7279\u6b8a\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u4f7f\u7528SSP(Spatial Pyramid Pooling)\u7684\u8bdd\uff0c\u53ef\u4ee5\u65e0\u89c6\u4e0a\u4e00\u5c42\u7684\u957f\u5bbd\uff0c\u5f97\u5230\u56fa\u5b9a\u957f\u5bbd\u7684\u8f93\u51fa\u3002<\/p>\n\n\n\n<p>Ps. \u73b0\u5728\u4e5f\u6d41\u884c\u4f7f\u7528\u7a7a\u6d1e\u5377\u79ef\u8fdb\u884c\u964d\u7ef4\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"381\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/dilated_conv.gif\" alt=\"\" class=\"wp-image-1557\"\/><\/figure>\n\n\n\n<p><strong>\u5377\u79ef\u5c42\u540e\u9762\u662fFlatten\u5c42<\/strong><\/p>\n\n\n\n<p>\u505a\u5b8c\u5377\u79ef\u8fd0\u7b97\uff0c\u7ed3\u679c\u662f\u597d\u51e0\u5c42\u7279\u5f81\u56fe\u50cf\uff0c\u56fe\u50cf\u7684\u7279\u5f81\u63d0\u53d6\u5230\u6b64\u7ed3\u675f\u3002\u7136\u540e\u6211\u4eec\u4f7f\u7528Flatten\u5c06\u5b83\u4eecreshape\u6210\u4e00\u7ef4\u6570\u636e\uff0c\u4ee5\u4fbf\u4f5c\u4e3a\u540e\u9762\u5168\u94fe\u63a5\u5c42\u7684\u8f93\u5165\u3002\uff08Ps.\u5176\u5b9e\u53ef\u4ee5\u628a\u540e\u9762\u7684\u5168\u94fe\u63a5\u5c42\u6362\u6210SVM\u554a \u51b3\u7b56\u6811\u554a\uff09\uff08Ps.\u7279\u5f81\u7684\u4f4d\u7f6e\u4fe1\u606f\u5176\u5b9e\u8fd8\u662f\u4fdd\u7559\u5728\u6bcf\u4e2a\u7279\u5f81\u7684\u6392\u5217\u987a\u5e8f\u4e0a\u9762\u7684\uff09\u3002<\/p>\n\n\n\n<p>Flatten\u5c42\u5728\u8fd9\u91cc\u7684\u4f5c\u7528\uff0c\u662f\u8fde\u63a5\u5377\u79ef\u5c42\u548c\u5168\u94fe\u63a5\u5c42\u3002<\/p>\n\n\n\n<p><strong>\u7136\u540e\u662f\u5168\u8fde\u63a5\u5c42<\/strong><\/p>\n\n\n\n<p>\u4e00\u822c\u662f\u666e\u901a\u7684\u5168\u94fe\u63a5\u795e\u7ecf\u7f51\u7edc\uff0c\u8f93\u5165\u4e3aFlatten\u4e4b\u540e\u7684\u4e00\u7ef4\u7684\u56fe\u7247\u7279\u5f81\uff0c\u8f93\u51fa\u5c42\u4e00\u822c\u662fSigmoid\u5c42\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"583\" height=\"444\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-12.png\" alt=\"\" class=\"wp-image-1536\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-12.png 583w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-12-300x228.png 300w\" sizes=\"auto, (max-width: 583px) 100vw, 583px\" \/><\/figure>\n\n\n\n<p><strong>\u7136\u540e\u662fsoftmax\u5c42\uff08\u5206\u7c7b\u95ee\u9898\uff09<\/strong><\/p>\n\n\n\n<p>\u5c06\u5168\u94fe\u63a5\u5c42\u7684\u8f93\u51fa\uff0c\u8fdb\u884csoftmax\u8fd0\u7b97\uff0c\u5f97\u5230\u6bcf\u4e2a\u7c7b\u7684\u6982\u7387\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"238\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-13.png\" alt=\"\" class=\"wp-image-1537\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-13.png 462w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-13-300x155.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/figure>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>\u03c3<\/mi><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><mi>j<\/mi><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><mo>=<\/mo><mfrac><mrow><mo>exp<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><msubsup><mstyle mathvariant=\"bold\"><mi>\ud835\udc30<\/mi><\/mstyle><mi>j<\/mi><mi>\u22a4<\/mi><\/msubsup><mstyle mathvariant=\"bold\"><mi>\ud835\udc31<\/mi><\/mstyle><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><mrow><munderover><mo>\u2211<\/mo><mrow><mi>k<\/mi><mo>=<\/mo><mn>1<\/mn><\/mrow><mi>K<\/mi><\/munderover><mo>exp<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><msubsup><mstyle mathvariant=\"bold\"><mi>\ud835\udc30<\/mi><\/mstyle><mi>k<\/mi><mi>\u22a4<\/mi><\/msubsup><mstyle mathvariant=\"bold\"><mi>\ud835\udc31<\/mi><\/mstyle><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><\/mfrac><mo>=<\/mo><mfrac><mrow><mo>exp<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><msub><mi>z<\/mi><mi>j<\/mi><\/msub><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><mrow><munderover><mo>\u2211<\/mo><mrow><mi>k<\/mi><mo>=<\/mo><mn>1<\/mn><\/mrow><mi>K<\/mi><\/munderover><mo>exp<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><msub><mi>z<\/mi><mi>k<\/mi><\/msub><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><\/mfrac><\/mrow><annotation encoding=\"application\/x-tex\">\n\\sigma(j)=\\frac{\\exp(\\mathbf{w}_j^\\top \\mathbf x)}{\\sum_{k=1}^K \\exp(\\mathbf{w}_k^\\top\\mathbf x)}=\\frac{\\exp(z_j)}{\\sum_{k=1}^K \\exp(z_k)}\n<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p>\u7531\u8fd9\u4e2a\u7b49\u5f0f\u53ef\u4ee5\u770b\u51fa\uff0c\u5728\u4e8c\u5206\u7c7b\u7684\u65f6\u5019\uff0csoftmax\u51fd\u6570\u5176\u5b9e\u5c31\u662fsigmoid\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import&nbsp;numpy&nbsp;as&nbsp;np\n\nz&nbsp;=&nbsp;&#91;2.0,&nbsp;1.0,&nbsp;0.1]\nprint(np.exp(z))&nbsp;&nbsp;# &#91;7.3890561&nbsp;&nbsp;2.71828183 1.10517092]\nsoftmax&nbsp;=&nbsp;np.exp(z)\/np.sum(np.exp(z))\nprint(softmax)&nbsp;&nbsp;&nbsp;&nbsp;# &#91;0.65900114 0.24243297 0.09856589]<\/code><\/pre>\n\n\n\n<p><strong>\u7136\u540e\u8ba1\u7b97 Loss\u503c<\/strong><\/p>\n\n\n\n<p>Loss\u51fd\u6570\u6709\u5f88\u591a\u79cd\uff0c\u53ef\u4ee5\u7531\u4f60\u81ea\u5df1\u6839\u636e\u76ee\u6807\u5b9a\u4e49\u3002\u4e00\u822c\u591a\u5206\u7c7b\u95ee\u9898\u6211\u4eec\u4f7f\u7528cross entropy\u3002<\/p>\n\n\n\n<p>y\u2019\u4e3a\u9884\u6d4b\u7ed3\u679c\uff0cy\u4e3a\u771f\u5b9e\u503c\uff0cy\u2018\u4e0ey\u6c42\u5f97cross entropy\u7684\u503c\u3002<\/p>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>H<\/mi><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><mi>y<\/mi><mi>\u2032<\/mi><mo>,<\/mo><mi>y<\/mi><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><mo>:=<\/mo><mo>\u2212<\/mo><munder><mo>\u2211<\/mo><mi>i<\/mi><\/munder><msub><mi>y<\/mi><mi>i<\/mi><\/msub><mi>\u2032<\/mi><mo>log<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><msub><mi>y<\/mi><mi>i<\/mi><\/msub><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><annotation encoding=\"application\/x-tex\">\nH(y&#39;,y) := &#8211; \\sum_{i} y_{i}&#39; \\log (y_i)\n<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import&nbsp;numpy&nbsp;as&nbsp;np\n\nY&nbsp;=&nbsp;np.array(&#91;1,&nbsp;0,&nbsp;0])&nbsp;#&nbsp;\u771f\u5b9e\u7c7b\u522b\u4e3a\u7b2c\u4e00\u7c7b\n\nY_pred1&nbsp;=&nbsp;np.array(&#91;0.7,&nbsp;0.2,&nbsp;0.1])&nbsp;#&nbsp;\u9884\u6d4b1\nY_pred2&nbsp;=&nbsp;np.array(&#91;0.1,&nbsp;0.3,&nbsp;0.6])&nbsp;#&nbsp;\u9884\u6d4b2\n\nprint('\u9884\u6d4b1 loss = ', np.sum(-Y&nbsp;*&nbsp;np.log(Y_pred1)))&nbsp;&nbsp;#&nbsp;\u9884\u6d4b1 loss = 0.35\nprint('\u9884\u6d4b2 loss = ', np.sum(-Y&nbsp;*&nbsp;np.log(Y_pred2)))&nbsp;&nbsp;#&nbsp;\u9884\u6d4b2 loss = 2.30<\/code><\/pre>\n\n\n\n<p><strong>\u540e\u9988\u8fc7\u7a0b:<\/strong><\/p>\n\n\n\n<p><strong>\u4f18\u5316\u7f51\u7edc\uff0c\u6539\u53d8Weights\uff0c\u8ba9Loss\u53d8\u5c0f<\/strong><\/p>\n\n\n\n<p>\u6539\u53d8\u795e\u7ecf\u7f51\u7edc\u4e2d\u7684\u6743\u91cdweights\uff0c\u6765\u4f18\u5316\u6211\u4eec\u7684Loss\u503c\uff0c\u4f7f\u5b83\u53d8\u5c0f\u3002 \u90a3\u4e48\u600e\u6837\u4f18\u5316\u5462 \uff1f<\/p>\n\n\n\n<p>\u8ba9\u6211\u4eec\u628a\u6574\u4e2a\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff0c\u4ece\u5934\u5230\u5c3e\u6574\u4e2a\u524d\u9988\u8fc7\u7a0b\uff0c\u770b\u6210\u4e00\u4e2a\u6570\u5b66\u516c\u5f0f\u3002\u53d8\u91cf\u4e3a\u6743\u91cdWeights\uff0c\u7ed3\u679c\u4e3aLoss\u503c\u3002\u6211\u4eec\u60f3\u8981\u5f97\u5230\u6700\u5c0f\u7684Loss\u503c\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u8fd9\u4e2a\u6570\u5b66\u516c\u5f0f\u8fdb\u884c\u6c42\u5bfc\uff0c\u53ef\u662f\u8fd9\u4e2a\u4f18\u5316\u95ee\u9898\u662f\u4e2anp hard\u95ee\u9898\uff0c\u60f3\u7b80\u5355\u7684\u6765\u4e2a\u5bfc\u6570\u4e3a\u96f6\u2026\u8fd9\u4e2a\u7b49\u5f0f\u89e3\u4e0d\u51fa\u6765\uff0c\u6240\u4ee5\u6211\u4eec\u91c7\u7528\u4e86\u68af\u5ea6\u4e0b\u964d\u6cd5\u3002<\/p>\n\n\n\n<p>\u7b80\u5355\u7684\u8bb2\uff0c\u5bf9\u6bcf\u4e00\u4e2a\u53d8\u91cf\uff08\u6743\u91cdWeights\uff09\u6c42<math display=\"inline\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mfrac><mrow><mi>\u0394<\/mi><mi>L<\/mi><mi>o<\/mi><mi>s<\/mi><mi>s<\/mi><\/mrow><mrow><mi>\u0394<\/mi><mi>w<\/mi><\/mrow><\/mfrac><annotation encoding=\"application\/x-tex\">\\frac{\\Delta Loss}{\\Delta w}<\/annotation><\/semantics><\/math>,\u7136\u540e\u6211\u4eec\u8ba9\u8fd9\u4e2a\u6743\u91cd\u6309\u7167\u8fd9\u4e2a\u503c\u7684\u76f8\u53cd\u65b9\u5411\u8fd0\u52a8\uff0c\u4ee5\u8fbe\u5230\u51cf\u5c0fLoss\u7684\u6548\u679c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"432\" height=\"288\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/gd.gif\" alt=\"\" class=\"wp-image-1562\"\/><\/figure>\n\n\n\n<p>&nbsp;\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5de6\u8fb9\u7684\u5bfc\u6570\u503c\u90fd\u662f\u8d1f\u7684\uff0c\u6211\u4eec\u5c31\u8bb2weight\u5f80\u76f8\u53cd\u65b9\u5411\uff08\u6b63\u65b9\u5411\uff09\u8fd0\u52a8\uff0c\u5f97\u5230\u6700\u5c0f\u503c\u3002<\/p>\n\n\n\n<p><strong>\u5177\u4f53\u4e00\u70b9<\/strong><\/p>\n\n\n\n<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\u7684\u524d\u4e00\u5c42\u7684\u7ed3\u679c\uff0c\u662f\u540e\u4e00\u5c42\u7684\u8f93\u5165\u3002\u6211\u4eec\u628a\u6bcf\u4e00\u5c42\u770b\u6210\u4e00\u4e2a\u51fd\u6570\uff0c\u591a\u5c42\u795e\u7ecf\u7f51\u7edc\u5176\u5b9e\u5c31\u662f\u5f88\u591a\u4e2a\u51fd\u6570\u7684\u5d4c\u5957\uff0c\u53ef\u4ee5\u770b\u6210\u4e00\u4e2a\u590d\u5408\u51fd\u6570\u3002\u6211\u4eec\u9ad8\u4e2d\u5c31\u5b66\u8fc7\uff0c\u8fd9\u6837\u7684\u6c42\u5bfc\u53ef\u4ee5\u9075\u5faa\u94fe\u5f0f\u6cd5\u5219\uff08Chain Rule\uff09\u3002\u6211\u4eec\u4e00\u5c42\u4e00\u5c42\u7684\u6c42\u5bfc\uff0c\u4e00\u6b65\u6b65\u6765\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u5b9a\u4e49\u4e86\u5b66\u4e60\u7387 learning rate\uff0c \u6bcf\u6b21\u7684\u8fed\u4ee3\u66f4\u65b0\u6bcf\u4e2a\u6743\u91cdw\uff0c<\/p>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msup><mi>w<\/mi><mrow><mi>n<\/mi><mi>e<\/mi><mi>w<\/mi><\/mrow><\/msup><mo>=<\/mo><msup><mi>w<\/mi><mrow><mi>o<\/mi><mi>l<\/mi><mi>d<\/mi><\/mrow><\/msup><mo>\u2212<\/mo><mi>l<\/mi><mi>e<\/mi><mi>a<\/mi><mi>r<\/mi><mi>n<\/mi><mi>i<\/mi><mi>n<\/mi><mi>g<\/mi><mi>_<\/mi><mi>r<\/mi><mi>a<\/mi><mi>t<\/mi><mi>e<\/mi><mo>*<\/mo><mfrac><mrow><mi>\u0394<\/mi><mi>L<\/mi><mi>o<\/mi><mi>s<\/mi><mi>s<\/mi><\/mrow><mrow><mi>\u0394<\/mi><mi>w<\/mi><\/mrow><\/mfrac><\/mrow><annotation encoding=\"application\/x-tex\">\nw^{new} =w^{old} &#8211; learning\\_rate * \\frac{\\Delta Loss}{ \\Delta w}\n<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p><strong>\u4e00\u4e2a\u4e2a\u6c42\u5bfc\u592a\u6162\uff1f\u6211\u4eec\u7528\u4f18\u5316\u5668\u6765\u52a0\u901f<\/strong><\/p>\n\n\n\n<p><strong>Batch gradient descent\uff08BGD \u6279\u91cf\u68af\u5ea6\u4e0b\u964d\u6cd5\uff09<\/strong><\/p>\n\n\n\n<p>\u6bcf\u6b21\u66f4\u65b0\u8ba1\u7b97\u6574\u4e2a\u6837\u672c\u96c6\u7684\u68af\u5ea6\uff0c\u5e94\u8be5\u8bf4\u8fd9\u4e5f\u662f\u68af\u5ea6\u4e0b\u964d\u7b97\u6cd5\u7684\u521d\u8877\uff0c\u6309\u7167\u6574\u4f53\u68af\u5ea6\u4e0b\u964d\u7684\u65b9\u5411\u8c03\u6574\u53c2\u6570\u3002\u53ef\u662f\u56e0\u4e3a\u6bcf\u6b21\u90fd\u8981\u8ba1\u7b97\u6240\u6709\u6570\u636e\u7684\u68af\u5ea6\uff0c\u8ba1\u7b97\u91cf\u8f83\u5927\uff0c\u8ba1\u7b97\u901f\u5ea6\u6bd4\u8f83\u6162\uff1b\u5e76\u4e14\u8ba1\u7b97\u8fc7\u7a0b\u4e2d\u4e0d\u80fd\u6dfb\u52a0\u65b0\u7684\u6837\u672c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"277\" height=\"48\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-15.png\" alt=\"\" class=\"wp-image-1539\"\/><\/figure>\n\n\n\n<p><strong>Stochastic gradient descent (SGD \u968f\u673a\u68af\u5ea6\u4e0b\u964d\u6cd5)<\/strong><\/p>\n\n\n\n<p>\u548cBGD\u7684\u4e00\u6b21\u4f7f\u7528\u6240\u6709\u6837\u672c\u8ba1\u7b97\u68af\u5ea6\u76f8\u6bd4\uff0cSGD\u4e00\u6b21\u53ea\u4f7f\u7528\u4e00\u4e2a\u6837\u672c\u8fdb\u884c\u68af\u5ea6\u66f4\u65b0\uff0c \u8fd9\u6837\u5355\u6b21\u7684\u6743\u91cd\u4f18\u5316\u8fd0\u7b97\u4f1a\u6bd4\u8f83\u5feb\uff1b\u5e76\u4e14\u8fd0\u7b97\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u65b0\u589e\u6837\u672c\u3002<\/p>\n\n\n\n<p>\u53ef\u662f\u6837\u672c\u95f4\u7684\u5dee\u5f02\uff0c\u8fd8\u4f1a\u6709\u4e00\u4e9b\u566a\u58f0\u6570\u636e\uff0c\u5bfc\u81f4\u68af\u5ea6\u4e0b\u964d\u7684\u8fc7\u7a0b\u4f1a\u6bd4\u8f83\u66f2\u6298\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"45\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-16.png\" alt=\"\" class=\"wp-image-1540\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-16.png 326w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-16-300x41.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure>\n\n\n\n<p><strong>Mini-batch gradient descent \uff08MBGD \u5c0f\u6279\u91cf\u68af\u5ea6\u4e0b\u964d\u6cd5\uff09<\/strong><\/p>\n\n\n\n<p>MBGD\u662f\u524d\u4e24\u79cd\u65b9\u6cd5\u7684\u6298\u8877\uff0c\u6bcf\u6b21\u4f7f\u7528\u4e00\u5c0f\u6279\u6837\u672c\u6765\u8ba1\u7b97\u3002\u63d0\u9ad8\u4e86\u68af\u5ea6\u4e0b\u964d\u7684\u901f\u5ea6\u90fd\u540c\u65f6\uff0c\u53c8\u517c\u987e\u4e86\u6536\u655b\u7684\u7a33\u5b9a\u6027\u3002\u800c\u4e14\u53ef\u4ee5\u7528\u5230\u77e9\u9635\u8fd0\u7b97\uff0c\u5145\u5206\u5229\u7528GPU\u51e0\u5343\u4e2aCuda\u6838\u5fc3\u8fdb\u884c\u5e76\u884c\u8fd0\u7b97\u6765\u52a0\u901f\u8fd0\u7b97\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"49\" src=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-17.png\" alt=\"\" class=\"wp-image-1541\" srcset=\"https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-17.png 355w, https:\/\/thereisno.top\/wp-content\/uploads\/2024\/11\/image-17-300x41.png 300w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/figure>\n\n\n\n<p>\uff08\u6211\u4eec\u73b0\u5728\u8bad\u7ec3\u4f7f\u7528\u7684\u5e26\u6709Batch Size\u7684SGD\uff0c\u5176\u5b9e\u5c31\u662fMBGD\uff09<\/p>\n\n\n\n<p><strong>\u68af\u5ea6\u4e0b\u964d\u7684\u7f3a\u70b9<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b66\u4e60\u7387\u7684\u9009\u62e9\u975e\u5e38\u56f0\u96be\u3002\u5982\u679c\u8bbe\u592a\u5c0f\uff0c\u6536\u655b\u4f1a\u975e\u5e38\u7f13\u6162\uff1b\u5982\u679c\u8bbe\u592a\u5927\uff0c\u53ef\u80fd\u4f1a\u5728\u6781\u5c0f\u503c\u5904\u9707\u8361\u751a\u81f3\u504f\u79bb\u3002\uff08\u4e8e\u662f\u6211\u4eec\u60f3\u5728\u79bb\u6781\u5c0f\u503c\u8fdc\u7684\u5730\u65b9\u91c7\u7528\u8f83\u5927\u5b66\u4e60\u7387\uff0c\u5728\u8f83\u8fd1\u5904\u91c7\u7528\u8f83\u5c0f\u5b66\u4e60\u7387\u3002\uff09<\/li>\n\n\n\n<li>\u53ef\u4ee5\u9884\u5148\u5236\u5b9a\u5b66\u4e60\u7387\u53d8\u5316\u89c4\u5219\u3002\u6bd4\u5982\uff0c\u8ba1\u7b9750\u8f6e\u4e4b\u540e\uff0c\u5b66\u4e60\u7387\u51cf\u534a\u3002\u4f46\u662f\u8fd9\u79cd\u65b9\u6cd5\u5e76\u4e0d\u80fd\u5f97\u5230\u4fdd\u8bc1\uff0c50\u8f6e\u4e4b\u540e\u53ef\u80fd\u4f9d\u7136\u79bb\u6781\u5c0f\u503c\u5f88\u8fdc\u3002<\/li>\n\n\n\n<li>\u9700\u8981\u5c3d\u91cf\u907f\u514d\u4f7fLoss\u503c\u6536\u655b\u5230\u4f18\u5316\u5c40\u90e8\u6700\u4f18\uff0c\u751a\u81f3\u978d\u70b9\uff08\u4e24\u8005\u548c\u5168\u5c40\u6700\u4f18\u4e00\u6837\uff0cgradient\u90fd\u662f0\uff09<\/li>\n<\/ul>\n\n\n\n<p><strong>\u68af\u5ea6\u4e0b\u964d\u7684\u4f18\u5316\u7b97\u6cd5:<\/strong><\/p>\n\n\n\n<p>\u5982\u679c\u628a\u591a\u6b21\u7684\u68af\u5ea6\u4e0b\u964d\u770b\u6210\u4e00\u4e2a\u65f6\u5e8f\u95ee\u9898\uff0c\u9ed8\u9ed8\u62ff\u51fa\u5bf9\u4ed8\u65f6\u5e8f\u95ee\u9898\u7684\u5200\u67aa\u5251\u621f\u3002\u3002\u3002<\/p>\n\n\n\n<p><strong>Exponentially weighted averges \u6307\u6570\u52a0\u6743\u5e73\u5747<\/strong><\/p>\n\n\n\n<p>\u6307\u6570\u52a0\u6743\u5e73\u5747\u662f\u4e00\u79cd\u975e\u5e38\u5e38\u89c1\u7684\u5e8f\u5217\u6570\u636e\u5904\u7406\u65b9\u5f0f\uff0c\u6bd4\u5982\u9884\u6d4b\u80a1\u4ef7\u3002\u53c2\u6570\u4e3a\u03b2\uff0c\u53ef\u4ee5\u7528\u6765\u77ed\u671f(\u8fd9\u91cc\u662f\u5c40\u90e8)\u6ce2\u52a8\u7684\u5e72\u6270\uff0c\u4fdd\u7559\u957f\u671f(\u8fd9\u91cc\u662f\u5168\u5c40)\u8d8b\u52bf\u3002\u53ef\u4ee5\u7528\u6765\u8ba1\u7b97\u4e0b\u4e00\u4e2a\u65f6\u523b\u7684\u9884\u6d4b\u503c\u3002<\/p>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>v<\/mi><mi>t<\/mi><\/msub><mo>=<\/mo><mi>\u03b2<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>+<\/mo><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><mn>1<\/mn><mo>\u2212<\/mo><mi>\u03b2<\/mi><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><msub><mi>\u03b8<\/mi><mi>t<\/mi><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\nv_{t} = \\beta v_{t-1} + (1-\\beta)\\theta_{t}<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p> \u516c\u5f0f\u7b80\u5355\uff0c\u53ea\u9700\u4fdd\u7559\u4e0a\u4e00\u4e2a\u503c<math display=\"inline\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">v_{t-1}<\/annotation><\/semantics><\/math>,\u03b2\n \u4e3a\u4e4b\u524d\u7684\u72b6\u6001\u7684\u6743\u91cd\uff0c\u76f8\u5e94\u76841\u2212\u03b2\u4e3a\u5f53\u524d\u72b6\u6001\u7684\u6743\u91cd; \u03b2\u8d8a\u5927\u5219\u8d8a\u5e73\u6ed1\uff0c\u4f46\u662f\u53ef\u80fd\u5bf9\u77ed\u671f\u7684\u53d8\u5316\u975e\u5e38\u4e0d\u654f\u611f\u3002\u6df1\u5ea6\u5b66\u4e60\u4e2d\uff0c\u4e00\u822c\u03b2\u53d6\u503c0.9\u5de6\u53f3\u3002<\/p>\n\n\n\n<p><strong>Momentum \u52a8\u91cf<\/strong><\/p>\n\n\n\n<p>\u60f3\u50cf\u6210\u5c0f\u7403\u5728\u5411\u5c71\u4e0b\u6eda\u52a8\u7684\u8fc7\u7a0b\uff0c\u4e2d\u9014\u4f1a\u6709\u5f88\u591a\u969c\u788d\u7269\u6539\u53d8\u5b83\u7684\u524d\u8fdb\u65b9\u5411\uff0c\u4f46\u662f\u5b83\u5927\u4f53\u4e0a\u7684\u524d\u8fdb\u65b9\u5411\u662f\u6cbf\u7740\u5761\u5411\u4e0b\u7684\u3002\u5728\u6709\u201d\u60ef\u6027\u201d\u7684\u60c5\u51b5\u4e0b\uff0c\u5b83\u7684\u65b9\u5411\u4f1a\u66f4\u7a33\u5b9a\u5411\u4e0b\uff0c\u901f\u5ea6\u4e5f\u4f1a\u66f4\u5feb\u3002<\/p>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>v<\/mi><mi>t<\/mi><\/msub><mo>=<\/mo><mi>\u03b3<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>+<\/mo><mi>\u03b7<\/mi><msub><mi>\u2207<\/mi><mi>\u03b8<\/mi><\/msub><mi>J<\/mi><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><mi>\u03b8<\/mi><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><annotation encoding=\"application\/x-tex\">\nv_{t} = \\gamma v_{t-1} + \\eta \\nabla_\\theta J( \\theta)\n<\/annotation><\/semantics><\/math><\/p>\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>\u03b8<\/mi><mi>t<\/mi><\/msub><mo>=<\/mo><msub><mi>\u03b8<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>\u2212<\/mo><msub><mi>v<\/mi><mi>t<\/mi><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\n\\theta_{t} = \\theta_{t-1} &#8211; v_t\n<\/annotation><\/semantics><\/math><\/p>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5f53\u6b21\u7684\u68af\u5ea6\u7684\u524d\u8fdb\u65b9\u5411\u4f1a\u52a0\u4e0a\u4e0a\u4e00\u6b65\u7684\u524d\u8fdb\u65b9\u5411\u4e58\u4ee5 \u03b3, \u4e00\u822c \u03b3 \u53d6\u503c 0.9 \u5de6\u53f3\u3002<\/p>\n\n\n\n<p><strong>Nesterov accelerated gradient (NAG\uff0c\u5728Momentum\u57fa\u7840\u4e0a\u5c0f\u6539\uff0c\u518d\u52a0\u901f)<\/strong><\/p>\n\n\n\n<p>\u4e0d\u6ee1\u8db3\u4e8e\u4f9d\u8d56\u60ef\u6027\uff0c\u66f4\u662f\u628a<math display=\"inline\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>\u03b3<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\\gamma v_{t-1}<\/annotation><\/semantics><\/math>\u5f53\u6210\u672c\u6b21\u79fb\u52a8\u91cf\u7684\u9884\u6d4b\uff0c\u4e8e\u662f\u628a<math display=\"inline\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><mi>\u03b8<\/mi><mo>\u2212<\/mo><mi>\u03b3<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\n\\theta &#8211; \\gamma v_{t-1}\n<\/annotation><\/semantics><\/math> \u5f53\u6210\u68af\u5ea6\u4e0b\u4e00\u4e2a\u503c\u7684\u9884\u6d4b\uff0c\u5e76\u4ece\u8fd9\u4e2a\u503c\u5f00\u59cb\u8ba1\u7b97\u4e0b\u4e00\u4e2a\u4f4d\u7f6e\u3002\u611f\u89c9\u4e00\u4e0b\u5b50\u8d70\u4e86\u4e24\u6b65\u3002<\/p>\n\n\n\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>v<\/mi><mi>t<\/mi><\/msub><mo>=<\/mo><mi>\u03b3<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>+<\/mo><mi>\u03b7<\/mi><msub><mi>\u2207<\/mi><mi>\u03b8<\/mi><\/msub><mi>J<\/mi><mrow><mo stretchy=\"true\" form=\"prefix\">(<\/mo><mi>\u03b8<\/mi><mo>\u2212<\/mo><mi>\u03b3<\/mi><msub><mi>v<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo stretchy=\"true\" form=\"postfix\">)<\/mo><\/mrow><\/mrow><annotation encoding=\"application\/x-tex\">\nv_{t}=\\gamma v_{t-1}+\\eta \\nabla_\\theta J( \\theta &#8211; \\gamma v_{t-1} ) \n<\/annotation><\/semantics><\/math><\/p>\n<p><math display=\"block\" xmlns=\"http:\/\/www.w3.org\/1998\/Math\/MathML\"><semantics><mrow><msub><mi>\u03b8<\/mi><mi>t<\/mi><\/msub><mo>=<\/mo><msub><mi>\u03b8<\/mi><mrow><mi>t<\/mi><mo>\u2212<\/mo><mn>1<\/mn><\/mrow><\/msub><mo>\u2212<\/mo><msub><mi>v<\/mi><mi>t<\/mi><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\n\\theta_{t} = \\theta_{t-1} &#8211; v_t\n<\/annotation><\/semantics><\/math><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\u662f\u4e00\u79cd\u524d\u9988\u795e\u7ecf\u7f51\u7edc\uff0c\u7528\u4e8e\u56fe\u7247\u5206\u7c7b\u7684\u5377\u79ef\u7f51\u7edc\u4e00\u822c\u5305\u542b\u4e24\u90e8\u5206\uff1a\u5377\u79ef\u90e8\u5206\u548c\u5168\u94fe\u63a5\u90e8\u5206\u3002 \u5377\u79ef\u90e8\u5206\u5c06\u4f20\u7edf\u7684 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=1526\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u5377\u79ef\u795e\u7ecf\u7f51\u7edc\uff08\u5206\u7c7b\u7f51\u7edc\uff09\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[246,89],"tags":[166],"class_list":["post-1526","post","type-post","status-publish","format-standard","hentry","category-ai","category-89","tag-166"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1526"}],"version-history":[{"count":9,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1526\/revisions"}],"predecessor-version":[{"id":1569,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1526\/revisions\/1569"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}