{"id":733,"date":"2018-10-07T17:43:12","date_gmt":"2018-10-07T08:43:12","guid":{"rendered":"http:\/\/www.ecobioinfo.com\/?p=733"},"modified":"2022-06-05T22:52:29","modified_gmt":"2022-06-05T13:52:29","slug":"%e6%b7%b1%e5%b1%a4%e5%ad%a6%e7%bf%92%e3%80%80ubuntu-18-04-%e3%81%ab-tensorflow-%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"http:\/\/www.ecobioinfo.com\/?p=733","title":{"rendered":"\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 18.04 \u306b Tensorflow \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<p>Ubuntu\u306e\u6700\u65b0\u7248 18.04 \u306b Tensorflow \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\uff08Tensorflow GPU\u306b\u3064\u3044\u3066\u306f CUDA10 \u306b\u672a\u5bfe\u5fdc\u306e\u3088\u3046\u306a\u306e\u3067\u5f8c\u56de\u3057\u306b\u3057\u307e\u3059\u3002\uff09<br \/>\n\uff1c\uff1c\uff1c\u3000\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u3000\uff1e\uff1e\uff1e<\/p>\n<p>\u30cf\u30fc\u30c9\uff1a\u30de\u30a6\u30b9\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u30fc LM-iH700B2N<br \/>\nCPU\uff1a Intel\u00ae Core\u2122 i3-8100 CPU @ 3.60GHz \u00d7 4<br \/>\n\u30e1\u30e2\u30ea\uff1a 4 GByte<br \/>\n\u672c\u4f53\u96fb\u6e90\uff1a 500W<br \/>\n\u30b0\u30e9\u30d5\u30a3\u30c3\u30af\u30dc\u30fc\u30c9\uff1aNVIDIA GEFORCE GTX960 \u30e1\u30e2\u30ea 4GB<br \/>\n(1) Ubuntu 18 \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>Ubuntu \u306e\u30b5\u30a4\u30c8\u304b\u3089 18.04.1 LTS\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001DVD\u306b\u713c\u3044\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p><a href=\"https:\/\/www.ubuntulinux.jp\/download\/ja-remix\">https:\/\/www.ubuntulinux.jp\/download\/ja-remix<\/a><\/p>\n<p>\u9014\u4e2d\u3001\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u30fc\u88fd\u306e\u30bd\u30d5\u30c8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u30c1\u30a7\u30c3\u30af\u3002<br \/>\n\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u304c\u5fc5\u8981\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001NVIDIA\u30c9\u30e9\u30a4\u30d0\u306e\u8a2d\u5b9a\u3002\uff08\u4eca\u56de\u306fGPU\u7248\u306f\u4f7f\u308f\u306a\u3044\u306e\u3067\u91cd\u8981\u3067\u306f\u306a\u3044\u3067\u3059\u3002\uff09<br \/>\nUbuntu\u30bd\u30d5\u30c8\u30a6\u30a8\u30a2\u306e\u691c\u7d22\u304b\u3089 Software &amp; Updates \u3092\u63a2\u3059\u3002<br \/>\n\u4e00\u89a7\u304b\u3089 Software &amp; Updates \u3092\u9078\u3093\u3067\u8d77\u52d5\u3002<\/p>\n<p>\u300c\u8ffd\u52a0\u306e\u30c9\u30e9\u30a4\u30d0\u300d-&gt;\u300cNDIDIA Driver &#8230;. nvidia-driver-390 \u304b\u3089\u4f7f\u7528\u3057\u307e\u3059\u3002&#8230;\u300d \u3092\u9078\u629e\u3001\u300c\u5909\u66f4\u306e\u9069\u7528\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3002\u9014\u4e2d Secure boot \u7528\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001\u518d\u8d77\u52d5\u3002<br \/>\n(2) Anaconda + Python \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>Anaconda\u306e\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<br \/>\n<a href=\"https:\/\/www.anaconda.com\/download\/#download\">https:\/\/www.anaconda.com\/download\/#download<\/a><\/p>\n<p>Python 3.7 version Linux 64bit(x86) \u3092\u9078\u629e\u3002<br \/>\nAnaconda3-5.3.0-Linux-x86_64.sh \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3002<\/p>\n<p>\u5b9f\u884c\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u3066\u5b9f\u884c\u3002<\/p>\n<p>~$\u00a0 chmod +x Anaconda3-5.3.0-Linux-x86_64.sh<br \/>\n~$\u00a0 .\/Anaconda3-5.3.0-Linux-x86_64.sh<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5834\u6240\uff1a\/home\/(username)\/anaconda3\/<\/p>\n<p>Anaconda\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u7d42\u4e86\u5f8c\u3001Microsoft VSCode? \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u305f\u306e\u3067\u3064\u3044\u3067\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<p>\u7d42\u4e86\u5f8c\u30d1\u30b9\u8a2d\u5b9a\u3002<\/p>\n<p>~$\u00a0 source .bashrc<\/p>\n<p>Tensorflow\u306e\u4e92\u63db\u6027\u306e\u90fd\u5408\u3067\u30013.6 \u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u53c2\u8003\uff1a<br \/>\n<a href=\"http:\/\/docs.anaconda.com\/anaconda\/faq\/#how-do-i-get-the-latest-anaconda-with-python-3-5\">http:\/\/docs.anaconda.com\/anaconda\/faq\/#how-do-i-get-the-latest-anaconda-with-python-3-5<\/a><br \/>\n~$\u00a0 conda install python=3.6<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3002<br \/>\n~$\u00a0 conda create -n tf<br \/>\n~$\u00a0 source activate tf<\/p>\n<p>\u78ba\u8a8d\u3002<br \/>\n(tf) ~$ python -V<br \/>\nPython 3.6.6 :: Anaconda, Inc.<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u304b\u3089\u623b\u308b\u3002<br \/>\n(tf) ~$ source deactivate tf<\/p>\n<p>(2)TensorFlow, TfLearn \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>pip\u3067\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u306e\u3067 pip3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>~$\u00a0 sudo apt install python3-pip<\/p>\n<p>~$\u00a0 pip3 install tensorflow<br \/>\n~$\u00a0 pip3 install tflearn<\/p>\n<p>python \u3092\u8d77\u52d5\u3057\u3066\u78ba\u8a8d\u3002<\/p>\n<p>&gt;&gt;&gt;import tensorflow<br \/>\n&gt;&gt;&gt;import tflearn<\/p>\n<p>\u30a8\u30e9\u30fc\u306a\u3057\u3002<br \/>\n(3) Keras \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>~$ pip install keras<\/p>\n<p>python \u3092\u8d77\u52d5\u3057\u3066\u78ba\u8a8d\u3002<\/p>\n<p>&gt;&gt;&gt; import keras<br \/>\nUsing TensorFlow backend.<br \/>\n&gt;&gt;&gt;<\/p>\n<p>\u30a8\u30e9\u30fc\u306a\u3057\u3002<br \/>\n(4)\u4eee\u60f3\u74b0\u5883\u3067 jupyter notebook \u3092\u8d77\u52d5<\/p>\n<p>~$ cd \/home\/(username)\/anaconda3\/envs\/tf\/<br \/>\n~$ source activate tf<br \/>\n(tf) ~$ jupyter notebook<br \/>\n(5)\u52d5\u4f5c\u78ba\u8a8d<\/p>\n<p><a href=\"https:\/\/www.ecobioinfo.com\/?p=464\">\u300c\u6df1\u5c64\u5b66\u7fd2 TensorFlow \u3092 MNIST \u3067\u8a66\u3059<\/a>\u300d\u00a0\u306e\u30bd\u30fc\u30b9\u3067\u30c6\u30b9\u30c8\u3002<\/p>\n<p>Training Step: 9900\u00a0 | total loss: 0.06449 | time: 3.251s<br \/>\n| SGD | epoch: 020 | loss: 0.06449 &#8211; acc: 0.9774 | val_loss: 0.07195 &#8211; val_acc: 0.9800 &#8212; iter: 49500\/49500<br \/>\n&#8212;<br \/>\nlearning start:2018-10-07 16:52:26.663276<br \/>\nlearning end:\u20192018-10-07 16:53:43.797602<br \/>\npredict start:2018-10-07 16:53:43.797706<br \/>\npredict end:2018-10-07 16:53:43.872087<br \/>\n[7 2 1 &#8230; 4 5 6]<br \/>\n[7 2 1 &#8230; 4 5 6]<br \/>\n0.9807<\/p>\n<p>\u30a8\u30e9\u30fc\u306a\u3057\u3002<\/p>\n<p><a href=\"http:\/\/www.ecobioinfo.com\/?p=582\">\u300c\u6df1\u5c64\u5b66\u7fd2\u3000Keras\uff08TensorFlow\u7528\uff09\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d\u00a0\u306e\u30bd\u30fc\u30b9\u3067\u30c6\u30b9\u30c8\u3002<\/p>\n<p>Epoch 20\/20<br \/>\n54000\/54000 [==============================] &#8211; 2s 32us\/step &#8211; loss: 0.2555 &#8211; acc: 0.9268 &#8211; val_loss: 0.1639 &#8211; val_acc: 0.9573<br \/>\n[7 2 1 &#8230; 4 5 6]<br \/>\n[7 2 1 &#8230; 4 5 6]<br \/>\n0.9453<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>\u30a8\u30e9\u30fc\u306f\u51fa\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u4eca\u65e5\u306f\u3068\u308a\u3042\u3048\u305a\u3053\u3053\u307e\u3067\u3002<br \/>\n\uff08GPU\u306b\u3064\u3044\u3066\u306f\u6b21\u306e\u6a5f\u4f1a\u306b\u3057\u307e\u3059\u3002\uff09<\/p>\n<p>&nbsp;<\/p>\n<p>\u3010\u53c2\u8003\u6587\u732e\u3011\u3053\u306e\u30d6\u30ed\u30b0\u306e\u53c2\u8003\u66f8\u7c4d\u306f\u3053\u3061\u3089\u306b\u307e\u3068\u3081\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/www.ecobioinfo.com\/?page_id=838\">http:\/\/www.ecobioinfo.com\/?page_id=838<\/a><br \/>\n\uff082018\/10\/07 S.Onda\uff09<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"Ubuntu\u306e\u6700\u65b0\u7248 18.04 \u306b Tensorflow \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \uff08Tensorflow GPU\u306b\u3064\u3044\u3066\u306f CUDA10 \u306b\u672a\u5bfe\u5fdc\u306e\u3088\u3046\u306a\u306e\u3067\u5f8c\u56de\u3057\u306b\u3057\u307e\u3059\u3002\uff09 \uff1c\uff1c\uff1c\u3000\u30cf\u30fc\u30c9\u30a6\u30a7\u30a2\u3000\uff1e\uff1e\uff1e \u30cf\u30fc &#8230;","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-ai_ecobio"],"_links":{"self":[{"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=733"}],"version-history":[{"count":13,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions"}],"predecessor-version":[{"id":1493,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions\/1493"}],"wp:attachment":[{"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}