Reputation: 363
I am trying to make a simple Image Classifier using Tensorflow. From here https://medium.com/@linjunghsuan/create-a-simple-image-classifier-using-tensorflow-a7061635984a
I am using Anaconda2 on Windows 10 (64bit) Packages used The following NEW packages will be INSTALLED:
certifi: 2016.2.28-py35_0
pip: 9.0.3-py35_1
python: 3.5.4-0
setuptools: 36.4.0-py35_1
vc: 14-0
vs2015_runtime: 14.0.25420-0
wheel: 0.29.0-py35_0
wincertstore: 0.2-py35_0
I downloaded retrain.py from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py
When I am trying to train the data using
python {$your-working_directory}/retrain.py
I am getting these errors
[tensorflow] C:\Users\user>python F:\Tensorflow\retrain.py
ERROR:tensorflow:Image directory '' not found.
Traceback (most recent call last):
File "F:\Tensorflow\retrain.py", line 1409, in <module>
tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)
File "F:\Coursera ML\Anaconda2\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 126, in run
_sys.exit(main(argv))
File "F:\Tensorflow\retrain.py", line 1061, in main
class_count = len(image_lists.keys())
AttributeError: 'NoneType' object has no attribute 'keys'
In F:\Tensorflow there is one folder with the dataset images and the retrain.py
I am a beginner and this is my first time using Tensorflow and Deep Learning. I scrubbed through StackOverflow and Github but I couldnt find any solution that worked. I think i am making an error with the directories of the images of the data set. Any help is appreciated. Thanks in advance. (Also if you need additional information regarding anything please do let me know)
Upvotes: 0
Views: 9794
Reputation: 1676
For MAC users who found same error
Solution of "Palash Taneja" can help (Paths will be different on mac):
Example command for MAC users to make training model from images:
python3 code/retrain.py --image_dir flower_photos --bottleneck_dir=bottleneck --how_many_training_steps 500 --model_dir=model --output_graph=graph/retrained_graph.pb --output_labels=graph/retrained_labels.txt
File and directory tree of terminal's working directory: (Here ML is working directory)
ML/code/retain.py
ML/flower_photos/{various dir of flowers or any images}
ML/graph
ML/model
ML/bottleneck
Upvotes: 0
Reputation: 46
You are not supplying all the required parameters in the command line
Windows example from the post you linked: example (SO won't let me post images. )
If the file is stored in C:\training_data
and assuming your working directory is F:\Tensorflow
then the command is
python F:\Tensorflow\retrain.py --image_dir C:\training_data --how_many_training_steps 500 --model_dir F:\Tensorflow\inception --output_graph=F:\Tensorflow\retrained_graph.pb --output_labels=F:\Tensorflow\retrained_labels.txt
Upvotes: 3