{"id":3391,"date":"2022-02-27T15:39:41","date_gmt":"2022-02-27T07:39:41","guid":{"rendered":"https:\/\/egonlin.com\/?p=3391"},"modified":"2022-02-27T15:39:41","modified_gmt":"2022-02-27T07:39:41","slug":"%e7%ac%ac%e4%b8%80%e7%af%87%ef%bc%9a%e6%89%8b%e5%86%99%e6%95%b0%e5%ad%97%e8%af%86%e5%88%ab","status":"publish","type":"post","link":"https:\/\/egonlin.com\/?p=3391","title":{"rendered":"\u7b2c\u4e00\u7bc7\uff1a\u624b\u5199\u6570\u5b57\u8bc6\u522b"},"content":{"rendered":"<h1>\u624b\u5199\u6570\u5b57\u8bc6\u522b\u5e94\u7528\u7a0b\u5e8f<\/h1>\n<h1>\u5bfc\u5165\u6a21\u5757<\/h1>\n<pre><code class=\"language-python\">import os\nimport pylab\nimport numpy as np\nfrom PIL import Image\nimport matplotlib.pyplot as plt\nfrom sklearn.svm import SVC\n%matplotlib inline<\/code><\/pre>\n<h1>\u56fe\u50cf\u8f6c\u5411\u91cf<\/h1>\n<pre><code class=\"language-python\">def img2vector(filename):\n    &quot;&quot;&quot;\u5c0632*32\u7684\u4e8c\u8fdb\u5236\u56fe\u50cf\u8f6c\u6362\u4e3a1*1024\u5411\u91cf&quot;&quot;&quot;\n    # \u6784\u9020\u4e00\u4e2a\u4e00\u884c\u67091024\u4e2a\u5143\u7d20\u7684\u5373 1*1024 \u7684\u96f6\u5411\u91cf\n    return_vect = np.zeros((1, 1024))\n\n    with open(filename, &#039;r&#039;, encoding=&#039;utf-8&#039;) as fr:\n        # \u8bfb\u53d6\u6587\u4ef6\u7684\u6bcf\u4e00\u884c\u7684\u6240\u6709\u5143\u7d20\n        for i in range(32):\n            line_str = fr.readline()\n            # \u628a\u6587\u4ef6\u6bcf\u4e00\u884c\u7684\u6240\u6709\u5143\u7d20\u6309\u7167\u987a\u5e8f\u5199\u5165\u6784\u9020\u7684 1*1024 \u7684\u96f6\u77e9\u9635\n            for j in range(32):\n                return_vect[0, 32 * i + j] = int(line_str[j])\n\n        # \u8fd4\u56de\u8f6c\u6362\u540e\u7684 1*1024 \u5411\u91cf\n        return return_vect<\/code><\/pre>\n<h1>\u8bad\u7ec3\u5e76\u6d4b\u8bd5\u6a21\u578b<\/h1>\n<p><\/p><div id=\"rml_readmorelogin_placeholder\" style=\"position:relative;\"><div id=\"rml_fade_content\" style=\"position: absolute;\r\ntop:-10em;\r\nwidth:100%;\r\nheight:10em;\r\nbackground: -webkit-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -moz-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -o-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\r\nbackground-image: -ms-linear-gradient(rgba(255, 255, 255, 0) 0%,#ffffff 100%);\"><\/div><div class=\"wpf-controller aru_rml_from_in_post\" style=\"background-color:#eeeeee;border:5px solid #cce6ff;\" id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><h2 id=\"Header\">\u67e5\u770b\u66f4\u591a<\/h2><div id=\"Message\"><p>\u8054\u7cfb\u7ba1\u7406\u5458\u5fae\u4fe1tutu19192010\uff0c\u6ce8\u518c\u8d26\u53f7<\/p>\n<\/div><div id=\"StatusBarHeader\"><\/div><form id=\"ARU_ReadMoreLogin_ReadMoreLoginController\"><input name=\"post_id\" value=\"3391\" type=\"hidden\"\/><input name=\"_init_callback\" value=\"InitLogin\" type=\"hidden\"\/><input name=\"post_id\" value=\"3391\" type=\"hidden\"\/><input name=\"rt_ype\" value=\"1\" type=\"hidden\"\/><input name=\"nonce\" value=\"964e233468\" type=\"hidden\"\/><input name=\"_wpnonce\" value=\"67db887ad9\" type=\"hidden\"\/><input name=\"_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_proxy_controller\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginController\" type=\"hidden\"\/><input name=\"_view\" value=\"ARU_ReadMoreLogin\\ReadMoreLoginView\" type=\"hidden\"\/><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\" width=\"400px\"><table class=\"wpf-table-placeholder\"><tbody class=\"wpf-table-placeholder\"><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Username:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"username\" value=\"\" type=\"text\"\/><\/td><\/tr><tr class=\"wpf-table-placeholder\"><th class=\"wpf-table-placeholder-input\"><label class=\"wpf-label\">Password:<\/label><\/th><\/tr><tr class=\"wpf-table-placeholder\"><td class=\"wpf-table-placeholder-input\"><input class=\"regular-text text_input\" name=\"password\" value=\"\" type=\"password\"\/><\/td><\/tr><\/tbody><\/table><p class=\"wpf-table-placeholder submit\"><button class=\"wp_plugin_framework_ajax_button\" type=\"button\" style=\"background-color:#4D90FE;;color:#ffffff;;border:1px solid #3079ed;\" name=\"_event\" value=\"ButtonLogin\">Log in<\/button><\/p><\/td><td class=\"wpf-table-placeholder-input\"><\/td><\/tr><\/tbody><\/table><\/form><div id=\"ButtonStartRegister\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=register\">Register<\/a><\/div><div id=\"Link1\"><a href=\"https:\/\/egonlin.com\/wp-login.php?action=lostpassword\">Forgotten username or password?<\/a><\/div><div id=\"StatusBarFooter\"><\/div><\/div><\/div><div id=aru_remaining_content><\/div>","protected":false},"excerpt":{"rendered":"<p>\u624b\u5199\u6570\u5b57\u8bc6\u522b\u5e94\u7528\u7a0b\u5e8f \u5bfc\u5165\u6a21\u5757 import os import pylab import numpy as  [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":3393,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[276,303,306],"tags":[],"_links":{"self":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3391"}],"collection":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3391"}],"version-history":[{"count":0,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/posts\/3391\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=\/wp\/v2\/media\/3393"}],"wp:attachment":[{"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/egonlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}