您好,登錄后才能下訂單哦!
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。