Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow Retrain on Windows

When I follow the tutorials of "How to Retrain Inception's Final Layer for New Categories", I need to build the retainer like this

bazel build tensorflow/examples/image_retraining:retrain

However, my tensorflow on windows does not have such directory. I am wondering why and how can I solve the problem? enter image description here

Thank you in advance

like image 258
PIZZA PIZZA Avatar asked Jan 02 '17 21:01

PIZZA PIZZA


3 Answers

In my case tensorflow version is 1.2 and corresponding retrain.py is here. enter image description here Download and extract flowers images from here. Now run the the retrain.py file as

python retrain.py --image_dir=path\to\dir\where\flowers\images\where\extracted --output_lables=retrained_labels.txt --output_graph=retrained_graph.pb

note: the last two arguments in the above command are optional.

Now to test the retrained model:

  • go the master branch and download the label_image.py code as shown below
  • enter image description here
  • Then run python label_image.py --image=image/path/to/test/classfication --graph=retrained_graph.pb --labels=retrained_labels.txt
  • The result will be like enter image description here
like image 112
javed Avatar answered Oct 21 '22 19:10

javed


From the screenshot, it appears that you have installed the TensorFlow PIP package, whereas the instructions in the image retraining tutorial assume that you have cloned the Git repository (and can use bazel to build TensorFlow).

However, fortunately the script (retrain.py) for image retraining is a simple Python script, which you can download and run without building anything. Simply download the copy of retrain.py from the branch of the TensorFlow repository that matches your installed package (e.g. if you've installed TensorFlow 0.12, you can download this version), and you should be able to run it by typing python retrain.py at the Command Prompt.

like image 5
mrry Avatar answered Oct 21 '22 19:10

mrry


I had the same problem on windows. My windows could not find script.retrain. I downloaded retrain.py file from tensoflow website at here. Then, copied the file in the tensorflow folder and run the retrain script using Python command.

like image 1
Enayat Avatar answered Oct 21 '22 19:10

Enayat