matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.7k stars 11.71k forks source link

TF failed to load weight file #1277

Open nanma56 opened 5 years ago

nanma56 commented 5 years ago

In the demo.ipynb, when I tried to run the code: model.load_weights(COCO_MODEL_PATH, by_name=True)

I got the following error. Please advise how to solve it

Thanks

TypeError Traceback (most recent call last)

in () 3 4 # Load weights trained on MS-COCO ----> 5 model.load_weights(COCO_MODEL_PATH, by_name=True) C:\Mask_RCNN-2.1\model.py in load_weights(self, filepath, by_name, exclude) 2035 2036 if by_name: -> 2037 saving.load_weights_from_hdf5_group_by_name(f, layers) 2038 else: 2039 saving.load_weights_from_hdf5_group(f, layers) C:\Anaconda3\lib\site-packages\keras\engine\saving.py in load_weights_from_hdf5_group_by_name(f, layers, skip_mismatch, reshape) 1152 weight_values[i])) 1153 -> 1154 K.batch_set_value(weight_value_tuples) C:\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in batch_set_value(tuples) 2468 assign_ops.append(assign_op) 2469 feed_dict[assign_placeholder] = value -> 2470 get_session().run(assign_ops, feed_dict=feed_dict) 2471 2472 C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in run(self, fetches, feed_dict, options, run_metadata) 928 try: 929 result = self._run(None, fetches, feed_dict, options_ptr, --> 930 run_metadata_ptr) 931 if run_metadata: 932 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr) C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _run(self, handle, fetches, feed_dict, options, run_metadata) 1151 if final_fetches or final_targets or (handle and feed_dict_tensor): 1152 results = self._do_run(handle, final_targets, final_fetches, -> 1153 feed_dict_tensor, options, run_metadata) 1154 else: 1155 results = [] C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1327 if handle is None: 1328 return self._do_call(_run_fn, feeds, fetches, targets, options, -> 1329 run_metadata) 1330 else: 1331 return self._do_call(_prun_fn, handle, feeds, fetches) C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _do_call(self, fn, *args) 1333 def _do_call(self, fn, *args): 1334 try: -> 1335 return fn(*args) 1336 except errors.OpError as e: 1337 message = compat.as_text(e.message) C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1318 self._extend_graph() 1319 return self._call_tf_sessionrun( -> 1320 options, feed_dict, fetch_list, target_list, run_metadata) 1321 1322 def _prun_fn(handle, feed_dict, fetch_list): C:\Anaconda3\lib\site-packages\tensorflow\python\client\session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1406 return tf_session.TF_SessionRun_wrapper( 1407 self._session, options, feed_dict, fetch_list, target_list, -> 1408 run_metadata) 1409 1410 def _call_tf_sessionprun(self, handle, feed_dict, fetch_list): TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray
yugushihuang commented 5 years ago

Same error here....

GavrielHabib123 commented 4 years ago

I have the same problem. Someone knows how to fix it?