温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Tensorflow related

发布时间:2020-06-18 05:00:11 来源:网络 阅读:2196 作者:CamilleIT 栏目:开发技术

How to Retrain Inception's Final Layer for New Categories

步骤:

一 Installing TensorFlow on Ubuntu   

https://www.tensorflow.org/install/install_linux

二 Install Bazel on Ubuntu

https://bazel.build/versions/master/docs/install-ubuntu.html


三 下载代码 

git clone https://github.com/tensorflow/tensorflow.git

~/tensorflow$  ./configure

四 编译

bazel build tensorflow/examples/p_w_picpath_retraining:retrain

五 注意事项:

1  bazel-bin/tensorflow/examples/label_p_w_picpath/label_p_w_picpath --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt --output_layer=final_result --p_w_picpath=/home/camille/Desktop/timg.jpg


命令报错:

017-06-20 12:52:52.774446: E tensorflow/examples/label_p_w_picpath/main.cc:350] Running model failed: Not found: FeedInputs: unable to find feed output input

解决方案:在后面加一句 --input_layer=Mul //this parameter update the input and output layer names to "Mul" and "final_result" respectively

2下载tensorflow 代码时,

git clone https://github.com/tensorflow/tensorflow.git

直接执行 bazel build tensorflow/examples/p_w_picpath_retraining:retrain

报错 build aborted

解决方案: 执行 ./configure 

再执行 bazel build tensorflow/examples/p_w_picpath_retraining:retrain 就没问题了。

3  Bazel 安装之前一定要安装jdk


sudo apt-get install oracle-java8-installer

I recommend you to use Webup8 Oracle Java8 Installer


sudo add-apt-repository ppa:webupd8team/java

sudo apt update; sudo apt-get install oracle-java8-installer

or 

sudo apt update; sudo apt-get install oracle-java8-set-default


4 执行 


bazel-bin/tensorflow/examples/p_w_picpath_retraining/retrain --p_w_picpath_dir ~/flower_photos

时报错:1)

   File "/home/karthik/tensorflow/bazel-bin/tensorflow/examples/p_w_picpath_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/util/tf_should_use.py", line 28, in <module>
       from backports import weakref  # pylint: disable=g-bad-import-order
   ImportError: No module named backports

解决方案:安装所需module

sudo pip install backports.weakref
sudo pip3 install backports.weakref

报错2) 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named numpy
Is numpy installed?

解决方案: sudo apt-get install python-numpy

5 ImportError: No module named mock

实际上安装了,所以只能先删除再安装了

解决方案: 

$ sudo rm -rf /usr/local/lib/python2.7/dist-packages/mock
$ sodo rm -rf /usr/local/lib/python2.7/dist-packages/mock-2.0.0.dist-info

then type the following command to install mock

$ sudo pip install --upgrade mock


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI