Hi Guys,
I am trying to install imagenet weights to create my CNN model. But It gives me the below error.
model = MobileNet(weights='imagenet' ,include_top = False, input_shape=(224,224,3))
ImportError Traceback (most recent call last)
<ipython-input-2-f144cafed21b> in <module>
----> 1 model = MobileNet(weights='imagenet' , include_top = False ,input_shape=(224,224,3))
~\anaconda3\envs\tensorflow\lib\site-packages\keras\applications\__init__.py in wrapper(*args, **kwargs)
18 kwargs['models'] = models
19 kwargs['utils'] = utils
---> 20 return base_fun(*args, **kwargs)
21
22 return wrapper
~\anaconda3\envs\tensorflow\lib\site-packages\keras\applications\mobilenet.py in MobileNet(*args, **kwargs)
9 @keras_modules_injection
10 def MobileNet(*args, **kwargs):
---> 11 return mobilenet.MobileNet(*args, **kwargs)
12
13
~\anaconda3\envs\tensorflow\lib\site-packages\keras_applications\mobilenet.py in MobileNet(input_shape, alpha, depth_multiplier, dropout, include_top, weights, input_tensor, pooling, classes, **kwargs)
294 weight_path,
295 cache_subdir='models')
--> 296 model.load_weights(weights_path)
297 elif weights is not None:
298 model.load_weights(weights)
~\anaconda3\envs\tensorflow\lib\site-packages\keras\engine\saving.py in load_wrapper(*args, **kwargs)
490 os.remove(tmp_filepath)
491 return res
--> 492 return load_function(*args, **kwargs)
493
494 return load_wrapper
~\anaconda3\envs\tensorflow\lib\site-packages\keras\engine\network.py in load_weights(self, filepath, by_name, skip_mismatch, reshape)
1218 """
1219 if h5py is None:
-> 1220 raise ImportError('`load_weights` requires h5py.')
1221 with h5py.File(filepath, mode='r') as f:
1222 if 'layer_names' not in f.attrs and 'model_weights' in f:
ImportError: `load_weights` requires h5py.
How can I solve this error?