I'm trying to load the VGG16 model from Keras to perform transfer learning,
input_shape = (224, 224, 3)
model = VGG16(weights='imagenet', include_top=False, input_shape=input_shape)
but I'm getting the following error:
Traceback (most recent call last):
File "<ipython-input-27-898653ab5324>", line 1, in <module>
model = VGG16(weights='imagenet', include_top=False)
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasapplications\__init__.py", line 49, in wrapper
return base_fun(*args, **kwargs)
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasapplicationsvgg16.py", line 32, in VGG16
return vgg16.VGG16(*args, **kwargs)
File "C:UsersjywljAppDataRoamingPythonPython37site-packageskeras_applicationsvgg16.py", line 209, in VGG16
file_hash='6d6bbae143d832006294945121d1f1fc')
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasutilsdata_utils.py", line 223, in get_file
if not validate_file(fpath, file_hash, algorithm=hash_algorithm):
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasutilsdata_utils.py", line 324, in validate_file
if str(_hash_file(fpath, hasher, chunk_size)) == str(file_hash):
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasutilsdata_utils.py", line 299, in _hash_file
for chunk in iter(lambda: fpath_file.read(chunk_size), b''):
File "C:UsersjywljAppDataRoamingPythonPython37site-packagesensorflow_corepythonkerasutilsdata_utils.py", line 299, in <lambda>
for chunk in iter(lambda: fpath_file.read(chunk_size), b''):
PermissionError: [Errno 13] Permission denied
This is really strange, as loading the VGG19 network gives me no problem. Also, if I remove the "include_top" argument, the model loads successfully without throwing the error.
# This works fine
model = VGG16(weights='imagenet')
Can anyone help with this? Thanks.
question from:
https://stackoverflow.com/questions/65942067/errno-13-permission-denied-keras-vgg16 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…