{"id":1846,"date":"2018-12-19T03:32:22","date_gmt":"2018-12-19T03:32:22","guid":{"rendered":""},"modified":"2018-12-19T11:32:54","modified_gmt":"2018-12-19T03:32:54","slug":"%e6%9e%84%e5%bb%ba%e4%b8%80%e4%b8%aa%e7%9b%b8%e5%af%b9%e8%be%83%e5%b0%8f%e7%9a%84%e5%9b%be%e5%83%8f%e8%af%86%e5%88%ab%e5%8d%b7%e7%a7%af%e7%a5%9e%e7%bb%8f%e7%bd%91%e7%bb%9c","status":"publish","type":"post","link":"http:\/\/www.szryc.com\/?p=1846","title":{"rendered":"\u6784\u5efa\u4e00\u4e2a\u76f8\u5bf9\u8f83\u5c0f\u7684\u56fe\u50cf\u8bc6\u522b\u5377\u79ef\u795e\u7ecf\u7f51\u7edc"},"content":{"rendered":"

\n\t\u4eca\u5929\u7684\u6587\u7ae0\u662f\u6709\u5173 “\u9ad8\u7ea7\u5377\u79ef\u795e\u7ecf” \u7684\u6559\u7a0b\u3002\u6211\u4eec\u5e0c\u671b\u60a8\u80fd\u591f\u4ee5\u672c\u6587\u4e3a\u8d77\u70b9\uff0c\u5728 TensorFlow<\/u> \u4e0a\u6784\u5efa\u66f4\u5927\u7684 CNN \u6765\u5904\u7406\u89c6\u89c9\u4efb\u52a1\u3002<\/p>\n

\n\t\u6982\u8ff0<\/p>\n

\n\t <\/div>\n

\n\tCIFAR-10 \u5206\u7c7b\u95ee\u9898\u662f\u673a\u5668\u5b66\u4e60<\/u>\u9886\u57df\u4e00\u79cd\u5e38\u89c1\u7684\u57fa\u51c6\u95ee\u9898\uff0c\u5176\u4efb\u52a1\u662f\u5c06 RGB 32x32 \u50cf\u7d20\u7684\u56fe\u50cf\u5206\u4e3a\u4ee5\u4e0b 10 \u7c7b\uff1a<\/p>\n

\n\tai<\/u>rplane, automobile, bird, cat, deer, dog, frog, hors<\/u>e, ship, and truck.<\/p>\n

\n\t\u6709\u5173\u8be6\u60c5\uff0c\u8bf7\u53c2\u9605 CIFAR-10 \u9875\u9762 \uff08https:\/\/www.cs.toronto.edu\/~kriz\/cifar.html\uff09\u53ca Alex Krizhevsky \u53d1\u8868\u7684\u4e00\u7bc7 \u6280\u672f\u62a5\u544a \uff08https:\/\/te<\/u>nsorflow.google.cn\/tutorials\/images\/deep_cnn?hl=zh-CN\uff09\u3002<\/p>\n

\n\t\u76ee\u6807<\/p>\n

\n\t\u672c\u6587\u7684\u76ee\u6807\u662f\u6784\u5efa\u4e00\u4e2a\u76f8\u5bf9\u8f83\u5c0f\u7684\u56fe\u50cf\u8bc6\u522b\u5377\u79ef\u795e\u7ecf\u7f51\u7edc<\/u> (CNN)\u3002\u5728\u6b64\u8fc7\u7a0b\u4e2d\uff0c\u672c\u6587\u5c06\uff1a<\/p>\n

\n\t\u91cd\u70b9\u4ecb\u7ecd\u7f51\u7edc\u67b6\u6784\u3001\u8bad\u7ec3\u548c\u8bc4\u4f30\u7684\u89c4\u8303\u7ed3\u6784<\/p>\n

\n\t\u63d0\u4f9b\u4e00\u4e2a\u7528\u4e8e\u6784\u5efa\u66f4\u5927\u3001\u66f4\u4e3a\u590d\u6742\u7684\u6a21\u578b\u7684\u6a21\u677f<\/p>\n

\n\t\u9009\u62e9 CIFAR-10 \u7684\u539f\u56e0\u662f\u5b83\u8db3\u591f\u590d\u6742\uff0c\u53ef\u4ee5\u7528\u6765\u7ec3\u4e60 TensorFlow \u7684\u5927\u90e8\u5206\u529f\u80fd\uff0c\u8fdb\u800c\u6269\u5c55\u5230\u5927\u578b\u6a21\u578b\u3002\u540c\u65f6\uff0c\u8be5\u6a21\u578b\u8db3\u591f\u5c0f\uff0c\u53ef\u4ee5\u5feb\u901f\u8bad\u7ec3\uff0c\u662f\u5c1d\u8bd5\u65b0\u60f3\u6cd5\u4ee5\u53ca\u5b9e\u9a8c\u65b0\u6280\u672f\u7684\u7406\u60f3\u4e4b\u9009\u3002<\/p>\n

\n\t\u672c\u6587\u7684\u8981\u70b9<\/p>\n

\n\tCIFAR-10 \u6559\u7a0b\u4ecb\u7ecd\u4e86\u51e0\u4e2a\u7528\u4e8e\u5728 TensorFlow \u4e2d\u8bbe\u8ba1\u66f4\u5927\u3001\u66f4\u4e3a\u590d\u6742\u7684\u6a21\u578b\u7684\u91cd\u8981\u7ed3\u6784\uff1a<\/p>\n

\n\t\u6838\u5fc3\u6570\u5b66\u7ec4\u4ef6\uff0c\u5305\u62ec\u5377\u79ef\uff08\u7ef4\u57fa\u767e\u79d1\u9875\u9762\uff09\u3001\u4fee\u6b63\u7ebf\u6027\u6fc0\u6d3b\u51fd\u6570\uff08\u7ef4\u57fa\u767e\u79d1\u9875\u9762\uff09\u3001\u6700\u5927\u6c60\u5316\uff08\u7ef4\u57fa\u767e\u79d1\u9875\u9762\uff09\u548c\u5c40\u90e8\u54cd\u5e94\u5f52\u4e00\u5316\uff08AlexNet \u8bba\u6587\u7684\u7b2c 3.3 \u8282\uff09<\/p>\n

\n\t\u8bad\u7ec3\u671f\u95f4\u7f51\u7edc\u6d3b\u52a8\uff08\u5305\u62ec\u8f93\u5165\u56fe\u50cf\u3001\u635f\u5931\u4ee5\u53ca\u6fc0\u6d3b\u51fd\u6570\u548c\u68af\u5ea6\u7684\u5206\u5e03\uff09\u7684\u53ef\u89c6\u5316<\/p>\n

\n\t\u4f8b\u884c\u7a0b\u5e8f\uff0c\u7528\u4e8e\u8ba1\u7b97\u5df2\u5b66\u53c2\u6570\u7684\u79fb\u52a8\u5e73\u5747\u503c\uff0c\u5e76\u5728\u8bc4\u4f30\u671f\u95f4\u4f7f\u7528\u8fd9\u4e9b\u5e73\u5747\u503c\u63d0\u5347\u9884\u6d4b\u6027\u80fd<\/p>\n

\n\t\u5b9e\u65bd\u5b66\u4e60\u901f\u7387\u8ba1\u5212\uff08\u968f\u65f6\u95f4\u7684\u63a8\u79fb\u7cfb\u7edf\u6027\u5730\u964d\u4f4e\uff09<\/p>\n

\n\t\u8f93\u5165\u6570\u636e\u7684\u9884\u53d6\u961f\u5217\uff0c\u4f7f\u6a21\u578b\u907f\u5f00\u78c1\u76d8\u5ef6\u8fdf\u548c\u4ee3\u4ef7\u9ad8\u7684\u56fe\u50cf\u9884\u5904\u7406\u8fc7\u7a0b<\/p>\n

\n\t\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u63d0\u4f9b\u4e86\u6a21\u578b\u7684\u591a GPU<\/u> \u7248\u672c\uff0c\u5b83\u4f1a\u5c55\u793a\uff1a<\/p>\n

\n\t\u5982\u4f55\u914d\u7f6e\u6a21\u578b\u4ee5\u8de8\u591a\u4e2a GPU \u5361\u5e76\u884c\u8bad\u7ec3<\/p>\n

\n\t\u5982\u4f55\u5728\u591a\u4e2a GPU \u95f4\u5171\u4eab\u548c\u66f4\u65b0\u53d8\u91cf<\/p>\n

\n\t\u6a21\u578b\u67b6\u6784<\/p>\n

\n\t\u672c CIFAR-10 \u6559\u7a0b\u4e2d\u7684\u6a21\u578b\u662f\u4e00\u4e2a\u591a\u5c42\u67b6\u6784\uff0c\u7531\u5377\u79ef\u5c42\u548c\u975e\u7ebf\u6027\u5c42\u4ea4\u66ff\u6392\u5217\u540e\u6784\u6210\u3002\u8fd9\u4e9b\u5c42\u540e\u9762\u662f\u5168\u8fde\u63a5\u5c42\uff0c\u7136\u540e\u901a\u5411 softmax \u5206\u7c7b\u5668\u3002\u8be5\u6a21\u578b\u9664\u4e86\u6700\u9876\u90e8\u7684\u51e0\u5c42\u5916\uff0c\u57fa\u672c\u8ddf Alex Krizhevsky \u63cf\u8ff0\u7684\u6a21\u578b\u67b6\u6784\u4e00\u81f4\u3002<\/p>\n

\n\t\u5728 GPU \u4e0a\u7ecf\u8fc7\u51e0\u4e2a\u5c0f\u65f6\u7684\u8bad\u7ec3\u540e\uff0c\u8be5\u6a21\u578b\u7684\u51c6\u786e\u7387\u8fbe\u5230\u5cf0\u503c\uff08\u7ea6 86%\uff09\u3002\u8be6\u60c5\u8bf7\u53c2\u9605\u4e0b\u6587\u548c\u76f8\u5e94\u4ee3\u7801\u3002\u6a21\u578b\u4e2d\u5305\u542b 1068298 \u4e2a\u53ef\u5b66\u4e60\u53c2\u6570\uff0c\u5bf9\u4e00\u5f20\u56fe\u50cf\u8fdb\u884c\u63a8\u7406\u8ba1\u7b97\u5927\u7ea6\u9700\u8981 1950 \u4e07\u4e2a\u4e58\u52a0\u64cd\u4f5c\u3002<\/p>\n

\n\t\u4ee3\u7801\u7ed3\u6784<\/p>\n

\n\t\u672c\u6559\u7a0b\u4f7f\u7528\u7684\u4ee3\u7801\u4f4d\u4e8e models\/tutorials\/image\/cifar10\/ \u4e2d\u3002<\/p>\n

\n\t<\/p>\n

\n\tCIFAR-10 \u6a21\u578b<\/p>\n

\n\tCIFAR-10 \u7f51\u7edc\u4e3b\u8981\u5305\u542b\u5728 cifar10.py \u4e2d\u3002\u5b8c\u6574\u7684\u8bad\u7ec3\u56fe\u5927\u7ea6\u5305\u542b 765 \u4e2a\u64cd\u4f5c\u3002\u6211\u4eec\u53d1\u73b0\uff0c\u4f7f\u7528\u4ee5\u4e0b\u6a21\u5757\u6784\u5efa\u8bad\u7ec3\u56fe\u53ef\u6700\u5927\u9650\u5ea6\u5730\u63d0\u9ad8\u4ee3\u7801\u7684\u91cd\u590d\u4f7f\u7528\u7387\uff1a<\/p>\n

\n\t\u6a21\u578b\u8f93\u5165\uff1ainputs() \u548c distorted_inputs() \u5206\u522b\u53ef\u6dfb\u52a0\u8bfb\u53d6\u548c\u9884\u5904\u7406 CIFAR \u56fe\u50cf\u4ee5\u7528\u4e8e\u8bc4\u4f30\u548c\u8bad\u7ec3\u7684\u64cd\u4f5c<\/p>\n

\n\t\u6a21\u578b\u9884\u6d4b\uff1ainference() \u53ef\u6dfb\u52a0\u5bf9\u63d0\u4f9b\u7684\u56fe\u50cf\u8fdb\u884c\u63a8\u7406\uff08\u5373\u5206\u7c7b\uff09\u7684\u64cd\u4f5c<\/p>\n

\n\t\u6a21\u578b\u8bad\u7ec3\uff1aloss() \u548c train() \u53ef\u6dfb\u52a0\u8ba1\u7b97\u635f\u5931\u548c\u68af\u5ea6\u3001\u66f4\u65b0\u53d8\u91cf\u548c\u5448\u73b0\u53ef\u89c6\u5316\u6c47\u603b\u7684\u64cd\u4f5c<\/p>\n

\n\t\u6a21\u578b\u8f93\u5165<\/p>\n

\n\t\u6a21\u578b\u7684\u8f93\u5165\u90e8\u5206\u7531 inputs() \u548c distorted_inputs() \u51fd\u6570\u6784\u5efa\uff0c\u8fd9\u4e24\u79cd\u51fd\u6570\u4f1a\u4ece CIFAR-10 \u4e8c\u8fdb\u5236\u6570\u636e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u56fe\u50cf\u3002\u8fd9\u4e9b\u6587\u4ef6\u5305\u542b\u5b57\u8282\u957f\u5ea6\u56fa\u5b9a\u7684\u8bb0\u5f55\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 tf.FixedLengthRecordReader\u3002\u5982\u9700\u8be6\u7ec6\u4e86\u89e3 Reader \u7c7b\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u8bf7\u53c2\u9605 \u8bfb\u53d6\u6570\u636e\uff08https:\/\/tensorflow.google.cn\/api<\/u>_guides\/python<\/u>\/readi<\/u>ng_data?hl=zh-CN#reading-from<\/u>-files\uff09\u3002<\/p>\n

\n\t\u56fe\u50cf\u6309\u4ee5\u4e0b\u65b9\u5f0f\u5904\u7406\uff1a<\/p>\n

\n\t\u4ece\u4e2d\u5fc3\uff08\u7528\u4e8e\u8bc4\u4f30\uff09\u6216\u968f\u673a\uff08\u7528\u4e8e\u8bad\u7ec3\uff09\u526a\u88c1\u6210 24 x 24 \u50cf\u7d20<\/p>\n

\n\t\u8fdb\u884c\u8fd1\u4f3c\u767d\u5316\u5904\u7406\uff0c\u4f7f\u6a21\u578b\u5bf9\u56fe\u50cf\u7684\u52a8\u6001\u8303\u56f4\u53d8\u5316\u4e0d\u654f\u611f<\/p>\n

\n\t\u5bf9\u4e8e\u8bad\u7ec3\uff0c\u6211\u4eec\u8fd8\u4f1a\u989d\u5916\u5411\u56fe\u50cf\u5e94\u7528\u4e00\u7cfb\u5217\u968f\u673a\u5931\u771f\uff0c\u4ee5\u4eba\u4e3a\u589e\u52a0\u6570\u636e\u96c6\u7684\u5927\u5c0f\uff1a<\/p>\n

\n\t\u4ece\u5de6\u5230\u53f3\u968f\u673a\u7ffb\u8f6c\u56fe\u50cf<\/p>\n

\n\t\u968f\u673a\u5bf9\u56fe\u50cf\u4eae\u5ea6\u8fdb\u884c\u5931\u771f\u5904\u7406<\/p>\n

\n\t\u968f\u673a\u5bf9\u56fe\u50cf\u5bf9\u6bd4\u5ea6\u8fdb\u884c\u5931\u771f\u5904\u7406<\/p>\n

\n\t\u8981\u67e5\u770b\u53ef\u91c7\u7528\u7684\u5931\u771f\u5217\u8868\uff0c\u8bf7\u8bbf\u95ee \u56fe\u50cf \u9875\u9762\uff08https:\/\/tensorflow.google.cn\/api_guides\/python\/image?hl=zh-CN\uff09\u3002\u6b64\u5916\uff0c\u6211\u4eec\u8fd8\u5411\u56fe\u50cf\u9644\u52a0\u4e86 tf.summary.image\uff0c\u4ee5\u4fbf\u5728 TensorBoard \u4e2d\u53ef\u89c6\u5316\u5b83\u4eec\u3002\u8fd9\u5bf9\u9a8c\u8bc1\u8f93\u5165\u7684\u6784\u5efa\u662f\u5426\u6b63\u786e\u5341\u5206\u6709\u7528\u3002<\/p>\n

\n\t\u4ece\u78c1\u76d8\u8bfb\u53d6\u56fe\u50cf\u5e76\u8fdb\u884c\u5931\u771f\u5904\u7406\u9700\u8981\u4e0d\u5c11\u65f6\u95f4\u3002\u4e3a\u4e86\u9632\u6b62\u8fd9\u4e9b\u64cd\u4f5c\u5f71\u54cd\u8bad\u7ec3\u901f\u5ea6\uff0c\u6211\u4eec\u5728 16 \u4e2a\u72ec\u7acb\u7684\u7ebf\u7a0b\u4e2d\u6267\u884c\u8fd9\u4e9b\u64cd\u4f5c\uff0c\u800c\u8fd9\u4e9b\u7ebf\u7a0b\u4f1a\u4e0d\u65ad\u586b\u5145\u4e00\u4e2a TensorFlow \u961f\u5217\u3002<\/p>\n

\n\t\u6a21\u578b\u9884\u6d4b<\/p>\n

\n\t\u6a21\u578b\u7684\u9884\u6d4b\u90e8\u5206\u7531 inference() \u51fd\u6570\u6784\u5efa\uff0c\u8be5\u51fd\u6570\u53ef\u6dfb\u52a0\u8ba1\u7b97\u9884\u6d4b\u5bf9\u6570\u7684\u64cd\u4f5c\u3002\u6a21\u578b\u8fd9\u4e00\u90e8\u5206\u7684\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n

\n\t<\/p>\n

\n\t\u4e0b\u56fe\u662f\u4ece TensorBoard \u751f\u6210\u7684\u56fe\u8868\uff0c\u63cf\u8ff0\u4e86\u63a8\u7406\u64cd\u4f5c\u7684\u8fc7\u7a0b\uff1a<\/p>\n

\n\t<\/p>\n

\n\t\u7ec3\u4e60\uff1ainference \u7684\u8f93\u51fa\u4e3a\u975e\u5f52\u4e00\u5316\u5bf9\u6570\u3002\u8bf7\u5c1d\u8bd5\u4f7f\u7528 tf.nn.softmax \u4fee\u6539\u7f51\u7edc\u67b6\u6784\u4ee5\u8fd4\u56de\u5f52\u4e00\u5316\u9884\u6d4b\u7ed3\u679c\u3002<\/p>\n

\n\tinputs() \u548c inference() \u51fd\u6570\u63d0\u4f9b\u4e86\u8bc4\u4f30\u6a21\u578b\u6240\u9700\u7684\u6240\u6709\u7ec4\u4ef6\u3002\u6211\u4eec\u73b0\u5728\u5c06\u91cd\u70b9\u8f6c\u5411\u6784\u5efa\u8bad\u7ec3\u6a21\u578b\u6240\u9700\u7684\u64cd\u4f5c\u3002<\/p>\n

\n\t\u7ec3\u4e60\uff1ainference() \u4e2d\u7684\u6a21\u578b\u67b6\u6784\u4e0e cuda-convnet \u4e2d\u6307\u5b9a\u7684 CIFAR-10 \u6a21\u578b\u7684\u67b6\u6784\u7565\u6709\u4e0d\u540c\u3002\u5177\u4f53\u800c\u8a00\uff0cAlex \u7684\u521d\u59cb\u6a21\u578b\u7684\u9876\u5c42\u662f\u5c40\u90e8\u8fde\u63a5\u5c42\uff0c\u800c\u975e\u5168\u8fde\u63a5\u5c42\u3002\u8bf7\u5c1d\u8bd5\u4fee\u6539\u67b6\u6784\u4ee5\u5728\u9876\u5c42\u4e2d\u5b8c\u5168\u91cd\u73b0\u5c40\u90e8\u8fde\u63a5\u5c42\u3002<\/p>\n

\n\t\u6a21\u578b\u8bad\u7ec3<\/p>\n

\n\t\u8bad\u7ec3\u7f51\u7edc\u6267\u884c N \u5143\u5206\u7c7b\u7684\u5e38\u7528\u65b9\u6cd5\u662f\u591a\u9879\u903b\u8f91\u56de\u5f52\uff08\u53c8\u79f0 Softmax \u56de\u5f52\uff09\u3002Softmax \u56de\u5f52\u5411\u7f51\u7edc\u8f93\u51fa\u5e94\u7528 Softmax \u975e\u7ebf\u6027\u51fd\u6570\uff0c\u5e76\u8ba1\u7b97\u5f52\u4e00\u5316\u9884\u6d4b\u4e0e\u6807\u7b7e\u7d22\u5f15\u4e4b\u95f4\u7684\u4ea4\u53c9\u71b5\u3002\u5728\u6b63\u5219\u5316\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u8fd8\u4f1a\u5bf9\u6240\u6709\u5df2\u5b66\u53d8\u91cf\u5e94\u7528\u5e38\u89c1\u7684\u6743\u91cd\u8870\u51cf\u635f\u5931\u3002\u6a21\u578b\u7684\u76ee\u6807\u51fd\u6570\u662f\u6c42\u4ea4\u53c9\u71b5\u635f\u5931\u548c\u6240\u6709\u6743\u91cd\u8870\u51cf\u9879\u7684\u548c\u5e76\u7531 loss() \u51fd\u6570\u8fd4\u56de\u3002<\/p>\n

\n\t\u6211\u4eec\u901a\u8fc7 tf.summary.scalar \u5728 TensorBoard \u4e2d\u5bf9\u5176\u8fdb\u884c\u53ef\u89c6\u5316\uff1a<\/p>\n

\n\t<\/p>\n

\n\t\u6211\u4eec\u4f7f\u7528\u6807\u51c6\u7684\u68af\u5ea6\u4e0b\u964d\u6cd5\u8bad\u7ec3\u6a21\u578b\uff08\u6709\u5173\u5176\u4ed6\u65b9\u6cd5\uff0c\u8bf7\u53c2\u9605 \u8bad\u7ec3 https:\/\/github.com\/tensorflow\/docs\/tree\/master\/site\/en\/api_guides\/python\uff09\uff0c\u5176\u4e2d\u5b66\u4e60\u901f\u7387\u968f\u65f6\u95f4\u7684\u63a8\u79fb\u5448\u6307\u6570\u7ea7\u8870\u51cf\u3002<\/p>\n

\n\t<\/p>\n

\n\ttrain() \u51fd\u6570\u4f1a\u6dfb\u52a0\u4e00\u4e9b\u6700\u5c0f\u5316\u76ee\u6807\u6240\u9700\u7684\u64cd\u4f5c\uff0c\u5305\u62ec\u8ba1\u7b97\u68af\u5ea6\u3001\u66f4\u65b0\u5b66\u4e60\u53d8\u91cf\uff08\u8be6\u60c5\u8bf7\u53c2\u9605 tf.train.GradientDescentOpti<\/u>mizer https:\/\/tensorflow.google.cn\/api_docs\/python\/tf\/train\/GradientDescentOptimizer?hl=zh-CN\uff09\u3002\u5b83\u4f1a\u8fd4\u56de\u4e00\u9879\u7528\u4ee5\u5bf9\u4e00\u6279\u56fe\u50cf\u6267\u884c\u6240\u6709\u8ba1\u7b97\u7684\u64cd\u4f5c\uff0c\u4ee5\u4fbf\u8bad\u7ec3\u5e76\u66f4\u65b0\u6a21\u578b\u3002<\/p>\n

\n\t\u542f\u52a8\u5e76\u8bad\u7ec3\u6a21\u578b<\/p>\n

\n\t\u6211\u4eec\u5df2\u6784\u5efa\u4e86\u6a21\u578b\uff0c\u73b0\u5728\u4f7f\u7528\u811a\u672c cifar10_train.py \u542f\u52a8\u8be5\u6a21\u578b\u5e76\u6267\u884c\u8bad\u7ec3\u64cd\u4f5c\u3002<\/p>\n

\n\tpython cifar10_train.py<\/p>\n

\n\t\u6ce8\u610f\uff1a\u9996\u6b21\u8fd0\u884c CIFAR-10 \u6559\u7a0b\u4e2d\u7684\u4efb\u4f55\u76ee\u6807\u65f6\uff0c\u7cfb\u7edf\u90fd\u4f1a\u81ea\u52a8\u4e0b\u8f7d CIFAR-10 \u6570\u636e\u96c6\u3002\u8be5\u6570\u636e\u96c6\u5927\u7ea6\u4e3a 160MB\uff0c\u56e0\u6b64\u9996\u6b21\u8fd0\u884c\u65f6\u60a8\u53ef\u4ee5\u559d\u676f\u5496\u5561\u5c0f\u6816\u4e00\u4f1a\u3002<\/p>\n

\n\t\u60a8\u5e94\u8be5\u4f1a\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa\uff1a<\/p>\n

\n\tFilling queue with 20000 CIFAR images before starting to train. This will take a few minutes.<\/p>\n

\n\t2015-11-04 11:45:45.927302: step 0, loss = 4.68 (2.0 examples\/sec; 64.221 sec\/batch)2015-11-04 11:45:49.133065: step 10, loss = 4.66 (533.8 examples\/sec; 0.240 sec\/batch)2015-11-04 11:45:51.397710: step 20, loss = 4.64 (597.4 examples\/sec; 0.214 sec\/batch)2015-11-04 11:45:54.446850: step 30, loss = 4.62 (391.0 examples\/sec; 0.327 sec\/batch)2015-11-04 11:45:57.152676: step 40, loss = 4.61 (430.2 examples\/sec; 0.298 sec\/batch)2015-11-04 11:46:00.437717: step 50, loss = 4.59 (406.4 examples\/sec; 0.315 sec\/batch)...<\/p>\n

\n\t\u8be5\u811a\u672c\u6bcf\u9694 10 \u6b65\u62a5\u544a\u4e00\u6b21\u603b\u635f\u5931\u503c\u53ca\u6700\u540e\u4e00\u6279\u6570\u636e\u7684\u5904\u7406\u901f\u5ea6\u3002\u9700\u8981\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9\uff1a<\/p>\n

\n\t\u7b2c\u4e00\u6279\u6570\u636e\u7684\u5904\u7406\u901f\u5ea6\u53ef\u80fd\u4f1a\u975e\u5e38\u6162\uff08\u4f8b\u5982\uff0c\u9700\u8981\u51e0\u5206\u949f\uff09\uff0c\u56e0\u4e3a\u9884\u5904\u7406\u7ebf\u7a0b\u9700\u8981\u5c06 20000 \u5f20\u5904\u7406\u8fc7\u7684 CIFAR \u56fe\u50cf\u586b\u5145\u5230\u968f\u673a\u5316\u5904\u7406\u961f\u5217\u4e2d<\/p>\n

\n\t\u62a5\u544a\u7684\u635f\u5931\u662f\u6700\u8fd1\u4e00\u6279\u6570\u636e\u7684\u5e73\u5747\u635f\u5931\u3002\u8bf7\u6ce8\u610f\uff0c\u8be5\u635f\u5931\u662f\u4ea4\u53c9\u71b5\u548c\u6240\u6709\u6743\u91cd\u8870\u51cf\u9879\u7684\u548c<\/p>\n

\n\t\u8bf7\u7559\u610f\u4e00\u6279\u6570\u636e\u7684\u5904\u7406\u901f\u5ea6\u3002\u4e0a\u8ff0\u6570\u5b57\u662f\u5728 Tesla K40c \u4e0a\u5f97\u51fa\u7684\u7ed3\u679c\u3002\u5982\u679c\u60a8\u662f\u5728 CPU<\/u> \u4e0a\u8fd0\u884c\uff0c\u901f\u5ea6\u53ef\u80fd\u4f1a\u6162\u4e9b<\/p>\n

\n\t\u7ec3\u4e60\uff1a\u8fdb\u884c\u5b9e\u9a8c\u65f6\uff0c\u6709\u65f6\u5019\u7b2c\u4e00\u4e2a\u8bad\u7ec3\u6b65\u6301\u7eed\u65f6\u95f4\u6bd4\u8f83\u957f\u3002\u8bf7\u5c1d\u8bd5\u51cf\u5c11\u6700\u521d\u586b\u5145\u961f\u5217\u7684\u56fe\u50cf\u6570\u91cf\u3002\u5728cifar10_input.py \u4e2d\u641c\u7d22 min_fraction_of_examples_in_queue\u3002<\/p>\n

\n\tcifar10_train.py \u4f1a\u5b9a\u671f\u5c06\u6240\u6709\u6a21\u578b\u53c2\u6570\u4fdd\u5b58\u5728\u68c0\u67e5\u70b9\u6587\u4ef6\u4e2d\uff0c\u4f46\u4e0d\u4f1a\u5bf9\u6a21\u578b\u8fdb\u884c\u8bc4\u4f30\u3002cifar10_eval.py \u5c06\u4f7f\u7528\u68c0\u67e5\u70b9\u6587\u4ef6\u8861\u91cf\u9884\u6d4b\u6027\u80fd\uff08\u8bf7\u53c2\u9605\u4e0b\u6587\u4e2d\u7684\u8bc4\u4f30\u6a21\u578b\u90e8\u5206\uff09\u3002<\/p>\n

\n\t\u5982\u679c\u60a8\u6309\u7167\u4e0a\u8ff0\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff0c\u90a3\u4e48\u73b0\u5728\u5df2\u5f00\u59cb\u8bad\u7ec3 CIFAR-10 \u6a21\u578b\u4e86\u3002\u606d\u559c\uff01<\/p>\n

\n\tcifar10_train.py \u8fd4\u56de\u7684\u7ec8\u7aef\u6587\u672c\u51e0\u4e4e\u4e0d\u63d0\u4f9b\u4efb\u4f55\u6709\u5173\u6a21\u578b\u8bad\u7ec3\u60c5\u51b5\u7684\u4fe1\u606f\u3002\u6211\u4eec\u5e0c\u671b\u5728\u8bad\u7ec3\u671f\u95f4\u66f4\u6df1\u5165\u5730\u4e86\u89e3\u6a21\u578b\u7684\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n

\n\t\u635f\u5931\u662f\u771f\u7684\u5728\u51cf\u5c0f\uff0c\u8fd8\u662f\u53ea\u662f\u566a\u70b9\uff1f<\/p>\n

\n\t\u4e3a\u6a21\u578b\u63d0\u4f9b\u7684\u56fe\u50cf\u662f\u5426\u5408\u9002\uff1f<\/p>\n

\n\t\u68af\u5ea6\u3001\u6fc0\u6d3b\u51fd\u6570\u548c\u6743\u91cd\u7684\u503c\u662f\u5426\u5408\u7406\uff1f<\/p>\n

\n\t\u5f53\u524d\u7684\u5b66\u4e60\u901f\u7387\u662f\u591a\u5c11\uff1f<\/p>\n

\n\tTensorBoard \u53ef\u63d0\u4f9b\u6b64\u529f\u80fd\uff0c\u5b83\u4f1a\u901a\u8fc7 tf.summary.FileWriter \u663e\u793a\u5b9a\u671f\u4ece cifar10_train.py \u5bfc\u51fa\u7684\u6570\u636e\u3002<\/p>\n

\n\t\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u89c2\u770b local3 \u7279\u5f81\u4e2d\u6fc0\u6d3b\u51fd\u6570\u7684\u5206\u6b65\u53ca\u7a00\u758f\u7a0b\u5ea6\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7684\u53d8\u5316\u60c5\u51b5\uff1a<\/p>\n

\n\t<\/p>\n

\n\t\u8ddf\u8e2a\u5404\u4e2a\u635f\u5931\u51fd\u6570\u4ee5\u53ca\u603b\u635f\u5931\u5728\u4e0d\u540c\u65f6\u95f4\u6bb5\u7684\u60c5\u51b5\u5c24\u4e3a\u6709\u7528\u3002\u4e0d\u8fc7\uff0c\u7531\u4e8e\u8bad\u7ec3\u6240\u7528\u7684\u6279\u6b21\u8f83\u5c0f\uff0c\u56e0\u6b64\u635f\u5931\u4e2d\u5939\u6742\u7684\u566a\u70b9\u76f8\u5f53\u591a\u3002\u5728\u5b9e\u8df5\u4e2d\uff0c\u6211\u4eec\u53d1\u73b0\u9664\u4e86\u539f\u59cb\u503c\u4e4b\u5916\uff0c\u53ef\u89c6\u5316\u635f\u5931\u7684\u79fb\u52a8\u5e73\u5747\u503c\u4e5f\u975e\u5e38\u6709\u7528\u3002\u4e86\u89e3\u811a\u672c\u5982\u4f55\u5c06tf.train.ExponentialMovingAverage \u7528\u4e8e\u6b64\u7528\u9014\u3002<\/p>\n

\n\t\u8bc4\u4f30\u6a21\u578b<\/p>\n

\n\t\u73b0\u5728\uff0c\u6211\u4eec\u6765\u8bc4\u4f30\u4e00\u4e0b\u7ecf\u8fc7\u8bad\u7ec3\u7684\u6a21\u578b\u5728\u4fdd\u7559\u6570\u636e\u96c6\u4e0a\u7684\u8868\u73b0\u5982\u4f55\u3002\u8be5\u6a21\u578b\u7531\u811a\u672c cifar10_eval.py \u8fdb\u884c\u8bc4\u4f30\u3002\u5b83\u901a\u8fc7inference() \u51fd\u6570\u6784\u5efa\u6a21\u578b\uff0c\u5e76\u4f7f\u7528 CIFAR-10 \u8bc4\u4f30\u6570\u636e\u96c6\u4e2d\u7684\u5168\u90e8 10000 \u5f20\u56fe\u50cf\u3002\u5b83\u4f1a\u8ba1\u7b97 precision @ 1\uff0c\u8868\u793a\u5f97\u5206\u6700\u9ad8\u7684\u4e00\u9879\u9884\u6d4b\u4e0e\u56fe\u50cf\u7684\u771f\u5b9e\u6807\u7b7e\u4e00\u81f4\u7684\u9891\u7387\u3002<\/p>\n

\n\t\u4e3a\u4e86\u76d1\u63a7\u6a21\u578b\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7684\u6539\u8fdb\u60c5\u51b5\uff0c\u8bc4\u4f30\u811a\u672c\u4f1a\u5b9a\u671f\u5728 cifar10_train.py \u521b\u5efa\u7684\u6700\u65b0\u68c0\u67e5\u70b9\u6587\u4ef6\u4e0a\u8fd0\u884c\u3002<\/p>\n

\n\tpython cifar10_eval.py<\/p>\n

\n\t\u6ce8\u610f\u4e0d\u8981\u5728\u540c\u4e00 GPU \u4e0a\u540c\u65f6\u8fd0\u884c\u8bc4\u4f30\u548c\u8bad\u7ec3\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u5426\u5219\u53ef\u80fd\u4f1a\u8017\u5c3d\u5185\u5b58\u3002\u60a8\u53ef\u4ee5\u8003\u8651\u5728\u5176\u4ed6 GPU\uff08\u5982\u53ef\u7528\uff09\u4e0a\u5355\u72ec\u8fd0\u884c\u8bc4\u4f30\u4e8c\u8fdb\u5236\u6587\u4ef6\uff0c\u6216\u5728\u540c\u4e00 GPU \u4e0a\u8fd0\u884c\u8bc4\u4f30\u4e8c\u8fdb\u5236\u6587\u4ef6\u65f6\u6682\u505c\u8bad\u7ec3\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u8fd0\u884c\u3002<\/p>\n

\n\t\u60a8\u5e94\u8be5\u4f1a\u770b\u5230\u4ee5\u4e0b\u8f93\u51fa\uff1a<\/p>\n

\n\t2015-11-06 08:30:44.391206: precision @ 1 = 0.860...<\/p>\n

\n\t\u8be5\u811a\u672c\u53ea\u662f\u5b9a\u671f\u8fd4\u56de precision @ 1\uff0c\u5728\u672c\u4f8b\u4e2d\uff0c\u8fd4\u56de\u7684\u51c6\u786e\u7387\u4e3a 86%\u3002cifar10_eval.py \u8fd8\u4f1a\u5bfc\u51fa\u53ef\u4ee5\u5728 TensorBoard \u4e2d\u53ef\u89c6\u5316\u7684\u6c47\u603b\u3002\u5728\u8bc4\u4f30\u671f\u95f4\uff0c\u60a8\u53ef\u901a\u8fc7\u8fd9\u4e9b\u6c47\u603b\u8fdb\u4e00\u6b65\u4e86\u89e3\u6a21\u578b\u3002<\/p>\n

\n\t\u8bad\u7ec3\u811a\u672c\u4f1a\u8ba1\u7b97\u6240\u6709\u5df2\u5b66\u53d8\u91cf\u7684\u79fb\u52a8\u5e73\u5747\u503c\u3002\u8bc4\u4f30\u811a\u672c\u4f1a\u5c06\u6240\u6709\u5df2\u5b66\u6a21\u578b\u53c2\u6570\u66ff\u6362\u4e3a\u79fb\u52a8\u5e73\u5747\u503c\u3002\u8fd9\u79cd\u66ff\u6362\u53ef\u4ee5\u5728\u8bc4\u4f30\u65f6\u63d0\u5347\u6a21\u578b\u7684\u6027\u80fd\u3002<\/p>\n

\n\t\u7ec3\u4e60\uff1a\u6839\u636e precision @ 1\uff0c\u91c7\u7528\u5e73\u5747\u53c2\u6570\u53ef\u4ee5\u4f7f\u9884\u6d4b\u6027\u80fd\u63d0\u5347 3% \u5de6\u53f3\u3002\u4fee\u6539 cifar10_eval.py\uff0c\u4f7f\u6a21\u578b\u4e0d\u91c7\u7528\u5e73\u5747\u53c2\u6570\uff0c\u7136\u540e\u9a8c\u8bc1\u9884\u6d4b\u6027\u80fd\u662f\u5426\u4f1a\u4e0b\u964d\u3002<\/p>\n

\n\t\u4f7f\u7528\u591a\u4e2a GPU \u5361\u8bad\u7ec3\u6a21\u578b<\/p>\n

\n\t\u73b0\u4ee3\u5de5\u4f5c\u7ad9\u53ef\u80fd\u4f1a\u5305\u542b\u591a\u4e2a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684 GPU\u3002TensorFlow \u53ef\u5229\u7528\u6b64\u73af\u5883\u5728\u591a\u4e2a\u5361\u4e0a\u540c\u65f6\u8fd0\u884c\u8bad\u7ec3\u64cd\u4f5c\u3002<\/p>\n

\n\t\u5982\u679c\u8981\u4ee5\u5e76\u884c\u7684\u5206\u5e03\u5f0f\u65b9\u5f0f\u8bad\u7ec3\u6a21\u578b\uff0c\u5219\u9700\u8981\u534f\u8c03\u8bad\u7ec3\u8fc7\u7a0b\u3002\u5728\u63a5\u4e0b\u6765\u7684\u5185\u5bb9\u4e2d\uff0c\u672f\u8bed “\u6a21\u578b\u526f\u672c” \u6307\u5728\u6570\u636e\u5b50\u96c6\u4e0a\u8bad\u7ec3\u7684\u6a21\u578b\u526f\u672c\u3002<\/p>\n

\n\t\u7b80\u5355\u5730\u91c7\u7528\u6a21\u578b\u53c2\u6570\u5f02\u6b65\u66f4\u65b0\u65b9\u6cd5\u4f1a\u5bfc\u81f4\u8bad\u7ec3\u6027\u80fd\u65e0\u6cd5\u8fbe\u5230\u6700\u4f73\uff0c\u56e0\u4e3a\u5355\u4e2a\u6a21\u578b\u526f\u672c\u5728\u8bad\u7ec3\u65f6\u4f7f\u7528\u7684\u53ef\u80fd\u662f\u8fc7\u65f6\u7684\u6a21\u578b\u53c2\u6570\u3002\u53cd\u4e4b\uff0c\u5982\u679c\u91c7\u7528\u5b8c\u5168\u540c\u6b65\u7684\u66f4\u65b0\u540e\u53c2\u6570\uff0c\u5176\u901f\u5ea6\u582a\u6bd4\u6700\u6162\u7684\u6a21\u578b\u526f\u672c\u3002<\/p>\n

\n\t\u5728\u5177\u6709\u591a\u4e2a GPU \u5361\u7684\u5de5\u4f5c\u7ad9\u4e2d\uff0c\u6bcf\u4e2a GPU \u7684\u901f\u5ea6\u5927\u81f4\u76f8\u5f53\uff0c\u4e14\u5177\u6709\u8db3\u591f\u7684\u5185\u5b58\u6765\u8fd0\u884c\u6574\u4e2a CIFAR-10 \u6a21\u578b\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u9009\u62e9\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8bbe\u8ba1\u8bad\u7ec3\u7cfb\u7edf\uff1a<\/p>\n

\n\t\u5728\u6bcf\u4e2a GPU \u4e0a\u653e\u4e00\u4e2a\u6a21\u578b\u526f\u672c<\/p>\n

\n\t\u7b49\u5f85\u6240\u6709 GPU \u5b8c\u6210\u4e00\u6279\u6570\u636e\u7684\u5904\u7406\u5de5\u4f5c\uff0c\u7136\u540e\u540c\u6b65\u66f4\u65b0\u6a21\u578b\u53c2\u6570<\/p>\n

\n\t\u6a21\u578b\u793a\u610f\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

\n\t<\/p>\n

\n\t\u8bf7\u6ce8\u610f\uff0c\u6bcf\u4e2a GPU \u90fd\u4f1a\u9488\u5bf9\u4e00\u6279\u552f\u4e00\u7684\u6570\u636e\u8ba1\u7b97\u63a8\u7406\u548c\u68af\u5ea6\u3002\u8fd9\u79cd\u8bbe\u7f6e\u53ef\u4ee5\u6709\u6548\u5730\u5c06\u4e00\u5927\u6279\u6570\u636e\u5212\u5206\u5230\u5404\u4e2a GPU \u4e0a\u3002<\/p>\n

\n\t\u8fd9\u79cd\u8bbe\u7f6e\u8981\u6c42\u6240\u6709 GPU \u90fd\u5171\u4eab\u6a21\u578b\u53c2\u6570\u3002\u4f17\u6240\u5468\u77e5\uff0c\u5c06\u6570\u636e\u4f20\u8f93\u5230 GPU \u6216\u4ece\u4e2d\u5411\u5916\u4f20\u8f93\u6570\u636e\u7684\u901f\u5ea6\u975e\u5e38\u6162\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u51b3\u5b9a\u5728 CPU \u4e0a\u5b58\u50a8\u548c\u66f4\u65b0\u6240\u6709\u6a21\u578b\u53c2\u6570\uff08\u5982\u7eff\u8272\u65b9\u6846\u6240\u793a\uff09\u3002\u5f53\u6240\u6709 GPU \u5747\u5904\u7406\u5b8c\u4e00\u6279\u65b0\u6570\u636e\u65f6\uff0c\u7cfb\u7edf\u4f1a\u5c06\u4e00\u7ec4\u5168\u65b0\u7684\u6a21\u578b\u53c2\u6570\u4f20\u8f93\u7ed9\u76f8\u5e94 GPU\u3002<\/p>\n

\n\tGPU \u4f1a\u540c\u6b65\u8fd0\u884c\u3002GPU \u7684\u6240\u6709\u68af\u5ea6\u5c06\u7d2f\u79ef\u5e76\u6c42\u5e73\u5747\u503c\uff08\u5982\u7eff\u8272\u65b9\u6846\u6240\u793a\uff09\u3002\u6a21\u578b\u53c2\u6570\u4f1a\u66f4\u65b0\u4e3a\u6240\u6709\u6a21\u578b\u526f\u672c\u7684\u68af\u5ea6\u5e73\u5747\u503c\u3002<\/p>\n

\n\t\u5c06\u53d8\u91cf\u548c\u64cd\u4f5c\u653e\u5230\u591a\u4e2a\u8bbe\u5907\u4e0a<\/p>\n

\n\t\u5c06\u64cd\u4f5c\u548c\u53d8\u91cf\u653e\u5230\u591a\u4e2a\u8bbe\u5907\u4e0a\u9700\u8981\u4e00\u4e9b\u7279\u6b8a\u7684\u62bd\u8c61\u64cd\u4f5c\u3002<\/p>\n

\n\t\u7b2c\u4e00\u4e2a\u62bd\u8c61\u64cd\u4f5c\u662f\u8ba1\u7b97\u5355\u4e2a\u6a21\u578b\u526f\u672c\u7684\u63a8\u7406\u548c\u68af\u5ea6\u7684\u51fd\u6570\u3002\u5728\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5c06\u6b64\u62bd\u8c61\u64cd\u4f5c\u79f0\u4e3a “tower”\u3002\u6211\u4eec\u5fc5\u987b\u4e3a\u6bcf\u4e2a tower \u8bbe\u7f6e\u4e24\u4e2a\u5c5e\u6027\uff1a<\/p>\n

\n\ttower \u4e2d\u6240\u6709\u64cd\u4f5c\u7684\u552f\u4e00\u540d\u79f0\u3002 tf.name_scope \u901a\u8fc7\u6dfb\u52a0\u4f5c\u7528\u57df\u524d\u7f00\u63d0\u4f9b\u552f\u4e00\u7684\u540d\u79f0\u3002\u4f8b\u5982\uff0c\u7b2c\u4e00\u4e2a tower \u4e2d\u7684\u6240\u6709\u64cd\u4f5c\u90fd\u4f1a\u9644\u5e26 tower_0 \u524d\u7f00\uff0c\u4f8b\u5982 tower_0\/conv1\/Conv2D<\/p>\n

\n\t\u8fd0\u884c tower \u4e2d\u64cd\u4f5c\u7684\u9996\u9009\u786c\u4ef6\u8bbe\u5907\u3002 tf.device \u4f1a\u6307\u5b9a\u8be5\u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u7b2c\u4e00\u4e2a tower \u4e2d\u7684\u6240\u6709\u64cd\u4f5c\u90fd\u4f4d\u4e8edevice('\/device:GPU:0') \u4f5c\u7528\u57df\u5185\uff0c\u8868\u793a\u5b83\u4eec\u5e94\u5728\u7b2c\u4e00\u4e2a GPU \u4e0a\u8fd0\u884c<\/p>\n

\n\t\u4e3a\u4e86\u5728\u591a GPU \u7248\u672c\u4e2d\u5171\u4eab\u53d8\u91cf\uff0c\u6240\u6709\u53d8\u91cf\u90fd\u56fa\u5b9a\u5230 CPU \u4e0a\u4e14\u901a\u8fc7 tf.get_variable \u8bbf\u95ee\u3002\u4e86\u89e3\u5982\u4f55\u5171\u4eab\u53d8\u91cf\u3002<\/p>\n

\n\t\u5728\u591a\u4e2a GPU \u5361\u4e0a\u542f\u52a8\u5e76\u8bad\u7ec3\u6a21\u578b<\/p>\n

\n\t\u5982\u679c\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5\u4e86\u591a\u4e2a GPU \u5361\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 cifar10_multi_gpu_train.py \u811a\u672c\u501f\u52a9\u5b83\u4eec\u52a0\u5feb\u6a21\u578b\u7684\u8bad\u7ec3\u8fc7\u7a0b\u3002\u6b64\u7248\u8bad\u7ec3\u811a\u672c\u53ef\u5728\u591a\u4e2a GPU \u5361\u4e0a\u5e76\u884c\u8bad\u7ec3\u6a21\u578b\u3002<\/p>\n

\n\tpython cifar10_multi_gpu_train.py --num_gpus=2<\/p>\n

\n\t\u8bf7\u6ce8\u610f\uff0c\u4f7f\u7528\u7684 GPU \u5361\u6570\u91cf\u9ed8\u8ba4\u4e3a 1\u3002\u6b64\u5916\uff0c\u5982\u679c\u8ba1\u7b97\u673a\u4e0a\u4ec5\u6709\u4e00\u4e2a GPU\uff0c\u5219\u6240\u6709\u8ba1\u7b97\u90fd\u4f1a\u5728\u8be5 GPU \u4e0a\u8fd0\u884c\uff0c\u5373\u4f7f\u60a8\u8bbe\u7f6e\u7684\u662f\u591a\u4e2a GPU\u3002<\/p>\n

\n\t\u7ec3\u4e60\uff1acifar10_train.py \u7684\u9ed8\u8ba4\u8bbe\u7f6e\u662f\u5728\u5927\u5c0f\u4e3a 128 \u7684\u6279\u6b21\u6570\u636e\u4e0a\u8fd0\u884c\u3002\u8bf7\u5c1d\u8bd5\u5728 2 \u4e2a GPU \u4e0a\u8fd0\u884ccifar10_multi_gpu_train.py\uff0c\u6279\u6b21\u5927\u5c0f\u4e3a 64\uff0c\u7136\u540e\u6bd4\u8f83\u8fd9\u4e24\u79cd\u65b9\u5f0f\u7684\u8bad\u7ec3\u901f\u5ea6\u3002<\/p>\n

\n\t\u540e\u7eed\u5b66\u4e60\u8ba1\u5212<\/p>\n

\n\t\u5982\u679c\u60a8\u6709\u5174\u8da3\u5f00\u53d1\u5e76\u8bad\u7ec3\u60a8\u81ea\u5df1\u7684\u56fe\u50cf\u5206\u7c7b\u7cfb\u7edf\uff0c\u6211\u4eec\u5efa\u8bae\u60a8\u5206\u53c9\u672c\u6559\u7a0b\u7684\u4ee3\u7801\uff0c\u5e76\u66ff\u6362\u7ec4\u4ef6\u4ee5\u89e3\u51b3\u60a8\u7684\u56fe\u50cf\u5206\u7c7b\u95ee\u9898\u3002<\/p>\n

\n\t\u7ec3\u4e60\uff1a\u4e0b\u8f7d Street View House Numbers (SVHN) \u6570\u636e\u96c6\uff08http:\/\/ufldl.stanford.edu\/housenumbers\/\uff09\u3002\u5206\u53c9 CIFAR-10 \u6559\u7a0b\u7684\u4ee3\u7801\u5e76\u5c06\u8f93\u5165\u6570\u636e\u66ff\u6362\u4e3a SVHN\u3002\u5c1d\u8bd5\u8c03\u6574\u7f51\u7edc\u67b6\u6784\u4ee5\u63d0\u9ad8\u9884\u6d4b\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4eca\u5929\u7684\u6587\u7ae0\u662f\u6709\u5173 \u9ad8\u7ea7\u5377\u79ef\u795e\u7ecf \u7684\u6559\u7a0b\u3002\u6211\u4eec\u5e0c\u671b\u60a8\u80fd\u591f\u4ee5\u672c\u6587\u4e3a\u8d77\u70b9\uff0c\u5728 TensorFlow \u4e0a\u6784\u5efa\u66f4\u5927\u7684 CNN \u6765\u5904\u7406\u89c6\u89c9\u4efb\u52a1\u3002 \u6982\u8ff0 CIFAR-10 \u5206\u7c7b\u95ee\u9898\u662f \u673a\u5668\u5b66\u4e60 \u9886\u57df\u4e00\u79cd\u5e38\u89c1\u7684\u57fa\u51c6\u95ee\u9898\uff0c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/1846"}],"collection":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1846"}],"version-history":[{"count":0,"href":"http:\/\/www.szryc.com\/index.php?rest_route=\/wp\/v2\/posts\/1846\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1846"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.szryc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}