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

633 views Asked by At

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!

1

There are 1 answers

1
o-90 On

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 i.e.

cd tensorflow

you should see something like this

enter image description here

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.