wusaifei / garbage_classify

本文新增添分类,检测,换脸技术等学习教程,各种调参技巧和tricks,卷积结构详细解析可视化,注意力机制代码等详解!本次垃圾分类挑战杯,目的在于构建基于深度学习技术的图像分类模型,实现垃圾图片类别的精准识别,大赛参考深圳垃圾分类标准,按可回收物、厨余垃圾、有害垃圾和其他垃圾四项分类。本项目包含完整的分类网络、数据增强、SVM等各种分类增强策略,后续还会继续更新新的分类技巧。
668 stars 177 forks source link

当训练完运行eval.py测试,出现TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("input_1:0", shape=(?, 456, 456, 3), dtype=float32) is not an element of this graph. #32

Open shakey-cuimiao opened 4 years ago

shakey-cuimiao commented 4 years ago

Using TensorFlow backend. 2020-03-23 14:30:41.084890: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2020-03-23 14:30:44.398776: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x5638b17ca080 executing computations on platform CUDA. Devices: 2020-03-23 14:30:44.398829: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): GeForce RTX 2080 Ti, Compute Capability 7.5 2020-03-23 14:30:44.398840: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (1): GeForce RTX 2080 Ti, Compute Capability 7.5 2020-03-23 14:30:44.405480: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2499995000 Hz 2020-03-23 14:30:44.408096: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x5638b193fdc0 executing computations on platform Host. Devices: 2020-03-23 14:30:44.408128: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): , 2020-03-23 14:30:44.408312: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: name: GeForce RTX 2080 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.545 pciBusID: 0000:01:00.0 totalMemory: 10.76GiB freeMemory: 10.60GiB 2020-03-23 14:30:44.408403: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 1 with properties: name: GeForce RTX 2080 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.545 pciBusID: 0000:02:00.0 totalMemory: 10.76GiB freeMemory: 10.60GiB 2020-03-23 14:30:44.408541: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0, 1 2020-03-23 14:30:44.411191: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-03-23 14:30:44.411219: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0 1 2020-03-23 14:30:44.411233: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N N 2020-03-23 14:30:44.411244: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 1: N N 2020-03-23 14:30:44.411375: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10312 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5) 2020-03-23 14:30:44.411927: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 10312 MB memory) -> physical GPU (device: 1, name: GeForce RTX 2080 Ti, pci bus id: 0000:02:00.0, compute capability: 7.5) WARNING:tensorflow:From /opt/shakey/imageclass/garbage_classify-master/eval.py:134: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version. Instructions for updating: This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0. WARNING:tensorflow:From /opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. 2020-03-23 14:31:22.029904: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0, 1 2020-03-23 14:31:22.030413: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix: 2020-03-23 14:31:22.030436: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0 1 2020-03-23 14:31:22.030449: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0: N N 2020-03-23 14:31:22.030459: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 1: N N 2020-03-23 14:31:22.030628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10312 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5) 2020-03-23 14:31:22.030908: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 10312 MB memory) -> physical GPU (device: 1, name: GeForce RTX 2080 Ti, pci bus id: 0000:02:00.0, compute capability: 7.5) Traceback (most recent call last): File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1092, in _run subfeed, allow_tensor=True, allow_operation=False) File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3478, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3557, in _as_graph_element_locked raise ValueError("Tensor %s is not an element of this graph." % obj) ValueError: Tensor Tensor("input_1:0", shape=(?, 456, 456, 3), dtype=float32) is not an element of this graph.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "run.py", line 168, in tf.app.run() File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run _sys.exit(main(argv)) File "run.py", line 165, in main eval_model(FLAGS) File "/opt/shakey/imageclass/garbage_classify-master/eval.py", line 218, in eval_model test_single_model(FLAGS) File "/opt/shakey/imageclass/garbage_classify-master/eval.py", line 162, in test_single_model pred_score = sess1.run([output_score], feed_dict={input_images: img}) File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run run_metadata_ptr) File "/opt/shakey/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1095, in _run 'Cannot interpret feed_dict key as Tensor: ' + e.args[0]) TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("input_1:0", shape=(?, 456, 456, 3), dtype=float32) is not an element of this graph.

LwXxz commented 4 years ago

我也存在这样的问题,请问你解决了吗

wusaifei commented 4 years ago

你好,你看一下网上是否有解决方案呢

wusaifei commented 4 years ago

@LwXxz @shakey-cuimiao 这个原因会不会是版本不匹配的问题呢?TensorFlow的版本过高?? 不知道这个能不能帮到你们:https://github.com/jaungiers/Multidimensional-LSTM-BitCoin-Time-Series/issues/1