Tensorflow Retrain on Windows

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

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.