{"id":1115,"date":"2026-01-27T18:01:55","date_gmt":"2026-01-27T10:01:55","guid":{"rendered":"https:\/\/abytelalala.cn\/?p=1115"},"modified":"2026-02-12T12:10:37","modified_gmt":"2026-02-12T04:10:37","slug":"%e8%af%86%e5%88%ab%e6%95%b0%e5%ad%97%e5%9b%be%e7%89%87d","status":"publish","type":"post","link":"https:\/\/abytelalala.cn\/index.php\/2026\/01\/27\/%e8%af%86%e5%88%ab%e6%95%b0%e5%ad%97%e5%9b%be%e7%89%87d\/","title":{"rendered":"\u8bc6\u522b\u6570\u5b57\u56fe\u7247"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># \u5b89\u88c5TensorFlow\uff08\u5185\u7f6eKeras\uff0c\u5305\u542bMNIST\u6570\u636e\u96c6\uff09\npip install tensorflow==2.15.0  # \u6307\u5b9a\u7a33\u5b9a\u7248\u672c\uff0c\u907f\u514d\u517c\u5bb9\u6027\u95ee\u9898\n# \u8f85\u52a9\u5e93\uff1a\u6570\u636e\u53ef\u89c6\u5316\u3001\u6570\u503c\u8ba1\u7b97\npip install matplotlib numpy<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>import tensorflow as tf\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n# \u6253\u5370\u7248\u672c\uff0c\u65e0\u62a5\u9519\u5219\u5b89\u88c5\u6210\u529f\nprint(\"TensorFlow\u7248\u672c\uff1a\", tf.__version__)\nprint(\"Numpy\u7248\u672c\uff1a\", np.__version__)<\/code><\/pre>\n\n\n\n<p>\u7ec8\u7aef\u663e\u793a\u5982\u4e0b\u753b\u9762<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/abytelalala.cn\/wp-content\/uploads\/2026\/01\/image-1.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"405\" height=\"271\" data-original=\"https:\/\/abytelalala.cn\/wp-content\/uploads\/2026\/01\/image-1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-1116\"  sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/div><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-\u52a0\u8f7d\u6570\u636e\u96c6\">1. \u52a0\u8f7d\u6570\u636e\u96c6<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-code\"><code># \u52a0\u8f7dMNIST\u6570\u636e\u96c6\uff08\u81ea\u52a8\u4e0b\u8f7d\u5230\u672c\u5730\uff0c\u9996\u6b21\u8fd0\u884c\u9700\u7b49\u5f85\uff09\n(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()\n\n# \u67e5\u770b\u6570\u636e\u7ef4\u5ea6\uff08\u7406\u89e3\u6570\u636e\u7ed3\u6784\uff09\nprint(\"\u8bad\u7ec3\u96c6\u56fe\u7247\u7ef4\u5ea6\uff1a\", x_train.shape)  # (60000, 28, 28) \u2192 6\u4e07\u5f20\u300128\u00d728\u50cf\u7d20\nprint(\"\u8bad\u7ec3\u96c6\u6807\u7b7e\u7ef4\u5ea6\uff1a\", y_train.shape)  # (60000,) \u2192 6\u4e07\u4e2a\u6807\u7b7e\nprint(\"\u6d4b\u8bd5\u96c6\u56fe\u7247\u7ef4\u5ea6\uff1a\", x_test.shape)    # (10000, 28, 28)\nprint(\"\u6d4b\u8bd5\u96c6\u6807\u7b7e\u7ef4\u5ea6\uff1a\", y_test.shape)    # (10000,)\n\n# \u67e5\u770b\u6570\u636e\u53d6\u503c\u8303\u56f4\uff08\u7070\u5ea6\u56fe\u50cf\u7d20\u503c0-255\uff09\nprint(\"\u50cf\u7d20\u503c\u8303\u56f4\uff1a\", x_train.min(), \"~\", x_train.max())  # 0 ~ 255\n<\/code><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u7ec8\u7aef\u663e\u793a\u5982\u4e0b\u753b\u9762 1. \u52a0\u8f7d\u6570\u636e\u96c6<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-1115","post","type-post","status-publish","format-standard","hentry","category-22"],"_links":{"self":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/1115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1115"}],"version-history":[{"count":4,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/1115\/revisions"}],"predecessor-version":[{"id":1141,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/posts\/1115\/revisions\/1141"}],"wp:attachment":[{"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/abytelalala.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}