简体   繁体   中英

Uncertain how to run Bazel: Tensorflow Inception Retrain New Categories Tutorial Python

I am experiencing difficulty using Bazel. More specifically with the workspace requirements. I am not sure how to interpret the following line of code from the TF Retrain Inception tutorial.

**bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos**

I am able to build the "retrain.py" file. This is my output from my build:

*r@r-VirtualBox:~/Desktop/sf_tensorflow-master/tensorflow/examples/image_retraining$ bazel build retrain.py

INFO: Found 1 target...

INFO: Elapsed time: 0.200s, Critical Path: 0.01s*

But I am uncertain how to proceed with the next step. Is "bazel-bin" a folder somewhere? is it included in the Tensorflow example folder? Or is this something I have to generate?

Also, the way in which "retrain" is being referenced in the code makes me think it is a folder and no longer a python file. Did it change through this process?

I would greatly appreciate a more detailed breakdown of what Bazel is doing in this line of code and how I adjust it to run the code on my directory of images.

Thanks!

I believe to run this example you will have had to have built Tensorflow from source. It appears you're running some Linux distro; you can find the bazel build instructions here . Once you have that installed, you can pull the bleeding edge Tensorflow from here and here are "building from source" instructions. Assuming you've done all of that, if you navigate to the root of the project ie

cd tensorflow

you should see something like this

在此处输入图片说明

you can see there are 5 bazel symlinks, one of which is bazel-bin .

Now just download the images as directed and build with

bazel build -c opt --copt=-mavx tensorflow/examples/image_retraining:retrain

Once the build is finished you can run the retraining

bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos

Note that both of the above commands need to be run from the root of the project ( tensorflow/ in this case) and the tutorial assumes you have put the flower images in your home dir.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM