您好,我在使用您的代码在加载模型的时候显示模型加载出现问题,具体问题如下:
E:\Anaconda2\envs\python3.5\python.exe F:/python/fabric-defect-master/fabric-defect-master/start.py
2019-03-26 22:02:48.421673: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-03-26 22:02:48.507809: W T:\src\github\tensorflow\tensorflow\core\util\tensor_slice_reader.cc:95] Could not open .\model\cdaen.ckpt: 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?
2019-03-26 22:02:48.509846: W T:\src\github\tensorflow\tensorflow\core\util\tensor_slice_reader.cc:95] Could not open .\model\cdaen.ckpt: 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?
2019-03-26 22:02:48.510411: W T:\src\github\tensorflow\tensorflow\core\framework\op_kernel.cc:1318] OP_REQUIRES failed at save_restore_tensor.cc:170 : Data loss: Unable to open table file .\model\cdaen.ckpt: 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 "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call
return fn(*args)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:/python/fabric-defect-master/fabric-defect-master/start.py", line 91, in
saver.restore(sess, checkpoint.model_checkpoint_path)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1752, in restore
{self.saver_def.filename_tensor_name: save_path})
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Caused by op 'save/RestoreV2', defined at:
File "F:/python/fabric-defect-master/fabric-defect-master/start.py", line 38, in
saver = tf.train.Saver()
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1284, in init
self.build()
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1296, in build
self._build(self._filename, build_save=True, build_restore=True)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1333, in _build
build_save=build_save, build_restore=build_restore)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 781, in _build_internal
restore_sequentially, reshape)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 400, in _AddRestoreOps
restore_sequentially)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 832, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 1546, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
DataLossError (see above for traceback): Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
您好,我在使用您的代码在加载模型的时候显示模型加载出现问题,具体问题如下: E:\Anaconda2\envs\python3.5\python.exe F:/python/fabric-defect-master/fabric-defect-master/start.py 2019-03-26 22:02:48.421673: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2019-03-26 22:02:48.507809: W T:\src\github\tensorflow\tensorflow\core\util\tensor_slice_reader.cc:95] Could not open .\model\cdaen.ckpt: 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? 2019-03-26 22:02:48.509846: W T:\src\github\tensorflow\tensorflow\core\util\tensor_slice_reader.cc:95] Could not open .\model\cdaen.ckpt: 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? 2019-03-26 22:02:48.510411: W T:\src\github\tensorflow\tensorflow\core\framework\op_kernel.cc:1318] OP_REQUIRES failed at save_restore_tensor.cc:170 : Data loss: Unable to open table file .\model\cdaen.ckpt: 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 "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1322, in _do_call return fn(*args) File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1307, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1409, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "F:/python/fabric-defect-master/fabric-defect-master/start.py", line 91, in
saver.restore(sess, checkpoint.model_checkpoint_path)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1752, in restore
{self.saver_def.filename_tensor_name: save_path})
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 900, in run
run_metadata_ptr)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1316, in _do_run
run_metadata)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\client\session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.DataLossError: Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Caused by op 'save/RestoreV2', defined at: File "F:/python/fabric-defect-master/fabric-defect-master/start.py", line 38, in
saver = tf.train.Saver()
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1284, in init
self.build()
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1296, in build
self._build(self._filename, build_save=True, build_restore=True)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 1333, in _build
build_save=build_save, build_restore=build_restore)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 781, in _build_internal
restore_sequentially, reshape)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 400, in _AddRestoreOps
restore_sequentially)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\training\saver.py", line 832, in bulk_restore
return io_ops.restore_v2(filename_tensor, names, slices, dtypes)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\ops\gen_io_ops.py", line 1546, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\ops.py", line 3414, in create_op
op_def=op_def)
File "E:\Anaconda2\envs\python3.5\lib\site-packages\tensorflow\python\framework\ops.py", line 1740, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
DataLossError (see above for traceback): Unable to open table file .\model\cdaen.ckpt: 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 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
Process finished with exit code 1
您能提供一个可以使用的模型或者提供数据集吗? 不胜感激!