ubuntu 安裝tsensor

迷霧綠洲發表於2018-05-21

安裝pip

  開啟終端輸入命令:sudo apt-get install python-pip python-dev

安裝tensorflow

  sudopip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl   最好晚上安裝,白天試了幾次總段。

下在一個訓練好的model
mkdir models
git clone https://github.com/tensorflow/models.git 也可以直接下載zip壓縮包,畢竟網速很慢直接clone 很容易前功盡棄,同樣晚上成功率高。
找個圖片練習下:
mkdir model
把圖片放到這個目錄
這裡寫圖片描述
cd models/models/tutorials/image/imagenet

python2.7 classify_image.py –model_dir /home/will/model –image_file /home/will/model/timg.jpeg

看看輸出結果

W tensorflow/core/framework/op_def_util.cc:332] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
cellular telephone, cellular phone, cellphone, cell, mobile phone (score = 0.35905)
iPod (score = 0.13026)
hand-held computer, hand-held microcomputer (score = 0.06378)
radio, wireless (score = 0.03233)
remote control, remote (score = 0.01750)

顯示說手機的概率有35%
ipod 13%   還是很準確的

相關文章