Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'keys' #13

Open
henriqueblobato opened this issue Aug 18, 2017 · 11 comments
Open

AttributeError: 'NoneType' object has no attribute 'keys' #13

henriqueblobato opened this issue Aug 18, 2017 · 11 comments

Comments

@henriqueblobato
Copy link

henriqueblobato commented Aug 18, 2017

SO: Ubuntu 16.04
Docker: 2.5.0
Python3: 3.5.2
Python2 : 2.7.12
Tensorflow: 1.3.0 (intalled at both Python)

Made commands as root

./build.sh
./train.sh /<images/path>/tensorflow_image_classifier-master/pictures/training

Folders structure:

  • tensorflow_image_classifier-master
    • src
    • pictures
      • test
      • training
        • cats
        • dogs

I honestly dont know why im getting this error

root@mw:~<path>/tensorflow_image_classifier-master# ./train.sh /<path>/tensorflow_image_classifier-master/pictures/training
Image directory '/tf_files/data' not found.
Traceback (most recent call last):
  File "tensorflow/examples/image_retraining/retrain.py", line 824, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "tensorflow/examples/image_retraining/retrain.py", line 721, in main
    class_count = len(image_lists.keys())
AttributeError: 'NoneType' object has no attribute 'keys'

EDIT: It was without the data folder

@VirgilMa
Copy link

VirgilMa commented Mar 5, 2018

same here too

@klango
Copy link

klango commented Apr 15, 2018

Same here, were you guys able to fix this?

@MathiasHaudgaard
Copy link

Getting the same error. Has this been fixed yet?

@MathiasHaudgaard
Copy link

@llSourcell do you know what causes this problem?

@rubenCodeforges
Copy link

Same here but looks like the repo is dead

@gstok
Copy link

gstok commented Nov 27, 2018

You can use the latest tensorflow under ubuntu and python27, In fact, this is an official example of tensorflow https://github.com/tensorflow/hub/tree/master/examples/image_retraining, I have successfully built the official tutorial.

@asnair
Copy link

asnair commented Feb 14, 2019

This happens because the folder hierarchy isn't correct. Instead of having your data in
/some/path/to/tensorflow_image_classifier-master/data then categories, you're missing the /data/ part. Your folder must be named 'data' and contain folder categories:
/some/path/to/classifier/data/class1
/some/path/to/classifier/data/class2

Once this is fixed you will get more errors, but not the same errors. Using the official tutorial is probably easier (EDIT: https://github.com/tensorflow/hub/tree/master/examples/image_retraining )

@csabag
Copy link

csabag commented Apr 4, 2019

you have to give the full path of your classifier folder without the trailing /
E.g. /some/path/to/classifier

@fanyoujian
Copy link

hello how to deal this bug?

@klango
Copy link

klango commented Jun 18, 2019

hello how to deal this bug?

This is not a Bug. Its related to the full path including the /data folder.

@knightowl2704
Copy link

knightowl2704 commented Jul 8, 2019

Hey! Take care of the empty spaces between the directory names and it will work. Even the space between --image_directory=/your/path/to/training/folder/here
If space is encountered in any folder name leading to the training images directory, write it as :
for ex : folder name => "training images"
cd training\ images
This will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants