microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.8k stars 965 forks source link

can not convert Resnet101-Faster-Rcnn from tensorflow to IR then to MXNET #74

Open xuw080 opened 6 years ago

xuw080 commented 6 years ago

I am not sure whether it is possible to convert Resnet101-Faster-Rcnn from tensorflow to IR then to MXNET. I can not even pass convert from Resnet101 to IR. Thank you so much

Platform (like ubuntu 16.04/win10): ubuntu

Source framework with version (like Tensorflow 1.4.1 with GPU): Tensorflow with GPU

Pre-trained model path (webpath or webdisk path): Path is: https://drive.google.com/drive/folders/0B1_fAEgxdnvJeGg0LWJZZ1N2aDA name: coco_900-1190k.tgz

Running scripts: For second step: python -m mmdnn.conversion.examples.tensorflow.extract_model -n resnet50 -ckpt examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001

bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.110263: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.111700: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.111733: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.111703: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.116709: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.116975: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.117285: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.118989: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.118992: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.119025: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.126774: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.126781: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.127091: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.128075: W tensorflow/core/util/tensor_slice_reader.cc:95] Could not open examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? 2018-02-07 23:26:33.128339: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/xuw080/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/examples/tensorflow/extract_model.py", line 103, in _main() File "/home/xuw080/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/examples/tensorflow/extract_model.py", line 86, in _main saver.restore(sess, args.checkpoint) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1666, in restore {self.saver_def.filename_tensor_name: save_path}) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 889, in run run_metadata_ptr) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1120, in _run feed_dict_tensor, options, run_metadata) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1317, in _do_run options, run_metadata) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1336, in _do_call raise type(e)(node_def, op, message)

Caused by op u'save/RestoreV2_126', defined at: File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/xuw080/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/examples/tensorflow/extract_model.py", line 103, in _main() File "/home/xuw080/tensorflow/lib/python2.7/site-packages/mmdnn/conversion/examples/tensorflow/extract_model.py", line 85, in _main saver = tf.train.Saver() File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1218, in init self.build() File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1227, in build self._build(self._filename, build_save=True, build_restore=True) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 1263, in _build build_save=build_save, build_restore=build_restore) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 751, in _build_internal restore_sequentially, reshape) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 427, in _AddRestoreOps tensors = self.restore_op(filename_tensor, saveable, preferred_shard) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/training/saver.py", line 267, in restore_op [spec.tensor.dtype])[0]) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_io_ops.py", line 1021, in restore_v2 shape_and_slices=shape_and_slices, dtypes=dtypes, name=name) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2956, in create_op op_def=op_def) File "/home/xuw080/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1470, in init self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

DataLossError (see above for traceback): Unable to open table file examples/tf/res50_faster_rcnn_iter_1190000.ckpt.data-00000-of-00001: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator? [[Node: save/RestoreV2_126 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2_126/tensor_names, save/RestoreV2_126/shape_and_slices)]] [[Node: save/RestoreV2_263/_37 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_584_save/RestoreV2_263", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

kitstar commented 6 years ago

Hi @xuw080 ,

  1. the resnet-50 extractor is only for slim-resnet50 model.

  2. object detection models are not supported yet. We are working on SSD models and will release it in few weeks.

Thanks.

twmht commented 6 years ago

Any example to convert if we have some custom layers? It seems that it's better to provide a tutorial to modify MMdnn if the layer is not supported by default.

namizzz commented 6 years ago

Hi @twmht ,here are Contribution-Guideline , a tutorial to modify MMdnn, and a tutorial "ImportError caused by customed layer" for models with some custom layers(class) later.