example model (resnet50_coco_best_v1.2.2.h5) failed to load, while v1.2.1.h5 works.
See original GitHub issueI followed the “example/ResNet50RetinaNet - COCO 2017” notebook and found the latest model failed to load, while the previous version works fine.
Error is TypeError: Fetch argument None has invalid type <class 'NoneType'>
Environment:
Keras 2.1.2 py 3.6 TF: 1.4
=====
Complete stack trace:
C:\ProgramData\Anaconda3\lib\site-packages\keras-2.1.2-py3.6.egg\keras\models.py:271: UserWarning: Output "non_maximum_suppression_2" missing from loss dictionary. We assume this was done on purpose, and we will not be expecting any data to be passed to "non_maximum_suppression_2" during training.
sample_weight_mode=sample_weight_mode)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-b8566c0d85ae> in <module>()
----> 1 model = keras.models.load_model('snapshots/resnet50_coco_best_v1.2.2.h5', custom_objects=custom_objects)
2 #print(model.summary())
C:\ProgramData\Anaconda3\lib\site-packages\keras-2.1.2-py3.6.egg\keras\models.py in load_model(filepath, custom_objects, compile)
284 optimizer_weight_names]
285 try:
--> 286 model.optimizer.set_weights(optimizer_weight_values)
287 except ValueError:
288 warnings.warn('Error in loading the saved optimizer '
C:\ProgramData\Anaconda3\lib\site-packages\keras-2.1.2-py3.6.egg\keras\optimizers.py in set_weights(self, weights)
97 params = self.weights
98 weight_value_tuples = []
---> 99 param_values = K.batch_get_value(params)
100 for pv, p, w in zip(param_values, params, weights):
101 if pv.shape != w.shape:
C:\ProgramData\Anaconda3\lib\site-packages\keras-2.1.2-py3.6.egg\keras\backend\tensorflow_backend.py in batch_get_value(ops)
2208 """
2209 if ops:
-> 2210 return get_session().run(ops)
2211 else:
2212 return []
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata)
887 try:
888 result = self._run(None, fetches, feed_dict, options_ptr,
--> 889 run_metadata_ptr)
890 if run_metadata:
891 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata)
1103 # Create a fetch handler to take care of the structure of fetches.
1104 fetch_handler = _FetchHandler(
-> 1105 self._graph, fetches, feed_dict_tensor, feed_handles=feed_handles)
1106
1107 # Run request and get response.
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in __init__(self, graph, fetches, feeds, feed_handles)
412 """
413 with graph.as_default():
--> 414 self._fetch_mapper = _FetchMapper.for_fetch(fetches)
415 self._fetches = []
416 self._targets = []
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in for_fetch(fetch)
232 elif isinstance(fetch, (list, tuple)):
233 # NOTE(touts): This is also the code path for namedtuples.
--> 234 return _ListFetchMapper(fetch)
235 elif isinstance(fetch, dict):
236 return _DictFetchMapper(fetch)
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in __init__(self, fetches)
339 """
340 self._fetch_type = type(fetches)
--> 341 self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
342 self._unique_fetches, self._value_indices = _uniquify_fetches(self._mappers)
343
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in <listcomp>(.0)
339 """
340 self._fetch_type = type(fetches)
--> 341 self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
342 self._unique_fetches, self._value_indices = _uniquify_fetches(self._mappers)
343
C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in for_fetch(fetch)
229 if fetch is None:
230 raise TypeError('Fetch argument %r has invalid type %r' %
--> 231 (fetch, type(fetch)))
232 elif isinstance(fetch, (list, tuple)):
233 # NOTE(touts): This is also the code path for namedtuples.
TypeError: Fetch argument None has invalid type <class 'NoneType'>
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Unable to load model from .h5 file · Issue #6937 - GitHub
Unable to load model Using TensorFlow backend. ... Can anyone guide me regarding above issue while loading the .h5 model.
Read more >Load error when loading h5 saved by simple dense model
I used following code 1 to train and save model and code #2 to load but loading results in error. Any idea? Thanks.,...
Read more >I can't load my trained h5 model with load.models(), how do I ...
Yes, there is a conflict between tf.keras and keras packages, you trained the model using tf.keras but then you are loading it with...
Read more >Loading Keras model-best.h5 saved with W&B run
Hi, While using wandb.keras.WandbCallback() I noticed that W&B saves a “model-best.h5” file at every run. However, I run into errors while ...
Read more >fail to load h5 model - Google Groups
I have the error : ... model=load_model('feuilles_simples_composees.h5') ... when loading an h5 model file, the h5 file is existing. thank you. Best regards....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to train your own model and use that, or download the pretrained model from the README. Then adjust the example code to point to that model and you should be good to go.
Closing this due to inactivity of OP.