AttributeError: 'NoneType' object has no attribute 'get_file'

Error when migrating learning xception with keras:

Traceback (most recent call last):
  File "../xception_test/xception1.py", line 202, in <module>
    print('Predicted:', decode_predictions(preds, 1))
  File "..\lib\site-packages\keras_applications\imagenet_utils.py", line 225, in decode_predictions
    fpath = keras_utils.get_file(
AttributeError: 'NoneType' object has no attribute 'get_file'

 Imagenet_utils.py into the corresponding row, find the problem imagenet_class_index.json downloaded file:

Function keras_utils.get_file () refer to the use keras document [1] .

CLASS_INDEX_PATH path of the file is downloaded, find the corresponding position:

Manually download the file, if hold off, you can click here to download.

The document [2] , wherein the Step 2: Input open .keras / models / Movies hidden folder open Models, will go into the above three documents

And I did not find the models folder, so I easily found a place to put, and then download the file comment out function, input file address:

Run the code again, there is no error, run successfully!

 

Reference Documents

[1] Keras Chinese documents

[2] keras vgg16 model for the first time Precautions

Published 73 original articles · won praise 55 · views 60000 +

Guess you like

Origin blog.csdn.net/qq_35756383/article/details/103587910